diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-13 16:01:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-13 16:01:53 +0000 |
commit | 1c8ae59dfdc85d917db0333ae0b93e2be4ca6c36 (patch) | |
tree | 6f5e05ef52d3c8eac1f42518dc5d7db4be9d8949 /utils/TableGen/TGLexer.cpp | |
parent | d9c9bf77d82a00c2fe34db2da00244523f4ac288 (diff) |
make "locations" a class instead of a typedef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/TGLexer.cpp')
-rw-r--r-- | utils/TableGen/TGLexer.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp index 761985e410..e315db2545 100644 --- a/utils/TableGen/TGLexer.cpp +++ b/utils/TableGen/TGLexer.cpp @@ -31,6 +31,10 @@ TGLexer::TGLexer(TGSourceMgr &SM) : SrcMgr(SM) { TokStart = 0; } +TGLoc TGLexer::getLoc() const { + return TGLoc::getFromPointer(TokStart); +} + /// ReturnError - Set the error to the specified string at the specified /// location. This is defined to always return tgtok::Error. @@ -40,10 +44,15 @@ tgtok::TokKind TGLexer::ReturnError(const char *Loc, const std::string &Msg) { } -void TGLexer::PrintError(LocTy Loc, const std::string &Msg) const { +void TGLexer::PrintError(const char *Loc, const std::string &Msg) const { + SrcMgr.PrintError(TGLoc::getFromPointer(Loc), Msg); +} + +void TGLexer::PrintError(TGLoc Loc, const std::string &Msg) const { SrcMgr.PrintError(Loc, Msg); } + int TGLexer::getNextChar() { char CurChar = *CurPtr++; switch (CurChar) { @@ -57,11 +66,11 @@ int TGLexer::getNextChar() { // If this is the end of an included file, pop the parent file off the // include stack. - TGLocTy ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer); - if (ParentIncludeLoc != TGLocTy()) { + TGLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer); + if (ParentIncludeLoc != TGLoc()) { CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc); CurBuf = SrcMgr.getMemoryBuffer(CurBuffer); - CurPtr = ParentIncludeLoc; + CurPtr = ParentIncludeLoc.getPointer(); return getNextChar(); } @@ -239,7 +248,7 @@ bool TGLexer::LexInclude() { } // Save the line number and lex buffer of the includer. - CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, CurPtr); + CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, TGLoc::getFromPointer(CurPtr)); CurBuf = NewBuf; CurPtr = CurBuf->getBufferStart(); |