rename TGLoc -> SMLoc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h
index 18b10ea..5f45ea0 100644
--- a/utils/TableGen/Record.h
+++ b/utils/TableGen/Record.h
@@ -1214,19 +1214,19 @@
 
 class Record {
   std::string Name;
-  TGLoc Loc;
+  SMLoc Loc;
   std::vector<std::string> TemplateArgs;
   std::vector<RecordVal> Values;
   std::vector<Record*> SuperClasses;
 public:
 
-  explicit Record(const std::string &N, TGLoc loc) : Name(N), Loc(loc) {}
+  explicit Record(const std::string &N, SMLoc loc) : Name(N), Loc(loc) {}
   ~Record() {}
   
   const std::string &getName() const { return Name; }
   void setName(const std::string &Name);  // Also updates RecordKeeper.
   
-  TGLoc getLoc() const { return Loc; }
+  SMLoc getLoc() const { return Loc; }
   
   const std::vector<std::string> &getTemplateArgs() const {
     return TemplateArgs;
@@ -1381,7 +1381,7 @@
 
   void dump() const;
 
-  MultiClass(const std::string &Name, TGLoc Loc) : Rec(Name, Loc) {}
+  MultiClass(const std::string &Name, SMLoc Loc) : Rec(Name, Loc) {}
 };
 
 class RecordKeeper {
@@ -1461,12 +1461,12 @@
 
 
 class TGError {
-  TGLoc Loc;
+  SMLoc Loc;
   std::string Message;
 public:
-  TGError(TGLoc loc, const std::string &message) : Loc(loc), Message(message) {}
+  TGError(SMLoc loc, const std::string &message) : Loc(loc), Message(message) {}
   
-  TGLoc getLoc() const { return Loc; }
+  SMLoc getLoc() const { return Loc; }
   const std::string &getMessage() const { return Message; }
 };
   
@@ -1475,7 +1475,7 @@
 
 extern RecordKeeper Records;
 
-void PrintError(TGLoc ErrorLoc, const std::string &Msg);
+void PrintError(SMLoc ErrorLoc, const std::string &Msg);
 
   
 } // End llvm namespace
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index 1941a59..2f619e4 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -31,8 +31,8 @@
   TokStart = 0;
 }
 
