[cfe-commits] r62376 - in /cfe/trunk: include/clang/Basic/SourceLocation.h lib/Driver/HTMLDiagnostics.cpp lib/Driver/PlistDiagnostics.cpp lib/Driver/TextDiagnosticBuffer.cpp lib/Driver/TextDiagnosticPrinter.cpp

Chris Lattner sabre at nondot.org
Fri Jan 16 15:06:35 PST 2009


Author: lattner
Date: Fri Jan 16 17:06:35 2009
New Revision: 62376

URL: http://llvm.org/viewvc/llvm-project?rev=62376&view=rev
Log:
eliminate FullSourceLoc::getLocation() now that FullSourceLoc
*is* the location.  This eliminates some weird X.getLocation().getLocation()'s.

Modified:
    cfe/trunk/include/clang/Basic/SourceLocation.h
    cfe/trunk/lib/Driver/HTMLDiagnostics.cpp
    cfe/trunk/lib/Driver/PlistDiagnostics.cpp
    cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp
    cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp

Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=62376&r1=62375&r2=62376&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Fri Jan 16 17:06:35 2009
@@ -218,8 +218,6 @@
   explicit FullSourceLoc(SourceLocation Loc, SourceManager &SM) 
     : SourceLocation(Loc), SrcMgr(&SM) {}
     
-  SourceLocation getLocation() const { return *this; }
-  
   SourceManager& getManager() {
     assert (SrcMgr && "SourceManager is NULL.");
     return *SrcMgr;

Modified: cfe/trunk/lib/Driver/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HTMLDiagnostics.cpp?rev=62376&r1=62375&r2=62376&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/Driver/HTMLDiagnostics.cpp Fri Jan 16 17:06:35 2009
@@ -133,9 +133,9 @@
     FullSourceLoc L = I->getLocation().getInstantiationLoc();
     
     if (!FileIDInitialized) {
-      FileID = SMgr.getCanonicalFileID(L.getLocation());
+      FileID = SMgr.getCanonicalFileID(L);
       FileIDInitialized = true;
-    } else if (SMgr.getCanonicalFileID(L.getLocation()) != FileID)
+    } else if (SMgr.getCanonicalFileID(L) != FileID)
       return; // FIXME: Emit a warning?
     
     // Check the source ranges.
@@ -339,11 +339,11 @@
   
   SourceManager& SM = R.getSourceMgr();
   FullSourceLoc LPos = Pos.getInstantiationLoc();
-  unsigned FileID = SM.getCanonicalFileID(LPos.getLocation());
+  unsigned FileID = SM.getCanonicalFileID(LPos);
 
   assert (&LPos.getManager() == &SM && "SourceManagers are different!");
   
-  if (SM.getCanonicalFileID(LPos.getLocation()) != BugFileID)
+  if (SM.getCanonicalFileID(LPos) != BugFileID)
     return;
   
   const llvm::MemoryBuffer *Buf = SM.getBuffer(FileID);
@@ -351,7 +351,6 @@
   
   // Compute the column number.  Rewind from the current position to the start
   // of the line.
-  
   unsigned ColNo = LPos.getColumnNumber();
   const char *TokInstantiationPtr = LPos.getCharacterData();
   const char *LineStart = TokInstantiationPtr-ColNo;

Modified: cfe/trunk/lib/Driver/PlistDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/PlistDiagnostics.cpp?rev=62376&r1=62375&r2=62376&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/Driver/PlistDiagnostics.cpp Fri Jan 16 17:06:35 2009
@@ -109,7 +109,7 @@
   FullSourceLoc L = P.getLocation();
 
   Indent(o, indent) << "<key>location</key>\n";
-  EmitLocation(o, SM, L.getLocation(), FM, indent);
+  EmitLocation(o, SM, L, FM, indent);
 
   // Output the ranges (if any).
   PathDiagnosticPiece::range_iterator RI = P.ranges_begin(),
@@ -174,7 +174,7 @@
   llvm::SmallVector<unsigned, 10> Fids;
   
   for (PathDiagnostic::const_iterator I=D->begin(), E=D->end(); I != E; ++I) {
-    AddFID(FM, Fids, SM, I->getLocation().getLocation());
+    AddFID(FM, Fids, SM, I->getLocation());
 
     for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(),
                                              RE=I->ranges_end(); RI!=RE; ++RI) {      

Modified: cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp?rev=62376&r1=62375&r2=62376&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticBuffer.cpp Fri Jan 16 17:06:35 2009
@@ -26,13 +26,13 @@
   switch (Level) {
   default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
   case Diagnostic::Note:
-    Notes.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
+    Notes.push_back(std::make_pair(Info.getLocation(), Str));
     break;
   case Diagnostic::Warning:
-    Warnings.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
+    Warnings.push_back(std::make_pair(Info.getLocation(), Str));
     break;
   case Diagnostic::Error:
-    Errors.push_back(std::make_pair(Info.getLocation().getLocation(), Str));
+    Errors.push_back(std::make_pair(Info.getLocation(), Str));
     break;
   }
 }

Modified: cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp?rev=62376&r1=62375&r2=62376&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Fri Jan 16 17:06:35 2009
@@ -105,7 +105,7 @@
   if (Pos.isValid()) {
     FullSourceLoc LPos = Pos.getInstantiationLoc();
     LineNo = LPos.getLineNumber();
-    FileID = LPos.getLocation().getFileID();
+    FileID = LPos.getFileID();
     
     // First, if this diagnostic is not in the main file, print out the
     // "included from" lines.





More information about the cfe-commits mailing list