diff options
Diffstat (limited to 'llvm/utils/TableGen/TGLexer.h')
| -rw-r--r-- | llvm/utils/TableGen/TGLexer.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/llvm/utils/TableGen/TGLexer.h b/llvm/utils/TableGen/TGLexer.h index 0e67f680557..59e9fa0ef5f 100644 --- a/llvm/utils/TableGen/TGLexer.h +++ b/llvm/utils/TableGen/TGLexer.h @@ -22,6 +22,7 @@ namespace llvm { class MemoryBuffer; +class TGSourceMgr; namespace tgtok { enum TokKind { @@ -55,33 +56,27 @@ namespace tgtok { /// TGLexer - TableGen Lexer class. class TGLexer { + TGSourceMgr &SrcMgr; + const char *CurPtr; - unsigned CurLineNo; - MemoryBuffer *CurBuf; + const MemoryBuffer *CurBuf; // Information about the current token. const char *TokStart; tgtok::TokKind CurCode; std::string CurStrVal; // This is valid for ID, STRVAL, VARNAME, CODEFRAGMENT int64_t CurIntVal; // This is valid for INTVAL. - - /// IncludeRec / IncludeStack - This captures the current set of include - /// directives we are nested within. - struct IncludeRec { - MemoryBuffer *Buffer; - const char *CurPtr; - unsigned LineNo; - IncludeRec(MemoryBuffer *buffer, const char *curPtr, unsigned lineNo) - : Buffer(buffer), CurPtr(curPtr), LineNo(lineNo) {} - }; - std::vector<IncludeRec> IncludeStack; + + /// CurBuffer - This is the current buffer index we're lexing from as managed + /// by the SourceMgr object. + int CurBuffer; // IncludeDirectories - This is the list of directories we should search for // include files in. std::vector<std::string> IncludeDirectories; public: - TGLexer(MemoryBuffer *StartBuf); - ~TGLexer(); + TGLexer(TGSourceMgr &SrcMgr); + ~TGLexer() {} void setIncludeDirs(const std::vector<std::string> &Dirs) { IncludeDirectories = Dirs; @@ -109,8 +104,6 @@ public: void PrintError(LocTy Loc, const std::string &Msg) const; - void PrintIncludeStack(std::ostream &OS) const; - private: /// LexToken - Read the next token and return its code. tgtok::TokKind LexToken(); |

