diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/MC/MCAsmLexer.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/llvm/MC/MCAsmLexer.h b/include/llvm/MC/MCAsmLexer.h index e9a6e3fda4..bec6ede4ae 100644 --- a/include/llvm/MC/MCAsmLexer.h +++ b/include/llvm/MC/MCAsmLexer.h @@ -12,11 +12,11 @@ #include "llvm/ADT/StringRef.h" #include "llvm/System/DataTypes.h" +#include "llvm/Support/SMLoc.h" namespace llvm { class MCAsmLexer; class MCInst; -class SMLoc; class Target; /// AsmToken - Target independent representation for an assembler token. @@ -103,6 +103,10 @@ public: class MCAsmLexer { /// The current token, stored in the base class for faster access. AsmToken CurTok; + + /// The location and description of the current error + SMLoc ErrLoc; + std::string Err; MCAsmLexer(const MCAsmLexer &); // DO NOT IMPLEMENT void operator=(const MCAsmLexer &); // DO NOT IMPLEMENT @@ -110,7 +114,12 @@ protected: // Can only create subclasses. MCAsmLexer(); virtual AsmToken LexToken() = 0; - + + void SetError(const SMLoc &errLoc, const std::string &err) { + ErrLoc = errLoc; + Err = err; + } + public: virtual ~MCAsmLexer(); @@ -126,6 +135,16 @@ public: const AsmToken &getTok() { return CurTok; } + + /// getErrLoc - Get the current error location + const SMLoc &getErrLoc() { + return ErrLoc; + } + + /// getErr - Get the current error string + const std::string &getErr() { + return Err; + } /// getKind - Get the kind of current token. AsmToken::TokenKind getKind() const { return CurTok.getKind(); } |