diff options
Diffstat (limited to 'llvm/lib/TableGen/TGLexer.h')
-rw-r--r-- | llvm/lib/TableGen/TGLexer.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/llvm/lib/TableGen/TGLexer.h b/llvm/lib/TableGen/TGLexer.h index 3085ab2c04785..6d10af3486740 100644 --- a/llvm/lib/TableGen/TGLexer.h +++ b/llvm/lib/TableGen/TGLexer.h @@ -19,8 +19,8 @@ #include "llvm/Support/DataTypes.h" #include "llvm/Support/SMLoc.h" #include <cassert> -#include <map> #include <memory> +#include <set> #include <string> namespace llvm { @@ -44,14 +44,15 @@ namespace tgtok { equal, question, // = ? paste, // # - // Keywords. + // Keywords. ('ElseKW' is named to distinguish it from the existing 'Else' + // that means the preprocessor #else.) Bit, Bits, Class, Code, Dag, Def, Foreach, Defm, Field, In, Int, Let, List, - MultiClass, String, Defset, + MultiClass, String, Defset, Defvar, If, Then, ElseKW, // !keywords. XConcat, XADD, XMUL, XAND, XOR, XSRA, XSRL, XSHL, XListConcat, XListSplat, XStrConcat, XCast, XSubst, XForEach, XFoldl, XHead, XTail, XSize, XEmpty, - XIf, XCond, XEq, XIsA, XDag, XNe, XLe, XLt, XGe, XGt, + XIf, XCond, XEq, XIsA, XDag, XNe, XLe, XLt, XGe, XGt, XSetOp, XGetOp, // Integer value. IntVal, @@ -73,24 +74,25 @@ namespace tgtok { class TGLexer { SourceMgr &SrcMgr; - const char *CurPtr; + const char *CurPtr = nullptr; StringRef CurBuf; // Information about the current token. - const char *TokStart; - tgtok::TokKind CurCode; + const char *TokStart = nullptr; + tgtok::TokKind CurCode = tgtok::TokKind::Eof; std::string CurStrVal; // This is valid for ID, STRVAL, VARNAME, CODEFRAGMENT - int64_t CurIntVal; // This is valid for INTVAL. + int64_t CurIntVal = 0; // This is valid for INTVAL. /// CurBuffer - This is the current buffer index we're lexing from as managed /// by the SourceMgr object. - unsigned CurBuffer; + unsigned CurBuffer = 0; public: - typedef std::map<std::string, SMLoc> DependenciesMapTy; + typedef std::set<std::string> DependenciesSetTy; + private: /// Dependencies - This is the list of all included files. - DependenciesMapTy Dependencies; + DependenciesSetTy Dependencies; public: TGLexer(SourceMgr &SrcMgr, ArrayRef<std::string> Macros); @@ -99,7 +101,7 @@ public: return CurCode = LexToken(CurPtr == CurBuf.begin()); } - const DependenciesMapTy &getDependencies() const { + const DependenciesSetTy &getDependencies() const { return Dependencies; } |