]> granicus.if.org Git - clang/commitdiff
more SourceLocation lexicon change: instead of referring to the
authorChris Lattner <sabre@nondot.org>
Fri, 16 Jan 2009 07:36:28 +0000 (07:36 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Jan 2009 07:36:28 +0000 (07:36 +0000)
"logical" location, refer to the "instantiation" location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8

23 files changed:
Driver/DiagChecker.cpp
Driver/PrintPreprocessedOutput.cpp
Driver/RewriteBlocks.cpp
Driver/RewriteMacros.cpp
Driver/RewriteObjC.cpp
include/clang/Basic/SourceLocation.h
include/clang/Basic/SourceManager.h
lib/Analysis/BugReporter.cpp
lib/Analysis/CFRefCount.cpp
lib/Analysis/GRExprEngineInternalChecks.cpp
lib/Basic/SourceLocation.cpp
lib/Basic/SourceManager.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Driver/HTMLDiagnostics.cpp
lib/Driver/PlistDiagnostics.cpp
lib/Driver/TextDiagnosticPrinter.cpp
lib/Lex/Lexer.cpp
lib/Lex/PPMacroExpansion.cpp
lib/Lex/Preprocessor.cpp
lib/Parse/ParseStmt.cpp
lib/Rewrite/HTMLRewrite.cpp

index 6f4cd7c509d99ae6e8dbb6d61e66941bfa7fe446..8fa827ab198cfd6dadf3d02827e32177d1f3451c 100644 (file)
@@ -167,7 +167,7 @@ static bool PrintProblem(SourceManager &SourceMgr,
 
   for (const_diag_iterator I = diag_begin, E = diag_end; I != E; ++I)
     fprintf(stderr, "  Line %d: %s\n",
-            SourceMgr.getLogicalLineNumber(I->first),
+            SourceMgr.getInstantiationLineNumber(I->first),
             I->second.c_str());
 
   return true;
@@ -185,12 +185,12 @@ static bool CompareDiagLists(SourceManager &SourceMgr,
   DiagList DiffList;
 
   for (const_diag_iterator I = d1_begin, E = d1_end; I != E; ++I) {
-    unsigned LineNo1 = SourceMgr.getLogicalLineNumber(I->first);
+    unsigned LineNo1 = SourceMgr.getInstantiationLineNumber(I->first);
     const std::string &Diag1 = I->second;
     bool Found = false;
 
     for (const_diag_iterator II = d2_begin, IE = d2_end; II != IE; ++II) {
-      unsigned LineNo2 = SourceMgr.getLogicalLineNumber(II->first);
+      unsigned LineNo2 = SourceMgr.getInstantiationLineNumber(II->first);
       if (LineNo1 != LineNo2) continue;
 
       const std::string &Diag2 = II->second;
index 8c2ea707d82be17860c431e53dc07de32dbdb328..f5bde7c7c6dc9f283e5551c4beaa3665809cb9c3 100644 (file)
@@ -103,7 +103,7 @@ void PrintPPOutputPPCallbacks::WriteLineInfo(unsigned LineNo,
 /// #line directive.  This returns false if already at the specified line, true
 /// if some newlines were emitted.
 bool PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) {
-  unsigned LineNo = PP.getSourceManager().getLogicalLineNumber(Loc);
+  unsigned LineNo = PP.getSourceManager().getInstantiationLineNumber(Loc);
 
   if (DisableLineMarkers) {
     if (LineNo == CurLine) return false;
@@ -124,7 +124,7 @@ bool PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) {
     if (LineNo-CurLine == 1)
       OS << '\n';
     else if (LineNo == CurLine)
-      return false;    // Spelling line moved, but logical line didn't.
+      return false;    // Spelling line moved, but instantiation line didn't.
     else {
       const char *NewLines = "\n\n\n\n\n\n\n\n";
       OS.write(NewLines, LineNo-CurLine);
@@ -157,7 +157,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc,
     // strange behavior.
   }
   
-  Loc = SourceMgr.getLogicalLoc(Loc);
+  Loc = SourceMgr.getInstantiationLoc(Loc);
   CurLine = SourceMgr.getLineNumber(Loc);
 
   if (DisableLineMarkers) return;
@@ -200,7 +200,7 @@ void PrintPPOutputPPCallbacks::Ident(SourceLocation Loc, const std::string &S) {
 /// is called for the first token on each new line.  If this really is the start
 /// of a new logical line, handle it and return true, otherwise return false.
 /// This may not be the start of a logical line because the "start of line"
-/// marker is set for spelling lines, not logical ones.
+/// marker is set for spelling lines, not instantiation ones.
 bool PrintPPOutputPPCallbacks::HandleFirstTokOnLine(Token &Tok) {
   // Figure out what line we went to and insert the appropriate number of
   // newline characters.
@@ -210,7 +210,7 @@ bool PrintPPOutputPPCallbacks::HandleFirstTokOnLine(Token &Tok) {
   // Print out space characters so that the first token on a line is
   // indented for easy reading.
   const SourceManager &SourceMgr = PP.getSourceManager();
-  unsigned ColNo = SourceMgr.getLogicalColumnNumber(Tok.getLocation());
+  unsigned ColNo = SourceMgr.getInstantiationColumnNumber(Tok.getLocation());
   
   // This hack prevents stuff like:
   // #define HASH #
index 1e7a6af91d0ac45f92f4749261e1956f1e7ccacf..e4e470a4471de3ea0926fff168d82c9aa4f8cb01 100644 (file)
@@ -341,7 +341,7 @@ void RewriteBlocks::HandleTopLevelDecl(Decl *D) {
   // #included file.  If the former, rewrite it now.  If the later, check to see
   // if we rewrote the #include/#import.
   SourceLocation Loc = D->getLocation();
-  Loc = SM->getLogicalLoc(Loc);
+  Loc = SM->getInstantiationLoc(Loc);
   
   // If this is for a builtin, ignore it.
   if (Loc.isInvalid()) return;
index d10bf55853f2f851f3bcfbf46c5d8fffa6fec2c1..fb423c641377c45b24eab58ecc202f8f284b5258 100644 (file)
@@ -113,7 +113,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP,const std::string &InFileName,
   // that aren't in the preprocessed view, we have macros that expand to no
   // tokens, or macro arguments etc.
   while (RawTok.isNot(tok::eof) || PPTok.isNot(tok::eof)) {
-    SourceLocation PPLoc = SM.getLogicalLoc(PPTok.getLocation());
+    SourceLocation PPLoc = SM.getInstantiationLoc(PPTok.getLocation());
 
     // If PPTok is from a different source file, ignore it.
     if (!SM.isFromMainFile(PPLoc)) {
@@ -198,7 +198,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP,const std::string &InFileName,
     while (PPOffs < RawOffs) {
       Expansion += ' ' + PP.getSpelling(PPTok);
       PP.Lex(PPTok);
-      PPLoc = SM.getLogicalLoc(PPTok.getLocation());
+      PPLoc = SM.getInstantiationLoc(PPTok.getLocation());
       PPOffs = SM.getFullFilePos(PPLoc);
     }
     Expansion += ' ';
index ec0018a11cbb91e971ecc432f57c6fe9cc8a3317..cee66f73b174db47d79c5426196314c410ec97b0 100644 (file)
@@ -557,7 +557,7 @@ void RewriteObjC::HandleTopLevelDecl(Decl *D) {
   // #included file.  If the former, rewrite it now.  If the later, check to see
   // if we rewrote the #include/#import.
   SourceLocation Loc = D->getLocation();
-  Loc = SM->getLogicalLoc(Loc);
+  Loc = SM->getInstantiationLoc(Loc);
   
   // If this is for a builtin, ignore it.
   if (Loc.isInvalid()) return;
index 97080d7442ace1c19723a18678ecd35b1cef70f3..a77eadd27190678c16ff3882773ddcfe17e140d6 100644 (file)
@@ -236,15 +236,15 @@ public:
     return *SrcMgr;
   }
   
-  FullSourceLoc getLogicalLoc() const;
+  FullSourceLoc getInstantiationLoc() const;
   FullSourceLoc getSpellingLoc() const;
   FullSourceLoc getIncludeLoc() const;
 
   unsigned getLineNumber() const;
   unsigned getColumnNumber() const;
   
-  unsigned getLogicalLineNumber() const;
-  unsigned getLogicalColumnNumber() const;
+  unsigned getInstantiationLineNumber() const;
+  unsigned getInstantiationColumnNumber() const;
 
   unsigned getSpellingLineNumber() const;
   unsigned getSpellingColumnNumber() const;
index f7e160deeb5e2fbbc70cbbb2be28520c48c4268b..1eac4f15ded09a1964b39f88b2359a24f9c0ba00 100644 (file)
@@ -121,9 +121,9 @@ namespace SrcMgr {
   /// is a byte offset from the start of this.
   ///
   /// FileID's are used to compute the location of a character in memory as well
-  /// as the logical source location, which can be differ from the spelling
-  /// location.  It is different when #line's are active or when macros have
-  /// been expanded.
+  /// as the instantiation source location, which can be differ from the
+  /// spelling location.  It is different when #line's are active or when macros
+  /// have been expanded.
   ///
   /// Each FileID has include stack information, indicating where it came from.
   /// For the primary translation unit, it comes from SourceLocation() aka 0.
@@ -228,13 +228,12 @@ namespace clang {
 /// files and assigns unique FileID's for each unique #include chain.
 ///
 /// The SourceManager can be queried for information about SourceLocation
-/// objects, turning them into either spelling or logical locations.  Spelling
-/// locations represent where the bytes corresponding to a token came from and
-/// logical locations represent where the location is in the user's view.  In
-/// the case of a macro expansion, for example, the spelling location indicates
-/// where the expanded token came from and the logical location specifies where
-/// it was expanded.  Logical locations are also influenced by #line directives,
-/// etc.
+/// objects, turning them into either spelling or instantiation locations.
+/// Spelling locations represent where the bytes corresponding to a token came
+/// from and instantiation locations represent where the location is in the
+/// user's view.  In the case of a macro expansion, for example, the spelling
+/// location indicates where the expanded token came from and the instantiation
+/// location specifies where it was expanded.
 class SourceManager {
   /// FileInfos - Memoized information about all of the files tracked by this
   /// SourceManager.  This set allows us to merge ContentCache entries based
@@ -338,7 +337,7 @@ public:
   /// SourceLocation.  If this is a macro expansion, this transparently figures
   /// out which file includes the file being expanded into.
   SourceLocation getIncludeLoc(SourceLocation ID) const {
-    return getFIDInfo(getLogicalLoc(ID).getFileID())->getIncludeLoc();
+    return getFIDInfo(getInstantiationLoc(ID).getFileID())->getIncludeLoc();
   }
   
   /// getCharacterData - Return a pointer to the start of the specified location
@@ -348,15 +347,15 @@ public:
   /// getColumnNumber - Return the column # for the specified file position.
   /// This is significantly cheaper to compute than the line number.  This
   /// returns zero if the column number isn't known.  This may only be called on
-  /// a file sloc, so you must choose a spelling or logical location before
-  /// calling this method.
+  /// a file sloc, so you must choose a spelling or instantiation location
+  /// before calling this method.
   unsigned getColumnNumber(SourceLocation Loc) const;
   
   unsigned getSpellingColumnNumber(SourceLocation Loc) const {
     return getColumnNumber(getSpellingLoc(Loc));
   }
-  unsigned getLogicalColumnNumber(SourceLocation Loc) const {
-    return getColumnNumber(getLogicalLoc(Loc));
+  unsigned getInstantiationColumnNumber(SourceLocation Loc) const {
+    return getColumnNumber(getInstantiationLoc(Loc));
   }
   
   
@@ -366,8 +365,8 @@ public:
   /// about to emit a diagnostic.
   unsigned getLineNumber(SourceLocation Loc) const;
 
-  unsigned getLogicalLineNumber(SourceLocation Loc) const {
-    return getLineNumber(getLogicalLoc(Loc));
+  unsigned getInstantiationLineNumber(SourceLocation Loc) const {
+    return getLineNumber(getInstantiationLoc(Loc));
   }
   unsigned getSpellingLineNumber(SourceLocation Loc) const {
     return getLineNumber(getSpellingLoc(Loc));
@@ -378,9 +377,9 @@ public:
   /// etc.
   const char *getSourceName(SourceLocation Loc) const;
 
-  /// Given a SourceLocation object, return the logical location referenced by
-  /// the ID.  This logical location is subject to #line directives, etc.
-  SourceLocation getLogicalLoc(SourceLocation Loc) const {
+  /// Given a SourceLocation object, return the instantiation location
+  /// referenced by the ID.
+  SourceLocation getInstantiationLoc(SourceLocation Loc) const {
     // File locations work.
     if (Loc.isFileID()) return Loc;
     
@@ -450,7 +449,7 @@ public:
     
   /// 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 logical file
+  /// returns the location of the actual character data, not the instantiation
   /// position.
   unsigned getFullFilePos(SourceLocation SpellingLoc) const {
     return getDecomposedFileLoc(SpellingLoc).second;
index e6840c3ad259a182446e47184a97a42a71e932b1..adb3325f53dcc781ceea1729e97bf8bf098e8cbf 100644 (file)
@@ -94,7 +94,7 @@ static void ExecutionContinues(std::ostringstream& os, SourceManager& SMgr,
     os << ' ';
   
   os << "Execution continues on line "
-     << SMgr.getLogicalLineNumber(S->getLocStart()) << '.';
+     << SMgr.getInstantiationLineNumber(S->getLocStart()) << '.';
 }
 
 
@@ -534,7 +534,7 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
           std::ostringstream os;
           
           os << "Control jumps to line "
-             << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
+             << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
           
           PD.push_front(new PathDiagnosticPiece(L, os.str()));
           break;
@@ -548,23 +548,17 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
 
           if (Stmt* S = Dst->getLabel())
             switch (S->getStmtClass()) {
-                
-            default: {
+            default:
               os << "No cases match in the switch statement. "
                     "Control jumps to line "
-                 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
-                break;
-            }
-                
-            case Stmt::DefaultStmtClass: {                            
+                 << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
+              break;
+            case Stmt::DefaultStmtClass:
               os << "Control jumps to the 'default' case at line "
-                 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
-              
+                 << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
               break;
-            }
               
             case Stmt::CaseStmtClass: {
-              
               os << "Control jumps to 'case ";
               
               CaseStmt* Case = cast<CaseStmt>(S);              
@@ -602,10 +596,9 @@ void GRBugReporter::GeneratePathDiagnostic(PathDiagnostic& PD,
               }              
               
               os << ":'  at line " 
-                 << SMgr.getLogicalLineNumber(S->getLocStart()) << ".\n";
+                 << SMgr.getInstantiationLineNumber(S->getLocStart()) << ".\n";
               
               break;
-              
             }
           }
           else {
index d2d7ab8d041799df9eaa68e8cfe2b700278890c7..af96c0672b607f482880219142faf6ee37dedfe0 100644 (file)
@@ -2541,7 +2541,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
   Stmt* FirstStmt = cast<PostStmt>(AllocNode->getLocation()).getStmt();
 
   SourceManager& SMgr = BR.getContext().getSourceManager();
-  unsigned AllocLine = SMgr.getLogicalLineNumber(FirstStmt->getLocStart());
+  unsigned AllocLine =SMgr.getInstantiationLineNumber(FirstStmt->getLocStart());
 
   // Get the leak site.  We may have multiple ExplodedNodes (one with the
   // leak) that occur on the same line number; if the node with the leak
@@ -2559,7 +2559,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
   
   Stmt* S = getStmt(BR);  // This is the statement where the leak occured.
   assert (S);
-  unsigned EndLine = SMgr.getLogicalLineNumber(S->getLocStart());
+  unsigned EndLine = SMgr.getInstantiationLineNumber(S->getLocStart());
 
   // Look in the *trimmed* graph at the immediate predecessor of EndN.  Does
   // it occur on the same line?
@@ -2574,7 +2574,7 @@ PathDiagnosticPiece* CFRefReport::getEndPath(BugReporter& br,
     Stmt* SPred = PredPS->getStmt();
     
     // Predecessor at same line?
-    if (SMgr.getLogicalLineNumber(SPred->getLocStart()) != EndLine) {
+    if (SMgr.getInstantiationLineNumber(SPred->getLocStart()) != EndLine) {
       Hint = PathDiagnosticPiece::Below;
       S = SPred;
     }
index d32318ca7d91d4605ec93f2f4bed9b77e5cd62f3..e7a644ce19e219b11e87f941dbb093e6a3e52838 100644 (file)
@@ -212,7 +212,8 @@ public:
         const CompoundLiteralExpr* CL = CR->getLiteralExpr();
         os << "Address of stack memory associated with a compound literal "
               "declared on line "
-            << BR.getSourceManager().getLogicalLineNumber(CL->getLocStart())
+            << BR.getSourceManager()
+                    .getInstantiationLineNumber(CL->getLocStart())
             << " returned.";
         
         R = CL->getSourceRange();
@@ -223,7 +224,7 @@ public:
         R = ARE->getSourceRange();
         
         os << "Address of stack memory allocated by call to alloca() on line "
-           << BR.getSourceManager().getLogicalLineNumber(L)
+           << BR.getSourceManager().getInstantiationLineNumber(L)
            << " returned.";
       }      
       else {        
index bb8cac2f9f06612bb7046f8a89fe22972f79def7..a34293177ba8e90f91eb2427ce07f7c779a41a91 100644 (file)
@@ -37,9 +37,9 @@ SourceRange SourceRange::ReadVal(llvm::Deserializer& D) {
   return SourceRange(A,B);
 }
 
-FullSourceLoc FullSourceLoc::getLogicalLoc() const {
+FullSourceLoc FullSourceLoc::getInstantiationLoc() const {
   assert (isValid());
-  return FullSourceLoc(SrcMgr->getLogicalLoc(Loc), *SrcMgr);
+  return FullSourceLoc(SrcMgr->getInstantiationLoc(Loc), *SrcMgr);
 }
 
 FullSourceLoc FullSourceLoc::getSpellingLoc() const {
@@ -63,14 +63,14 @@ unsigned FullSourceLoc::getColumnNumber() const {
 }
 
 
-unsigned FullSourceLoc::getLogicalLineNumber() const {
+unsigned FullSourceLoc::getInstantiationLineNumber() const {
   assert (isValid());
-  return SrcMgr->getLogicalLineNumber(Loc);
+  return SrcMgr->getInstantiationLineNumber(Loc);
 }
 
-unsigned FullSourceLoc::getLogicalColumnNumber() const {
+unsigned FullSourceLoc::getInstantiationColumnNumber() const {
   assert (isValid());
-  return SrcMgr->getLogicalColumnNumber(Loc);
+  return SrcMgr->getInstantiationColumnNumber(Loc);
 }
 
 unsigned FullSourceLoc::getSpellingLineNumber() const {
@@ -120,15 +120,15 @@ void FullSourceLoc::dump() const {
   }
   
   if (isFileID()) {
-    // The logical and spelling pos is identical for file locs.
+    // The instantiation and spelling pos is identical for file locs.
     fprintf(stderr, "File Loc from '%s': %d: %d\n",
-            getSourceName(), getLogicalLineNumber(),
-            getLogicalColumnNumber());
+            getSourceName(), getInstantiationLineNumber(),
+            getInstantiationColumnNumber());
   } else {
     fprintf(stderr, "Macro Loc (\n  Spelling: ");
     getSpellingLoc().dump();
-    fprintf(stderr, "  Logical: ");
-    getLogicalLoc().dump();
+    fprintf(stderr, "  Instantiation: ");
+    getInstantiationLoc().dump();
     fprintf(stderr, ")\n");
   }
 }
index 55e8c4aee78f179555acb143fe9bd919625611c1..fa0a9bb565adf34199406698dc621ba6581de47a 100644 (file)
@@ -155,8 +155,8 @@ SourceLocation SourceManager::getInstantiationLoc(SourceLocation SpellingLoc,
   // where the characters are actually located.
   SpellingLoc = getSpellingLoc(SpellingLoc);
   
-  // Resolve InstantLoc down to a real logical location.
-  InstantLoc = getLogicalLoc(InstantLoc);
+  // Resolve InstantLoc down to a real instantiation location.
+  InstantLoc = getInstantiationLoc(InstantLoc);
   
   
   // If the last macro id is close to the currently requested location, try to
index 6176b868ea8a06eaf5991c4106926d4f3f6a8664..9cbefa3d0698a367c441af47a3a340b928c65840 100644 (file)
@@ -41,7 +41,7 @@ CGDebugInfo::~CGDebugInfo() {
 
 void CGDebugInfo::setLocation(SourceLocation Loc) {
   if (Loc.isValid())
-    CurLoc = M->getContext().getSourceManager().getLogicalLoc(Loc);
+    CurLoc = M->getContext().getSourceManager().getInstantiationLoc(Loc);
 }
 
 /// getOrCreateCompileUnit - Get the compile unit from the cache or create a new
@@ -157,7 +157,7 @@ llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty,
   llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
 
   SourceManager &SM = M->getContext().getSourceManager();
-  uint64_t Line = SM.getLogicalLineNumber(DefLoc);
+  uint64_t Line = SM.getInstantiationLineNumber(DefLoc);
 
   return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_typedef, Unit,
                                         TyName, DefUnit, Line, 0, 0, 0, 0, Src);
@@ -209,7 +209,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
   std::string Name = Decl->getNameAsString();
 
   llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(Decl->getLocation());
-  uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
+  unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
   
   
   // Records and classes and unions can all be recursive.  To handle them, we
@@ -247,11 +247,11 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
     // Get the location for the field.
     SourceLocation FieldDefLoc = Field->getLocation();
     llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
-    uint64_t FieldLine = SM.getLogicalLineNumber(FieldDefLoc);
+    unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc);
     
     // Bit size, align and offset of the type.
     uint64_t FieldSize = M->getContext().getTypeSize(Ty);
-    uint64_t FieldAlign = M->getContext().getTypeAlign(Ty);
+    unsigned FieldAlign = M->getContext().getTypeAlign(Ty);
     uint64_t FieldOffset = RL.getFieldOffset(FieldNo);    
     
     // Create a DW_TAG_member node to remember the offset of this field in the
@@ -305,11 +305,11 @@ llvm::DIType CGDebugInfo::CreateType(const EnumType *Ty,
   SourceLocation DefLoc = Decl->getLocation();
   llvm::DICompileUnit DefUnit = getOrCreateCompileUnit(DefLoc);
   SourceManager &SM = M->getContext().getSourceManager();
-  uint64_t Line = SM.getLogicalLineNumber(DefLoc);
+  unsigned Line = SM.getInstantiationLineNumber(DefLoc);
   
   // Size and align of the type.
   uint64_t Size = M->getContext().getTypeSize(Ty);
-  uint64_t Align = M->getContext().getTypeAlign(Ty);
+  unsigned Align = M->getContext().getTypeAlign(Ty);
   
   return DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
                                           Unit, EnumName, DefUnit, Line,
@@ -428,7 +428,7 @@ void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
   // FIXME: Why is this using CurLoc???
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
   SourceManager &SM = M->getContext().getSourceManager();
-  uint64_t LineNo = SM.getLogicalLineNumber(CurLoc);
+  unsigned LineNo = SM.getInstantiationLineNumber(CurLoc);
   
   llvm::DISubprogram SP =
     DebugFactory.CreateSubprogram(Unit, Name, Name, "", Unit, LineNo,
@@ -457,8 +457,8 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
 
   // Get the appropriate compile unit.
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
-  DebugFactory.InsertStopPoint(Unit, SM.getLogicalLineNumber(CurLoc),
-                               SM.getLogicalColumnNumber(CurLoc),
+  DebugFactory.InsertStopPoint(Unit, SM.getInstantiationLineNumber(CurLoc),
+                               SM.getInstantiationColumnNumber(CurLoc),
                                Builder.GetInsertBlock()); 
 }
 
@@ -492,7 +492,7 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
 
   // Get location information.
   SourceManager &SM = M->getContext().getSourceManager();
-  uint64_t Line = SM.getLogicalLineNumber(Decl->getLocation());
+  unsigned Line = SM.getInstantiationLineNumber(Decl->getLocation());
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
   
   // Create the descriptor for the variable.
@@ -525,7 +525,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
   // Create global variable debug descriptor.
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
   SourceManager &SM = M->getContext().getSourceManager();
-  uint64_t LineNo = SM.getLogicalLineNumber(Decl->getLocation());
+  unsigned LineNo = SM.getInstantiationLineNumber(Decl->getLocation());
 
   std::string Name = Decl->getNameAsString();
 
index db6aae6dfd73bbb34e211ec3172f6e6e42c00bf7..1acebaed4b936ff36b9de7a752f0205b05512b89 100644 (file)
@@ -125,7 +125,8 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
   if (const AnnotateAttr *AA = D.getAttr<AnnotateAttr>()) {
     SourceManager &SM = CGM.getContext().getSourceManager();
     llvm::Constant *Ann =
-      CGM.EmitAnnotateAttr(GV, AA, SM.getLogicalLineNumber(D.getLocation()));
+      CGM.EmitAnnotateAttr(GV, AA, 
+                           SM.getInstantiationLineNumber(D.getLocation()));
     CGM.AddAnnotation(Ann);
   }
 
index 39611a08deb7f59cb3976da2aec1b00abbe0f99a..7856b076d2dc48184501ea20d03984b9c10134a0 100644 (file)
@@ -591,7 +591,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
   if (const AnnotateAttr *AA = D->getAttr<AnnotateAttr>()) {
     SourceManager &SM = Context.getSourceManager();
     AddAnnotation(EmitAnnotateAttr(GV, AA,
-                                   SM.getLogicalLineNumber(D->getLocation())));
+                              SM.getInstantiationLineNumber(D->getLocation())));
   }
 
   GV->setInitializer(Init);
index 4fac41c1bf89ffe2febf21f72051aed722e59800..c067be98f0e180dcb21f0edf047b0f69da326a78 100644 (file)
@@ -130,9 +130,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
   bool FileIDInitialized = false;
   
   // Verify that the entire path is from the same FileID.
-  for (PathDiagnostic::const_iterator I=D.begin(), E=D.end(); I != E; ++I) {
-    
-    FullSourceLoc L = I->getLocation().getLogicalLoc();
+  for (PathDiagnostic::const_iterator I = D.begin(), E = D.end(); I != E; ++I) {
+    FullSourceLoc L = I->getLocation().getInstantiationLoc();
     
     if (!L.isFileID())
       return; // FIXME: Emit a warning?
@@ -148,7 +147,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
     for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(),
                                              RE=I->ranges_end(); RI!=RE; ++RI) {
       
-      SourceLocation L = SMgr.getLogicalLoc(RI->getBegin());
+      SourceLocation L = SMgr.getInstantiationLoc(RI->getBegin());
 
       if (!L.isFileID())
         return; // FIXME: Emit a warning?      
@@ -156,7 +155,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
       if (SMgr.getCanonicalFileID(L) != FileID)
         return; // FIXME: Emit a warning?
       
-      L = SMgr.getLogicalLoc(RI->getEnd());
+      L = SMgr.getInstantiationLoc(RI->getEnd());
       
       if (!L.isFileID())
         return; // FIXME: Emit a warning?      
@@ -230,9 +229,9 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
        << html::EscapeText(Entry->getName())
        << "</td></tr>\n<tr><td class=\"rowname\">Location:</td><td>"
           "<a href=\"#EndPath\">line "      
-       << (*D.rbegin()).getLocation().getLogicalLineNumber()
+       << (*D.rbegin()).getLocation().getInstantiationLineNumber()
        << ", column "
-       << (*D.rbegin()).getLocation().getLogicalColumnNumber()
+       << (*D.rbegin()).getLocation().getInstantiationColumnNumber()
        << "</a></td></tr>\n"
           "<tr><td class=\"rowname\">Description:</td><td>"
        << D.getDescription() << "</td></tr>\n";
@@ -280,8 +279,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
   {
     std::string s;
     llvm::raw_string_ostream os(s);
-    os << "\n<!-- BUGLINE " << D.back()->getLocation().getLogicalLineNumber()
-       << " -->\n";
+    os << "\n<!-- BUGLINE "
+       << D.back()->getLocation().getInstantiationLineNumber() << " -->\n";
     R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
   }
   
@@ -344,7 +343,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID,
     return;  
   
   SourceManager& SM = R.getSourceMgr();
-  FullSourceLoc LPos = Pos.getLogicalLoc();
+  FullSourceLoc LPos = Pos.getInstantiationLoc();
   unsigned FileID = SM.getCanonicalFileID(LPos.getLocation());
 
   assert (&LPos.getManager() == &SM && "SourceManagers are different!");
@@ -359,11 +358,11 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID,
   // of the line.
   
   unsigned ColNo = LPos.getColumnNumber();
-  const char *TokLogicalPtr = LPos.getCharacterData();
-  const char *LineStart = TokLogicalPtr-ColNo;
+  const char *TokInstantiationPtr = LPos.getCharacterData();
+  const char *LineStart = TokInstantiationPtr-ColNo;
 
   // Only compute LineEnd if we display below a line.
-  const char *LineEnd = TokLogicalPtr;
+  const char *LineEnd = TokInstantiationPtr;
   
   if (P.getDisplayHint() == PathDiagnosticPiece::Below) {
     const char* FileEnd = Buf->getBufferEnd();
@@ -376,7 +375,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, unsigned BugFileID,
   
   unsigned PosNo = 0;
   
-  for (const char* c = LineStart; c != TokLogicalPtr; ++c)
+  for (const char* c = LineStart; c != TokInstantiationPtr; ++c)
     PosNo += *c == '\t' ? 8 : 1;
   
   // Create the html for the message.
@@ -471,21 +470,21 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, unsigned BugFileID,
   
   SourceManager& SM = R.getSourceMgr();
   
-  SourceLocation LogicalStart = SM.getLogicalLoc(Range.getBegin());
-  unsigned StartLineNo = SM.getLineNumber(LogicalStart);
+  SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin());
+  unsigned StartLineNo = SM.getLineNumber(InstantiationStart);
   
-  SourceLocation LogicalEnd = SM.getLogicalLoc(Range.getEnd());
-  unsigned EndLineNo = SM.getLineNumber(LogicalEnd);
+  SourceLocation InstantiationEnd = SM.getInstantiationLoc(Range.getEnd());
+  unsigned EndLineNo = SM.getLineNumber(InstantiationEnd);
   
   if (EndLineNo < StartLineNo)
     return;
   
-  if (SM.getCanonicalFileID(LogicalStart) != BugFileID ||
-      SM.getCanonicalFileID(LogicalEnd) != BugFileID)
+  if (SM.getCanonicalFileID(InstantiationStart) != BugFileID ||
+      SM.getCanonicalFileID(InstantiationEnd) != BugFileID)
     return;
     
   // Compute the column number of the end.
-  unsigned EndColNo = SM.getColumnNumber(LogicalEnd);
+  unsigned EndColNo = SM.getColumnNumber(InstantiationEnd);
   unsigned OldEndColNo = EndColNo;
 
   if (EndColNo) {
@@ -496,8 +495,9 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, unsigned BugFileID,
   // Highlight the range.  Make the span tag the outermost tag for the
   // selected range.
     
-  SourceLocation E = LogicalEnd.getFileLocWithOffset(EndColNo - OldEndColNo);
+  SourceLocation E =
+    InstantiationEnd.getFileLocWithOffset(EndColNo - OldEndColNo);
   
-  html::HighlightRange(R, LogicalStart, E,
+  html::HighlightRange(R, InstantiationStart, E,
                        "<span class=\"mrange\">", "</span>");
 }
index b9e35aa815b45e85b42ce1ebcbe5ad2f8fa9554b..7719930125ab80f6c826193dbe84abc94c320565 100644 (file)
@@ -55,7 +55,7 @@ static void AddFID(FIDMap& FIDs,
                    llvm::SmallVectorImpl<unsigned>& V,
                    SourceManager& SM, SourceLocation L) {
 
-  unsigned fid = SM.getCanonicalFileID(SM.getLogicalLoc(L));
+  unsigned fid = SM.getCanonicalFileID(SM.getInstantiationLoc(L));
   FIDMap::iterator I = FIDs.find(fid);
   if (I != FIDs.end()) return;
   FIDs[fid] = V.size();
@@ -64,8 +64,7 @@ static void AddFID(FIDMap& FIDs,
 
 static unsigned GetFID(const FIDMap& FIDs,
                        SourceManager& SM, SourceLocation L) {
-
-  unsigned fid = SM.getCanonicalFileID(SM.getLogicalLoc(L));
+  unsigned fid = SM.getCanonicalFileID(SM.getInstantiationLoc(L));
   FIDMap::const_iterator I = FIDs.find(fid);
   assert (I != FIDs.end());
   return I->second;
@@ -82,9 +81,9 @@ static void EmitLocation(llvm::raw_ostream& o, SourceManager& SM,
 
   Indent(o, indent) << "<dict>\n";
   Indent(o, indent) << " <key>line</key><integer>"
-                    << SM.getLogicalLineNumber(L) << "</integer>\n";
+                    << SM.getInstantiationLineNumber(L) << "</integer>\n";
   Indent(o, indent) << " <key>col</key><integer>"
-                    << SM.getLogicalColumnNumber(L) << "</integer>\n";
+                    << SM.getInstantiationColumnNumber(L) << "</integer>\n";
   Indent(o, indent) << " <key>file</key><integer>"
                     << GetFID(FM, SM, L) << "</integer>\n";
   Indent(o, indent) << "</dict>\n";
index 719c611e2c980f53d46c5442e1ee863515a1d60c..1f98ef91901d4a77ae09ee7d6bfe4174053bd9c8 100644 (file)
@@ -23,7 +23,7 @@ void TextDiagnosticPrinter::
 PrintIncludeStack(FullSourceLoc Pos) {
   if (Pos.isInvalid()) return;
 
-  Pos = Pos.getLogicalLoc();
+  Pos = Pos.getInstantiationLoc();
 
   // Print out the other include frames first.
   PrintIncludeStack(Pos.getIncludeLoc());
@@ -44,20 +44,21 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
          "Expect a correspondence between source and caret line!");
   if (!R.isValid()) return;
 
-  SourceLocation LogicalStart = SourceMgr.getLogicalLoc(R.getBegin());
-  unsigned StartLineNo = SourceMgr.getLineNumber(LogicalStart);
-  if (StartLineNo > LineNo || LogicalStart.getFileID() != FileID)
+  SourceLocation InstantiationStart =
+    SourceMgr.getInstantiationLoc(R.getBegin());
+  unsigned StartLineNo = SourceMgr.getLineNumber(InstantiationStart);
+  if (StartLineNo > LineNo || InstantiationStart.getFileID() != FileID)
     return;  // No intersection.
   
-  SourceLocation LogicalEnd = SourceMgr.getLogicalLoc(R.getEnd());
-  unsigned EndLineNo = SourceMgr.getLineNumber(LogicalEnd);
-  if (EndLineNo < LineNo || LogicalEnd.getFileID() != FileID)
+  SourceLocation InstantiationEnd = SourceMgr.getInstantiationLoc(R.getEnd());
+  unsigned EndLineNo = SourceMgr.getLineNumber(InstantiationEnd);
+  if (EndLineNo < LineNo || InstantiationEnd.getFileID() != FileID)
     return;  // No intersection.
   
   // Compute the column number of the start.
   unsigned StartColNo = 0;
   if (StartLineNo == LineNo) {
-    StartColNo = SourceMgr.getLogicalColumnNumber(R.getBegin());
+    StartColNo = SourceMgr.getInstantiationColumnNumber(R.getBegin());
     if (StartColNo) --StartColNo;  // Zero base the col #.
   }
 
@@ -69,7 +70,7 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R,
   // Compute the column number of the end.
   unsigned EndColNo = CaretLine.size();
   if (EndLineNo == LineNo) {
-    EndColNo = SourceMgr.getLogicalColumnNumber(R.getEnd());
+    EndColNo = SourceMgr.getInstantiationColumnNumber(R.getEnd());
     if (EndColNo) {
       --EndColNo;  // Zero base the col #.
       
@@ -102,7 +103,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
   const FullSourceLoc &Pos = Info.getLocation();
   
   if (Pos.isValid()) {
-    FullSourceLoc LPos = Pos.getLogicalLoc();
+    FullSourceLoc LPos = Pos.getInstantiationLoc();
     LineNo = LPos.getLineNumber();
     FileID = LPos.getLocation().getFileID();
     
@@ -116,14 +117,14 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
     // Compute the column number.  Rewind from the current position to the start
     // of the line.
     ColNo = LPos.getColumnNumber();
-    const char *TokLogicalPtr = LPos.getCharacterData();
-    LineStart = TokLogicalPtr-ColNo+1;  // Column # is 1-based
+    const char *TokInstantiationPtr = LPos.getCharacterData();
+    LineStart = TokInstantiationPtr-ColNo+1;  // Column # is 1-based
 
     // Compute the line end.  Scan forward from the error position to the end of
     // the line.
     const llvm::MemoryBuffer *Buffer = LPos.getBuffer();
     const char *BufEnd = Buffer->getBufferEnd();
-    LineEnd = TokLogicalPtr;
+    LineEnd = TokInstantiationPtr;
     while (LineEnd != BufEnd && 
            *LineEnd != '\n' && *LineEnd != '\r')
       ++LineEnd;
index 96295d042fb2ae5b3ffd0aacc00faaa1e2fd22e2..0eb439a27b68d03837ee361f6fd0973b8e601f06 100644 (file)
@@ -179,7 +179,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
                                    const SourceManager &SM) {
   // If this comes from a macro expansion, we really do want the macro name, not
   // the token this macro expanded to.
-  Loc = SM.getLogicalLoc(Loc);
+  Loc = SM.getInstantiationLoc(Loc);
   
   const char *StrData = SM.getCharacterData(Loc);
   
@@ -284,12 +284,12 @@ static SourceLocation GetMappedTokenLoc(Preprocessor &PP,
   // spelling location.
   SourceManager &SourceMgr = PP.getSourceManager();
   
-  // Create a new SLoc which is expanded from logical(FileLoc) but whose
+  // Create a new SLoc which is expanded from Instantiation(FileLoc) but whose
   // characters come from spelling(FileLoc)+Offset.
-  SourceLocation VirtLoc = SourceMgr.getLogicalLoc(FileLoc);
+  SourceLocation InstLoc = SourceMgr.getInstantiationLoc(FileLoc);
   SourceLocation SpellingLoc = SourceMgr.getSpellingLoc(FileLoc);
   SpellingLoc = SourceLocation::getFileLoc(SpellingLoc.getFileID(), CharNo);
-  return SourceMgr.getInstantiationLoc(SpellingLoc, VirtLoc);
+  return SourceMgr.getInstantiationLoc(SpellingLoc, InstLoc);
 }
 
 /// getSourceLocation - Return a source location identifier for the specified
index 81e44f4823fa2b10b4160bd57710e68bc7046dd4..6c4096de6cc7f6791f9b6fe29756795fdfa27b52 100644 (file)
@@ -244,7 +244,7 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
     Identifier.setFlagValue(Token::StartOfLine , isAtStartOfLine);
     Identifier.setFlagValue(Token::LeadingSpace, hasLeadingSpace);
     
-    // Update the tokens location to include both its logical and physical
+    // Update the tokens location to include both its instantiation and physical
     // locations.
     SourceLocation Loc =
       SourceMgr.getInstantiationLoc(Identifier.getLocation(), InstantiateLoc);
@@ -453,7 +453,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
     // it will tokenize as a number (and not run into stuff after it in the temp
     // buffer).
     sprintf(TmpBuffer, "%u ",
-            SourceMgr.getLogicalLineNumber(Tok.getLocation()));
+            SourceMgr.getInstantiationLineNumber(Tok.getLocation()));
     unsigned Length = strlen(TmpBuffer)-1;
     Tok.setKind(tok::numeric_constant);
     Tok.setLength(Length);
@@ -470,7 +470,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
     }
     
     // Escape this filename.  Turn '\' -> '\\' '"' -> '\"'
-    std::string FN = SourceMgr.getSourceName(SourceMgr.getLogicalLoc(Loc));
+    std::string FN =SourceMgr.getSourceName(SourceMgr.getInstantiationLoc(Loc));
     FN = '"' + Lexer::Stringify(FN) + '"';
     Tok.setKind(tok::string_literal);
     Tok.setLength(FN.size());
index 59632edaaeb820763746a710f35550ceb082f608..bbe0f5c0f92ff0c5c43176b0fd05f38fc700e6b2 100644 (file)
@@ -140,7 +140,7 @@ void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
 }
 
 void Preprocessor::DumpLocation(SourceLocation Loc) const {
-  SourceLocation LogLoc = SourceMgr.getLogicalLoc(Loc);
+  SourceLocation LogLoc = SourceMgr.getInstantiationLoc(Loc);
   llvm::cerr << SourceMgr.getSourceName(LogLoc) << ':'
              << SourceMgr.getLineNumber(LogLoc) << ':'
              << SourceMgr.getColumnNumber(LogLoc);
@@ -314,7 +314,7 @@ SourceLocation Preprocessor::AdvanceToTokenCharacter(SourceLocation TokStart,
   // confusing.
   if (CharNo == 0 || TokStart.isMacroID()) return TokStart;
   
-  // Figure out how many physical characters away the specified logical
+  // Figure out how many physical characters away the specified instantiation
   // character is.  This needs to take into consideration newlines and
   // trigraphs.
   const char *TokPtr = SourceMgr.getCharacterData(TokStart);
index d83e98d8d83935d3485afb7e1279db52b16c53a0..153aeb824eb6cbba54c20d29b6a69c8cc5485412 100644 (file)
@@ -1037,11 +1037,11 @@ Parser::OwningStmtResult Parser::FuzzyParseMicrosoftAsmStatement() {
     // that the rest of the line is an assembly-language statement.
     SourceManager &SrcMgr = PP.getSourceManager();
     SourceLocation TokLoc = Tok.getLocation();
-    unsigned lineNo = SrcMgr.getLogicalLineNumber(TokLoc);
+    unsigned LineNo = SrcMgr.getInstantiationLineNumber(TokLoc);
     do {
       ConsumeAnyToken();
       TokLoc = Tok.getLocation();
-    } while ((SrcMgr.getLogicalLineNumber(TokLoc) == lineNo) && 
+    } while ((SrcMgr.getInstantiationLineNumber(TokLoc) == LineNo) && 
              Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) && 
              Tok.isNot(tok::eof));
   }
index 67afc08b9fd82098ea7b82abfb52d925dcdfd6aa..a605a1e665544f47d43dcc6c19167966959ae241 100644 (file)
@@ -31,8 +31,8 @@ using namespace clang;
 void html::HighlightRange(Rewriter &R, SourceLocation B, SourceLocation E,
                           const char *StartTag, const char *EndTag) {
   SourceManager &SM = R.getSourceMgr();
-  B = SM.getLogicalLoc(B);
-  E = SM.getLogicalLoc(E);
+  B = SM.getInstantiationLoc(B);
+  E = SM.getInstantiationLoc(E);
   unsigned FileID = SM.getCanonicalFileID(B);
   assert(SM.getCanonicalFileID(E) == FileID && "B/E not in the same file!");
 
@@ -442,8 +442,8 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor& PP) {
       continue;
     }
     
-    // Ignore tokens whose logical location was not the main file.
-    SourceLocation LLoc = SourceMgr.getLogicalLoc(Tok.getLocation());
+    // Ignore tokens whose instantiation location was not the main file.
+    SourceLocation LLoc = SourceMgr.getInstantiationLoc(Tok.getLocation());
     std::pair<unsigned, unsigned> LLocInfo = 
       SourceMgr.getDecomposedFileLoc(LLoc);
     
@@ -476,7 +476,7 @@ void html::HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor& PP) {
     // instantiation.  It would be really nice to pop up a window with all the
     // spelling of the tokens or something.
     while (!Tok.is(tok::eof) &&
-           SourceMgr.getLogicalLoc(Tok.getLocation()) == LLoc) {
+           SourceMgr.getInstantiationLoc(Tok.getLocation()) == LLoc) {
       // Insert a newline if the macro expansion is getting large.
       if (LineLen > 60) {
         Expansion += "<br>";