-TGLoc TGLexer::getLoc() const {
-  return TGLoc::getFromPointer(TokStart);
+SMLoc TGLexer::getLoc() const {
+  return SMLoc::getFromPointer(TokStart);
 }
 
 
@@ -45,10 +45,10 @@
 
 
 void TGLexer::PrintError(const char *Loc, const std::string &Msg) const {
-  SrcMgr.PrintError(TGLoc::getFromPointer(Loc), Msg);
+  SrcMgr.PrintError(SMLoc::getFromPointer(Loc), Msg);
 }
 
-void TGLexer::PrintError(TGLoc Loc, const std::string &Msg) const {
+void TGLexer::PrintError(SMLoc Loc, const std::string &Msg) const {
   SrcMgr.PrintError(Loc, Msg);
 }
 
@@ -66,8 +66,8 @@
     
     // If this is the end of an included file, pop the parent file off the
     // include stack.
-    TGLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
-    if (ParentIncludeLoc != TGLoc()) {
+    SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
+    if (ParentIncludeLoc != SMLoc()) {
       CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc);
       CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
       CurPtr = ParentIncludeLoc.getPointer();
@@ -293,7 +293,7 @@
   }
   
   // Save the line number and lex buffer of the includer.
-  CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, TGLoc::getFromPointer(CurPtr));
+  CurBuffer = SrcMgr.AddNewSourceBuffer(NewBuf, SMLoc::getFromPointer(CurPtr));
   
   CurBuf = NewBuf;
   CurPtr = CurBuf->getBufferStart();
diff --git a/utils/TableGen/TGLexer.h b/utils/TableGen/TGLexer.h
index ac3b984..82f312a 100644
--- a/utils/TableGen/TGLexer.h
+++ b/utils/TableGen/TGLexer.h
@@ -23,7 +23,7 @@
 namespace llvm {
 class MemoryBuffer;
 class TGSourceMgr;
-class TGLoc;
+class SMLoc;
   
 namespace tgtok {
   enum TokKind {
@@ -101,10 +101,10 @@
     return CurIntVal;
   }
 
-  TGLoc getLoc() const;
+  SMLoc getLoc() const;
 
   void PrintError(const char *Loc, const std::string &Msg) const;
-  void PrintError(TGLoc Loc, const std::string &Msg) const;
+  void PrintError(SMLoc Loc, const std::string &Msg) const;
   
 private:
   /// LexToken - Read the next token and return its code.
diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp
index cdd2857..28ebdb5 100644
--- a/utils/TableGen/TGParser.cpp
+++ b/utils/TableGen/TGParser.cpp
@@ -26,7 +26,7 @@
 
 namespace llvm {
 struct SubClassReference {
-  TGLoc RefLoc;
+  SMLoc RefLoc;
   Record *Rec;
   std::vector<Init*> TemplateArgs;
   SubClassReference() : Rec(0) {}
@@ -35,7 +35,7 @@
 };
 
 struct SubMultiClassReference {
-  TGLoc RefLoc;
+  SMLoc RefLoc;
   MultiClass *MC;
   std::vector<Init*> TemplateArgs;
   SubMultiClassReference() : MC(0) {}
@@ -60,7 +60,7 @@
 
 } // end namespace llvm
 
-bool TGParser::AddValue(Record *CurRec, TGLoc Loc, const RecordVal &RV) {
+bool TGParser::AddValue(Record *CurRec, SMLoc Loc, const RecordVal &RV) {
   if (CurRec == 0)
     CurRec = &CurMultiClass->Rec;
   
@@ -79,7 +79,7 @@
 
 /// SetValue -
 /// Return true on error, false on success.
-bool TGParser::SetValue(Record *CurRec, TGLoc Loc, const std::string &ValName, 
+bool TGParser::SetValue(Record *CurRec, SMLoc Loc, const std::string &ValName, 
                         const std::vector<unsigned> &BitList, Init *V) {
   if (!V) return false;
 
@@ -527,7 +527,7 @@
   if (Lex.getCode() != tgtok::less)
     return false;
   
-  TGLoc StartLoc = Lex.getLoc();
+  SMLoc StartLoc = Lex.getLoc();
   Lex.Lex(); // eat the '<'
   
   // Parse the range list.
@@ -549,7 +549,7 @@
   if (Lex.getCode() != tgtok::l_brace)
     return false;
   
-  TGLoc StartLoc = Lex.getLoc();
+  SMLoc StartLoc = Lex.getLoc();
   Lex.Lex(); // eat the '{'
   
   // Parse the range list.
@@ -634,7 +634,7 @@
 Init *TGParser::ParseIDValue(Record *CurRec) {
   assert(Lex.getCode() == tgtok::Id && "Expected ID in ParseIDValue");
   std::string Name = Lex.getCurStrVal();
-  TGLoc Loc = Lex.getLoc();
+  SMLoc Loc = Lex.getLoc();
   Lex.Lex();
   return ParseIDValue(CurRec, Name, Loc);
 }
@@ -642,7 +642,7 @@
 /// ParseIDValue - This is just like ParseIDValue above, but it assumes the ID
 /// has already been read.
 Init *TGParser::ParseIDValue(Record *CurRec, 
-                             const std::string &Name, TGLoc NameLoc) {
+                             const std::string &Name, SMLoc NameLoc) {
   if (CurRec) {
     if (const RecordVal *RV = CurRec->getValue(Name))
       return new VarInit(Name, RV->getType());
@@ -1041,7 +1041,7 @@
       R = new CodeInit(Lex.getCurStrVal()); Lex.Lex(); break;
   case tgtok::question: R = new UnsetInit(); Lex.Lex(); break;
   case tgtok::Id: {
-    TGLoc NameLoc = Lex.getLoc();
+    SMLoc NameLoc = Lex.getLoc();
     std::string Name = Lex.getCurStrVal();
     if (Lex.Lex() != tgtok::less)  // consume the Id.
       return ParseIDValue(CurRec, Name, NameLoc);    // Value ::= IDValue
@@ -1087,7 +1087,7 @@
     return new DefInit(NewRec);
   }    
   case tgtok::l_brace: {           // Value ::= '{' ValueList '}'
-    TGLoc BraceLoc = Lex.getLoc();
+    SMLoc BraceLoc = Lex.getLoc();
     Lex.Lex(); // eat the '{'
     std::vector<Init*> Vals;
     
@@ -1295,7 +1295,7 @@
     switch (Lex.getCode()) {
     default: return Result;
     case tgtok::l_brace: {
-      TGLoc CurlyLoc = Lex.getLoc();
+      SMLoc CurlyLoc = Lex.getLoc();
       Lex.Lex(); // eat the '{'
       std::vector<unsigned> Ranges = ParseRangeList();
       if (Ranges.empty()) return 0;
@@ -1317,7 +1317,7 @@
       break;
     }
     case tgtok::l_square: {
-      TGLoc SquareLoc = Lex.getLoc();
+      SMLoc SquareLoc = Lex.getLoc();
       Lex.Lex(); // eat the '['
       std::vector<unsigned> Ranges = ParseRangeList();
       if (Ranges.empty()) return 0;
@@ -1449,7 +1449,7 @@
     return "";
   }
   
-  TGLoc IdLoc = Lex.getLoc();
+  SMLoc IdLoc = Lex.getLoc();
   std::string DeclName = Lex.getCurStrVal();
   Lex.Lex();
   
@@ -1470,7 +1470,7 @@
   // If a value is present, parse it.
   if (Lex.getCode() == tgtok::equal) {
     Lex.Lex();
-    TGLoc ValLoc = Lex.getLoc();
+    SMLoc ValLoc = Lex.getLoc();
     Init *Val = ParseValue(CurRec, Type);
     if (Val == 0 ||
         SetValue(CurRec, ValLoc, DeclName, std::vector<unsigned>(), Val))
@@ -1536,7 +1536,7 @@
   if (Lex.Lex() != tgtok::Id)
     return TokError("expected field identifier after let");
   
-  TGLoc IdLoc = Lex.getLoc();
+  SMLoc IdLoc = Lex.getLoc();
   std::string FieldName = Lex.getCurStrVal();
   Lex.Lex();  // eat the field name.
   
@@ -1640,7 +1640,7 @@
 ///   DefInst ::= DEF ObjectName ObjectBody
 ///
 llvm::Record *TGParser::ParseDef(MultiClass *CurMultiClass) {
-  TGLoc DefLoc = Lex.getLoc();
+  SMLoc DefLoc = Lex.getLoc();
   assert(Lex.getCode() == tgtok::Def && "Unknown tok");
   Lex.Lex();  // Eat the 'def' token.  
 
@@ -1728,7 +1728,7 @@
       return std::vector<LetRecord>();
     }
     std::string Name = Lex.getCurStrVal();
-    TGLoc NameLoc = Lex.getLoc();
+    SMLoc NameLoc = Lex.getLoc();
     Lex.Lex();  // Eat the identifier. 
 
     // Check for an optional RangeList.
@@ -1780,7 +1780,7 @@
     if (ParseObject())
       return true;
   } else {   // Object ::= LETCommand '{' ObjectList '}'
-    TGLoc BraceLoc = Lex.getLoc();
+    SMLoc BraceLoc = Lex.getLoc();
     // Otherwise, this is a group let.
     Lex.Lex();  // eat the '{'.
     
@@ -1905,7 +1905,7 @@
   if (Lex.Lex() != tgtok::Id)  // eat the defm.
     return TokError("expected identifier after defm");
   
-  TGLoc DefmPrefixLoc = Lex.getLoc();
+  SMLoc DefmPrefixLoc = Lex.getLoc();
   std::string DefmPrefix = Lex.getCurStrVal();
   if (Lex.Lex() != tgtok::colon)
     return TokError("expected ':' after defm identifier");
@@ -1913,7 +1913,7 @@
   // eat the colon.
   Lex.Lex();
 
-  TGLoc SubClassLoc = Lex.getLoc();
+  SMLoc SubClassLoc = Lex.getLoc();
   SubClassReference Ref = ParseSubClassReference(0, true);
 
   while (1) {
diff --git a/utils/TableGen/TGParser.h b/utils/TableGen/TGParser.h
index c618708..8602357 100644
--- a/utils/TableGen/TGParser.h
+++ b/utils/TableGen/TGParser.h
@@ -31,9 +31,9 @@
     std::string Name;
     std::vector<unsigned> Bits;
     Init *Value;
-    TGLoc Loc;
+    SMLoc Loc;
     LetRecord(const std::string &N, const std::vector<unsigned> &B, Init *V,
-              TGLoc L)
+              SMLoc L)
       : Name(N), Bits(B), Value(V), Loc(L) {
     }
   };
@@ -55,7 +55,7 @@
   /// routines return true on error, or false on success.
   bool ParseFile();
   
-  bool Error(TGLoc L, const std::string &Msg) const {
+  bool Error(SMLoc L, const std::string &Msg) const {
     Lex.PrintError(L, Msg);
     return true;
   }
@@ -63,8 +63,8 @@
     return Error(Lex.getLoc(), Msg);
   }
 private:  // Semantic analysis methods.
-  bool AddValue(Record *TheRec, TGLoc Loc, const RecordVal &RV);
-  bool SetValue(Record *TheRec, TGLoc Loc, const std::string &ValName, 
+  bool AddValue(Record *TheRec, SMLoc Loc, const RecordVal &RV);
+  bool SetValue(Record *TheRec, SMLoc Loc, const std::string &ValName, 
                 const std::vector<unsigned> &BitList, Init *V);
   bool AddSubClass(Record *Rec, SubClassReference &SubClass);
   bool AddSubMultiClass(MultiClass *CurMC,
@@ -92,7 +92,7 @@
   SubMultiClassReference ParseSubMultiClassReference(MultiClass *CurMC);
 
   Init *ParseIDValue(Record *CurRec);
-  Init *ParseIDValue(Record *CurRec, const std::string &Name, TGLoc NameLoc);
+  Init *ParseIDValue(Record *CurRec, const std::string &Name, SMLoc NameLoc);
   Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = 0);
   Init *ParseValue(Record *CurRec, RecTy *ItemType = 0);
   std::vector<Init*> ParseValueList(Record *CurRec, Record *ArgsRec = 0, RecTy *EltTy = 0);
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index dbc4d33..a1b768e 100644
--- a/utils/TableGen/TableGen.cpp
+++ b/utils/TableGen/TableGen.cpp
@@ -126,7 +126,7 @@
 
 static TGSourceMgr SrcMgr;
 
-void llvm::PrintError(TGLoc ErrorLoc, const std::string &Msg) {
+void llvm::PrintError(SMLoc ErrorLoc, const std::string &Msg) {
   SrcMgr.PrintError(ErrorLoc, Msg);
 }
 
@@ -145,7 +145,7 @@
   }
   
   // Tell SrcMgr about this buffer, which is what TGParser will pick up.
-  SrcMgr.AddNewSourceBuffer(F, TGLoc());
+  SrcMgr.AddNewSourceBuffer(F, SMLoc());
   
   TGParser Parser(SrcMgr);