[llvm-commits] [llvm] r73843 - in /llvm/trunk: include/llvm/Support/SourceMgr.h lib/Support/SourceMgr.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp utils/TableGen/TGParser.h utils/TableGen/TableGen.cpp

Chris Lattner sabre at nondot.org
Sat Jun 20 20:39:35 PDT 2009


Author: lattner
Date: Sat Jun 20 22:39:35 2009
New Revision: 73843

URL: http://llvm.org/viewvc/llvm-project?rev=73843&view=rev
Log:
rename TGLoc -> SMLoc.

Modified:
    llvm/trunk/include/llvm/Support/SourceMgr.h
    llvm/trunk/lib/Support/SourceMgr.cpp
    llvm/trunk/utils/TableGen/Record.h
    llvm/trunk/utils/TableGen/TGLexer.cpp
    llvm/trunk/utils/TableGen/TGLexer.h
    llvm/trunk/utils/TableGen/TGParser.cpp
    llvm/trunk/utils/TableGen/TGParser.h
    llvm/trunk/utils/TableGen/TableGen.cpp

Modified: llvm/trunk/include/llvm/Support/SourceMgr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SourceMgr.h?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/SourceMgr.h (original)
+++ llvm/trunk/include/llvm/Support/SourceMgr.h Sat Jun 20 22:39:35 2009
@@ -24,19 +24,19 @@
   class MemoryBuffer;
   class TGSourceMgr;
   
