10 #ifndef LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H 11 #define LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H 33 template<
typename T,
bool (T::*Handler)(StringRef, SMLoc)>
37 T *Obj =
static_cast<T*
>(Target);
38 return (Obj->*Handler)(Directive, DirectiveLoc);
90 const Twine &Msg =
"unexpected token") {
121 #endif // LLVM_MC_MCPARSER_MCASMPARSEREXTENSION_H Represents a range in source code.
SourceMgr & getSourceManager()
bool addErrorSuffix(const Twine &Suffix)
bool parseMany(function_ref< bool()> parseOne, bool hasComma=true)
This class represents lattice values for constants.
virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a warning at the location L, with the message Msg.
Generic assembler parser interface, for use by target specific assembly parsers.
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
const MCAsmLexer & getLexer() const
bool parseOptionalToken(AsmToken::TokenKind T)
bool check(bool P, const Twine &Msg)
An efficient, type-erasing, non-owning reference to a callable.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual SourceMgr & getSourceManager()=0
bool Error(SMLoc L, const Twine &Msg, SMRange Range=SMRange())
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Generic assembler lexer interface, for use by target specific assembly lexers.
Target independent representation for an assembler token.
Context object for machine code objects.
const AsmToken & getTok()
bool check(bool P, SMLoc Loc, const Twine &Msg)
const MCAsmParser & getParser() const
bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")
virtual MCContext & getContext()=0
Streaming machine code generation interface.
bool Warning(SMLoc L, const Twine &Msg)
bool TokError(const Twine &Msg)
virtual MCAsmLexer & getLexer()=0
MCStreamer & getStreamer()
static bool HandleDirective(MCAsmParserExtension *Target, StringRef Directive, SMLoc DirectiveLoc)
bool parseToken(AsmToken::TokenKind T, const Twine &Msg="unexpected token")
bool Error(SMLoc L, const Twine &Msg, SMRange Range=None)
Return an error at the location L, with the message Msg.
MCAsmParser & getParser()
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
bool HasBracketExpressions() const
bool BracketExpressionsSupported
virtual MCStreamer & getStreamer()=0
Return the output streamer for the assembler.
bool parseMany(function_ref< bool()> parseOne, bool hasComma=true)
bool addErrorSuffix(const Twine &Suffix)
Target - Wrapper for Target specific information.
bool check(bool P, const Twine &Msg)
void Note(SMLoc L, const Twine &Msg)
virtual void Note(SMLoc L, const Twine &Msg, SMRange Range=None)=0
Emit a note at the location L, with the message Msg.
virtual ~MCAsmParserExtension()
bool TokError(const Twine &Msg, SMRange Range=None)
Report an error at the current lexer location.
Generic interface for extending the MCAsmParser, which is implemented by target and object file assem...
bool parseOptionalToken(AsmToken::TokenKind T)
Attempt to parse and consume token, returning true on success.
StringRef - Represent a constant reference to a string, i.e.
MCAsmParserExtension & operator=(const MCAsmParserExtension &)=delete
Represents a location in source code.