diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-05-27 18:44:32 +0000 |
commit | 5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch) | |
tree | a6140557876943cdd800ee997c9317283394b22c /include/llvm/MC/MCParser | |
parent | f03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff) |
Diffstat (limited to 'include/llvm/MC/MCParser')
-rw-r--r-- | include/llvm/MC/MCParser/AsmLexer.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmLexer.h | 12 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParser.h | 74 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCAsmParserExtension.h | 6 | ||||
-rw-r--r-- | include/llvm/MC/MCParser/MCParsedAsmOperand.h | 5 |
5 files changed, 54 insertions, 49 deletions
diff --git a/include/llvm/MC/MCParser/AsmLexer.h b/include/llvm/MC/MCParser/AsmLexer.h index a9a30f1720712..62d39b26c8600 100644 --- a/include/llvm/MC/MCParser/AsmLexer.h +++ b/include/llvm/MC/MCParser/AsmLexer.h @@ -31,8 +31,8 @@ class AsmLexer : public MCAsmLexer { StringRef CurBuf; bool isAtStartOfLine; - void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION; - AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION; + void operator=(const AsmLexer&) = delete; + AsmLexer(const AsmLexer&) = delete; protected: /// LexToken - Read the next token and return its code. @@ -40,7 +40,7 @@ protected: public: AsmLexer(const MCAsmInfo &MAI); - ~AsmLexer(); + ~AsmLexer() override; void setBuffer(StringRef Buf, const char *ptr = nullptr); diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h index b05891c13250b..71f15b37c331e 100644 --- a/include/llvm/MC/MCParser/MCAsmLexer.h +++ b/include/llvm/MC/MCParser/MCAsmLexer.h @@ -63,10 +63,10 @@ private: public: AsmToken() {} - AsmToken(TokenKind _Kind, StringRef _Str, APInt _IntVal) - : Kind(_Kind), Str(_Str), IntVal(_IntVal) {} - AsmToken(TokenKind _Kind, StringRef _Str, int64_t _IntVal = 0) - : Kind(_Kind), Str(_Str), IntVal(64, _IntVal, true) {} + AsmToken(TokenKind Kind, StringRef Str, APInt IntVal) + : Kind(Kind), Str(Str), IntVal(IntVal) {} + AsmToken(TokenKind Kind, StringRef Str, int64_t IntVal = 0) + : Kind(Kind), Str(Str), IntVal(64, IntVal, true) {} TokenKind getKind() const { return Kind; } bool is(TokenKind K) const { return Kind == K; } @@ -124,8 +124,8 @@ class MCAsmLexer { SMLoc ErrLoc; std::string Err; - MCAsmLexer(const MCAsmLexer &) LLVM_DELETED_FUNCTION; - void operator=(const MCAsmLexer &) LLVM_DELETED_FUNCTION; + MCAsmLexer(const MCAsmLexer &) = delete; + void operator=(const MCAsmLexer &) = delete; protected: // Can only create subclasses. const char *TokStart; bool SkipSpace; diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 34188e66e62da..0538b9457f9eb 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -45,7 +45,7 @@ public: } }; -/// Generic Sema callback for assembly parser. +/// \brief Generic Sema callback for assembly parser. class MCAsmParserSemaCallback { public: virtual ~MCAsmParserSemaCallback(); @@ -59,8 +59,8 @@ public: unsigned &Offset) = 0; }; -/// Generic assembler parser interface, for use by target specific assembly -/// parsers. +/// \brief Generic assembler parser interface, for use by target specific +/// assembly parsers. class MCAsmParser { public: typedef bool (*DirectiveHandler)(MCAsmParserExtension*, StringRef, SMLoc); @@ -68,8 +68,8 @@ public: ExtensionDirectiveHandler; private: - MCAsmParser(const MCAsmParser &) LLVM_DELETED_FUNCTION; - void operator=(const MCAsmParser &) LLVM_DELETED_FUNCTION; + MCAsmParser(const MCAsmParser &) = delete; + void operator=(const MCAsmParser &) = delete; MCTargetAsmParser *TargetParser; @@ -84,6 +84,8 @@ public: virtual void addDirectiveHandler(StringRef Directive, ExtensionDirectiveHandler Handler) = 0; + virtual void addAliasForDirective(StringRef Directive, StringRef Alias) = 0; + virtual SourceMgr &getSourceManager() = 0; virtual MCAsmLexer &getLexer() = 0; @@ -93,7 +95,7 @@ public: virtual MCContext &getContext() = 0; - /// Return the output streamer for the assembler. + /// \brief Return the output streamer for the assembler. virtual MCStreamer &getStreamer() = 0; MCTargetAsmParser &getTargetParser() const { return *TargetParser; } @@ -105,13 +107,13 @@ public: bool getShowParsedOperands() const { return ShowParsedOperands; } void setShowParsedOperands(bool Value) { ShowParsedOperands = Value; } - /// Run the parser on the input source buffer. + /// \brief Run the parser on the input source buffer. virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; virtual void setParsingInlineAsm(bool V) = 0; virtual bool isParsingInlineAsm() = 0; - /// Parse ms-style inline assembly. + /// \brief Parse MS-style inline assembly. virtual bool parseMSInlineAsm( void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, SmallVectorImpl<std::pair<void *, bool>> &OpDecls, @@ -119,35 +121,35 @@ public: SmallVectorImpl<std::string> &Clobbers, const MCInstrInfo *MII, const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0; - /// Emit a note at the location \p L, with the message \p Msg. + /// \brief Emit a note at the location \p L, with the message \p Msg. virtual void Note(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges = None) = 0; - /// Emit a warning at the location \p L, with the message \p Msg. + /// \brief Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. virtual bool Warning(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges = None) = 0; - /// Emit an error at the location \p L, with the message \p Msg. + /// \brief Emit an error at the location \p L, with the message \p Msg. /// /// \return The return value is always true, as an idiomatic convenience to /// clients. virtual bool Error(SMLoc L, const Twine &Msg, ArrayRef<SMRange> Ranges = None) = 0; - /// Get the next AsmToken in the stream, possibly handling file inclusion - /// first. + /// \brief Get the next AsmToken in the stream, possibly handling file + /// inclusion first. virtual const AsmToken &Lex() = 0; - /// Get the current AsmToken from the stream. + /// \brief Get the current AsmToken from the stream. const AsmToken &getTok() const; /// \brief Report an error at the current lexer location. bool TokError(const Twine &Msg, ArrayRef<SMRange> Ranges = None); - /// Parse an identifier or string (as a quoted identifier) and set \p Res to - /// the identifier contents. + /// \brief Parse an identifier or string (as a quoted identifier) and set \p + /// Res to the identifier contents. virtual bool parseIdentifier(StringRef &Res) = 0; /// \brief Parse up to the end of statement and return the contents from the @@ -155,51 +157,51 @@ public: /// will be either the EndOfStatement or EOF. virtual StringRef parseStringToEndOfStatement() = 0; - /// Parse the current token as a string which may include escaped characters - /// and return the string contents. + /// \brief Parse the current token as a string which may include escaped + /// characters and return the string contents. virtual bool parseEscapedString(std::string &Data) = 0; - /// Skip to the end of the current statement, for error recovery. + /// \brief Skip to the end of the current statement, for error recovery. virtual void eatToEndOfStatement() = 0; - /// Parse an arbitrary expression. + /// \brief Parse an arbitrary expression. /// - /// @param Res - The value of the expression. The result is undefined + /// \param Res - The value of the expression. The result is undefined /// on error. - /// @result - False on success. + /// \return - False on success. virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; bool parseExpression(const MCExpr *&Res); - /// Parse a primary expression. + /// \brief Parse a primary expression. /// - /// @param Res - The value of the expression. The result is undefined + /// \param Res - The value of the expression. The result is undefined /// on error. - /// @result - False on success. + /// \return - False on success. virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) = 0; - /// Parse an arbitrary expression, assuming that an initial '(' has already - /// been consumed. + /// \brief Parse an arbitrary expression, assuming that an initial '(' has + /// already been consumed. /// - /// @param Res - The value of the expression. The result is undefined + /// \param Res - The value of the expression. The result is undefined /// on error. - /// @result - False on success. + /// \return - False on success. virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0; - /// Parse an expression which must evaluate to an absolute value. + /// \brief Parse an expression which must evaluate to an absolute value. /// - /// @param Res - The value of the absolute expression. The result is undefined + /// \param Res - The value of the absolute expression. The result is undefined /// on error. - /// @result - False on success. + /// \return - False on success. virtual bool parseAbsoluteExpression(int64_t &Res) = 0; - /// Ensure that we have a valid section set in the streamer. Otherwise, report - /// an error and switch to .text. + /// \brief Ensure that we have a valid section set in the streamer. Otherwise, + /// report an error and switch to .text. virtual void checkForValidSection() = 0; }; /// \brief Create an MCAsmParser instance. -MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, - MCStreamer &, const MCAsmInfo &); +MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, + const MCAsmInfo &); } // End llvm namespace diff --git a/include/llvm/MC/MCParser/MCAsmParserExtension.h b/include/llvm/MC/MCParser/MCAsmParserExtension.h index bfc0afa132b7f..077fd21e073ce 100644 --- a/include/llvm/MC/MCParser/MCAsmParserExtension.h +++ b/include/llvm/MC/MCParser/MCAsmParserExtension.h @@ -21,8 +21,8 @@ class Twine; /// which is implemented by target and object file assembly parser /// implementations. class MCAsmParserExtension { - MCAsmParserExtension(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION; - void operator=(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION; + MCAsmParserExtension(const MCAsmParserExtension &) = delete; + void operator=(const MCAsmParserExtension &) = delete; MCAsmParser *Parser; @@ -48,7 +48,7 @@ public: /// parsing routines. virtual void Initialize(MCAsmParser &Parser); - /// @name MCAsmParser Proxy Interfaces + /// \name MCAsmParser Proxy Interfaces /// @{ MCContext &getContext() { return getParser().getContext(); } diff --git a/include/llvm/MC/MCParser/MCParsedAsmOperand.h b/include/llvm/MC/MCParser/MCParsedAsmOperand.h index e8740aa10aa2a..a25108a0effb0 100644 --- a/include/llvm/MC/MCParser/MCParsedAsmOperand.h +++ b/include/llvm/MC/MCParser/MCParsedAsmOperand.h @@ -10,8 +10,11 @@ #ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H #define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H +#include <string> +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/SMLoc.h" + namespace llvm { -class SMLoc; class raw_ostream; /// MCParsedAsmOperand - This abstract class represents a source-level assembly |