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
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index 761985e..e315db2 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -31,6 +31,10 @@
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 @@
}
-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 @@
// 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 @@
}
// 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();