-class TGLoc {
+class SMLoc {
   const char *Ptr;
 public:
-  TGLoc() : Ptr(0) {}
-  TGLoc(const TGLoc &RHS) : Ptr(RHS.Ptr) {}
+  SMLoc() : Ptr(0) {}
+  SMLoc(const SMLoc &RHS) : Ptr(RHS.Ptr) {}
   
-  bool operator==(const TGLoc &RHS) const { return RHS.Ptr == Ptr; }
-  bool operator!=(const TGLoc &RHS) const { return RHS.Ptr != Ptr; }
+  bool operator==(const SMLoc &RHS) const { return RHS.Ptr == Ptr; }
+  bool operator!=(const SMLoc &RHS) const { return RHS.Ptr != Ptr; }
 
   const char *getPointer() const { return Ptr; }
   
-  static TGLoc getFromPointer(const char *Ptr) {
-    TGLoc L;
+  static SMLoc getFromPointer(const char *Ptr) {
+    SMLoc L;
     L.Ptr = Ptr;
     return L;
   }
@@ -51,7 +51,7 @@
     
     /// IncludeLoc - This is the location of the parent include, or null if at
     /// the top level.
-    TGLoc IncludeLoc;
+    SMLoc IncludeLoc;
   };
   
   /// Buffers - This is all of the buffers that we are reading from.
@@ -73,12 +73,12 @@
     return Buffers[i].Buffer;
   }
   
-  TGLoc getParentIncludeLoc(unsigned i) const {
+  SMLoc getParentIncludeLoc(unsigned i) const {
     assert(i < Buffers.size() && "Invalid Buffer ID!");
     return Buffers[i].IncludeLoc;
   }
   
-  unsigned AddNewSourceBuffer(MemoryBuffer *F, TGLoc IncludeLoc) {
+  unsigned AddNewSourceBuffer(MemoryBuffer *F, SMLoc IncludeLoc) {
     SrcBuffer NB;
     NB.Buffer = F;
     NB.IncludeLoc = IncludeLoc;
@@ -88,19 +88,19 @@
   
   /// FindBufferContainingLoc - Return the ID of the buffer containing the
   /// specified location, returning -1 if not found.
-  int FindBufferContainingLoc(TGLoc Loc) const;
+  int FindBufferContainingLoc(SMLoc Loc) const;
   
   /// FindLineNumber - Find the line number for the specified location in the
   /// specified file.  This is not a fast method.
-  unsigned FindLineNumber(TGLoc Loc, int BufferID = -1) const;
+  unsigned FindLineNumber(SMLoc Loc, int BufferID = -1) const;
   
   
   /// PrintError - Emit an error message about the specified location with the
   /// specified string.
-  void PrintError(TGLoc ErrorLoc, const std::string &Msg) const;
+  void PrintError(SMLoc ErrorLoc, const std::string &Msg) const;
   
 private:
-  void PrintIncludeStack(TGLoc IncludeLoc) const;
+  void PrintIncludeStack(SMLoc IncludeLoc) const;
 };
   
 }  // end llvm namespace

Modified: llvm/trunk/lib/Support/SourceMgr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SourceMgr.cpp?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/lib/Support/SourceMgr.cpp (original)
+++ llvm/trunk/lib/Support/SourceMgr.cpp Sat Jun 20 22:39:35 2009
@@ -27,7 +27,7 @@
 
 /// FindBufferContainingLoc - Return the ID of the buffer containing the
 /// specified location, returning -1 if not found.
-int TGSourceMgr::FindBufferContainingLoc(TGLoc Loc) const {
+int TGSourceMgr::FindBufferContainingLoc(SMLoc Loc) const {
   for (unsigned i = 0, e = Buffers.size(); i != e; ++i)
     if (Loc.getPointer() >= Buffers[i].Buffer->getBufferStart() &&
         // Use <= here so that a pointer to the null at the end of the buffer
@@ -39,7 +39,7 @@
 
 /// FindLineNumber - Find the line number for the specified location in the
 /// specified file.  This is not a fast method.
-unsigned TGSourceMgr::FindLineNumber(TGLoc Loc, int BufferID) const {
+unsigned TGSourceMgr::FindLineNumber(SMLoc Loc, int BufferID) const {
   if (BufferID == -1) BufferID = FindBufferContainingLoc(Loc);
   assert(BufferID != -1 && "Invalid Location!");
   
@@ -51,13 +51,13 @@
   
   const char *Ptr = Buff->getBufferStart();
 
-  for (; TGLoc::getFromPointer(Ptr) != Loc; ++Ptr)
+  for (; SMLoc::getFromPointer(Ptr) != Loc; ++Ptr)
     if (*Ptr == '\n') ++LineNo;
   return LineNo;
 }
 
-void TGSourceMgr::PrintIncludeStack(TGLoc IncludeLoc) const {
-  if (IncludeLoc == TGLoc()) return;  // Top of stack.
+void TGSourceMgr::PrintIncludeStack(SMLoc IncludeLoc) const {
+  if (IncludeLoc == SMLoc()) return;  // Top of stack.
   
   int CurBuf = FindBufferContainingLoc(IncludeLoc);
   assert(CurBuf != -1 && "Invalid or unspecified location!");
@@ -70,7 +70,7 @@
 }
 
 
-void TGSourceMgr::PrintError(TGLoc ErrorLoc, const std::string &Msg) const {
+void TGSourceMgr::PrintError(SMLoc ErrorLoc, const std::string &Msg) const {
   raw_ostream &OS = errs();
   
   // First thing to do: find the current buffer containing the specified

Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Sat Jun 20 22:39:35 2009
@@ -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

Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Sat Jun 20 22:39:35 2009
@@ -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();

Modified: llvm/trunk/utils/TableGen/TGLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.h (original)
+++ llvm/trunk/utils/TableGen/TGLexer.h Sat Jun 20 22:39:35 2009
@@ -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.

Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Sat Jun 20 22:39:35 2009
@@ -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) {

Modified: llvm/trunk/utils/TableGen/TGParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.h?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.h (original)
+++ llvm/trunk/utils/TableGen/TGParser.h Sat Jun 20 22:39:35 2009
@@ -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);

Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=73843&r1=73842&r2=73843&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Sat Jun 20 22:39:35 2009
@@ -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);
 





More information about the llvm-commits mailing list