[cfe-commits] r63097 - in /cfe/trunk: Driver/CacheTokens.cpp Driver/RewriteMacros.cpp include/clang/Basic/SourceManager.h lib/Rewrite/HTMLRewrite.cpp

Chris Lattner sabre at nondot.org
Mon Jan 26 22:27:13 PST 2009


Author: lattner
Date: Tue Jan 27 00:27:13 2009
New Revision: 63097

URL: http://llvm.org/viewvc/llvm-project?rev=63097&view=rev
Log:
rename getFullFilePos -> getFileOffset.

Modified:
    cfe/trunk/Driver/CacheTokens.cpp
    cfe/trunk/Driver/RewriteMacros.cpp
    cfe/trunk/include/clang/Basic/SourceManager.h
    cfe/trunk/lib/Rewrite/HTMLRewrite.cpp

Modified: cfe/trunk/Driver/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/CacheTokens.cpp?rev=63097&r1=63096&r2=63097&view=diff

==============================================================================
--- cfe/trunk/Driver/CacheTokens.cpp (original)
+++ cfe/trunk/Driver/CacheTokens.cpp Tue Jan 27 00:27:13 2009
@@ -159,7 +159,7 @@
   else
     Emit32(ResolveID(T.getIdentifierInfo()));
     
-  Emit32(PP.getSourceManager().getFullFilePos(T.getLocation()));
+  Emit32(PP.getSourceManager().getFileOffset(T.getLocation()));
 }
 
 namespace {

Modified: cfe/trunk/Driver/RewriteMacros.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteMacros.cpp?rev=63097&r1=63096&r2=63097&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteMacros.cpp (original)
+++ cfe/trunk/Driver/RewriteMacros.cpp Tue Jan 27 00:27:13 2009
@@ -130,13 +130,13 @@
         const IdentifierInfo *II = RawTokens[CurRawTok].getIdentifierInfo();
         if (!strcmp(II->getName(), "warning")) {
           // Comment out #warning.
-          RB.InsertTextAfter(SM.getFullFilePos(RawTok.getLocation()), "//", 2);
+          RB.InsertTextAfter(SM.getFileOffset(RawTok.getLocation()), "//", 2);
         } else if (!strcmp(II->getName(), "pragma") &&
                    RawTokens[CurRawTok+1].is(tok::identifier) &&
                   !strcmp(RawTokens[CurRawTok+1].getIdentifierInfo()->getName(),
                           "mark")){
           // Comment out #pragma mark.
-          RB.InsertTextAfter(SM.getFullFilePos(RawTok.getLocation()), "//", 2);
+          RB.InsertTextAfter(SM.getFileOffset(RawTok.getLocation()), "//", 2);
         }
       }
       
@@ -150,8 +150,8 @@
     
     // Okay, both tokens are from the same file.  Get their offsets from the
     // start of the file.
-    unsigned PPOffs = SM.getFullFilePos(PPLoc);
-    unsigned RawOffs = SM.getFullFilePos(RawTok.getLocation());
+    unsigned PPOffs = SM.getFileOffset(PPLoc);
+    unsigned RawOffs = SM.getFileOffset(RawTok.getLocation());
 
     // If the offsets are the same and the token kind is the same, ignore them.
     if (PPOffs == RawOffs && isSameToken(RawTok, PPTok)) {
@@ -173,7 +173,7 @@
         EndPos = RawOffs+RawTok.getLength();
 
         RawTok = GetNextRawTok(RawTokens, CurRawTok, true);
-        RawOffs = SM.getFullFilePos(RawTok.getLocation());
+        RawOffs = SM.getFileOffset(RawTok.getLocation());
         
         if (RawTok.is(tok::comment)) {
           // Skip past the comment.
@@ -197,7 +197,7 @@
       Expansion += ' ' + PP.getSpelling(PPTok);
       PP.Lex(PPTok);
       PPLoc = SM.getInstantiationLoc(PPTok.getLocation());
-      PPOffs = SM.getFullFilePos(PPLoc);
+      PPOffs = SM.getFileOffset(PPLoc);
     }
     Expansion += ' ';
     RB.InsertTextBefore(InsertPos, &Expansion[0], Expansion.size());

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

==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Tue Jan 27 00:27:13 2009
@@ -468,11 +468,10 @@
     return getDecomposedSpellingLocSlowCase(E, Offset);
   }    
   
-  /// getFullFilePos - This (efficient) method returns the offset from the start
-  /// of the file that the specified spelling SourceLocation represents.  This
-  /// returns the location of the actual character data, not the instantiation
-  /// position.
-  unsigned getFullFilePos(SourceLocation SpellingLoc) const {
+  /// getFileOffset - This method returns the offset from the start
+  /// of the file that the specified SourceLocation represents. This is not very
+  /// meaningful for a macro ID.
+  unsigned getFileOffset(SourceLocation SpellingLoc) const {
     return getDecomposedLoc(SpellingLoc).second;
   }
   

Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=63097&r1=63096&r2=63097&view=diff

==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Tue Jan 27 00:27:13 2009
@@ -36,8 +36,8 @@
   FileID FID = SM.getFileID(B);
   assert(SM.getFileID(E) == FID && "B/E not in the same file!");
 
-  unsigned BOffset = SM.getFullFilePos(B);
-  unsigned EOffset = SM.getFullFilePos(E);
+  unsigned BOffset = SM.getFileOffset(B);
+  unsigned EOffset = SM.getFileOffset(E);
   
   // Include the whole end token in the range.
   EOffset += Lexer::MeasureTokenLength(E, R.getSourceMgr());
@@ -359,7 +359,7 @@
   while (Tok.isNot(tok::eof)) {
     // Since we are lexing unexpanded tokens, all tokens are from the main
     // FileID.
-    unsigned TokOffs = SourceMgr.getFullFilePos(Tok.getLocation());
+    unsigned TokOffs = SourceMgr.getFileOffset(Tok.getLocation());
     unsigned TokLen = Tok.getLength();
     switch (Tok.getKind()) {
     default: break;
@@ -397,7 +397,7 @@
       unsigned TokEnd = TokOffs+TokLen;
       L.LexFromRawLexer(Tok);
       while (!Tok.isAtStartOfLine() && Tok.isNot(tok::eof)) {
-        TokEnd = SourceMgr.getFullFilePos(Tok.getLocation())+Tok.getLength();
+        TokEnd = SourceMgr.getFileOffset(Tok.getLocation())+Tok.getLength();
         L.LexFromRawLexer(Tok);
       }
       





More information about the cfe-commits mailing list