]> granicus.if.org Git - clang/commitdiff
Rename getInstantiationLineNumber to getExpansionLineNumber in both
authorChandler Carruth <chandlerc@gmail.com>
Mon, 25 Jul 2011 21:09:52 +0000 (21:09 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 25 Jul 2011 21:09:52 +0000 (21:09 +0000)
SourceManager and FullSourceLoc.

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

17 files changed:
include/clang/Basic/SourceLocation.h
include/clang/Basic/SourceManager.h
lib/ARCMigrate/PlistReporter.cpp
lib/Basic/SourceLocation.cpp
lib/Basic/SourceManager.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Frontend/TextDiagnosticPrinter.cpp
lib/Parse/ParseStmt.cpp
lib/Rewrite/RewriteObjC.cpp
lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/CFRefCount.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
tools/libclang/CIndex.cpp

index eb8198fcad7628feaf6f1db7aba44a158aed5426..e578b4cd7e4aea99007179ad35dfcd23a92e21f7 100644 (file)
@@ -277,7 +277,7 @@ public:
   FullSourceLoc getExpansionLoc() const;
   FullSourceLoc getSpellingLoc() const;
 
-  unsigned getInstantiationLineNumber(bool *Invalid = 0) const;
+  unsigned getExpansionLineNumber(bool *Invalid = 0) const;
   unsigned getExpansionColumnNumber(bool *Invalid = 0) const;
 
   unsigned getSpellingLineNumber(bool *Invalid = 0) const;
index f8cf3fef7fe13f2998ced3a16a974797ac7ba7a2..413233c1d960a8b0a8d6603a67fe9bb22a20b792 100644 (file)
@@ -839,8 +839,7 @@ public:
   /// about to emit a diagnostic.
   unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid = 0) const;
   unsigned getSpellingLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
-  unsigned getInstantiationLineNumber(SourceLocation Loc, 
-                                      bool *Invalid = 0) const;
+  unsigned getExpansionLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
   unsigned getPresumedLineNumber(SourceLocation Loc, bool *Invalid = 0) const;
 
   /// Return the filename or buffer identifier of the buffer the location is in.
index 3aa8da505e5b15b14ec03309e661fba54e6e4157..81b953da9ff10488d262e16f69ebdb60cec8794b 100644 (file)
@@ -55,7 +55,7 @@ static void EmitLocation(raw_ostream& o, const SourceManager &SM,
 
   Indent(o, indent) << "<dict>\n";
   Indent(o, indent) << " <key>line</key><integer>"
-                    << Loc.getInstantiationLineNumber() << "</integer>\n";
+                    << Loc.getExpansionLineNumber() << "</integer>\n";
   Indent(o, indent) << " <key>col</key><integer>"
                     << Loc.getExpansionColumnNumber() + offset << "</integer>\n";
   Indent(o, indent) << " <key>file</key><integer>"
index f6c604b9401aff5fcf819d7a7b76cc0d3cc6c722..a13bbc515441fbf68e90da9045cbd5c872d9b28d 100644 (file)
@@ -85,9 +85,9 @@ FullSourceLoc FullSourceLoc::getSpellingLoc() const {
   return FullSourceLoc(SrcMgr->getSpellingLoc(*this), *SrcMgr);
 }
 
-unsigned FullSourceLoc::getInstantiationLineNumber(bool *Invalid) const {
+unsigned FullSourceLoc::getExpansionLineNumber(bool *Invalid) const {
   assert(isValid());
-  return SrcMgr->getInstantiationLineNumber(*this, Invalid);
+  return SrcMgr->getExpansionLineNumber(*this, Invalid);
 }
 
 unsigned FullSourceLoc::getExpansionColumnNumber(bool *Invalid) const {
index 293196161824ab2c275c58a750efbc5b62635d48..8f74e32ab2a9b0bdd68b3fc887a6275b5bc35dc7 100644 (file)
@@ -1153,8 +1153,8 @@ unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc,
   std::pair<FileID, unsigned> LocInfo = getDecomposedSpellingLoc(Loc);
   return getLineNumber(LocInfo.first, LocInfo.second);
 }
-unsigned SourceManager::getInstantiationLineNumber(SourceLocation Loc, 
-                                                   bool *Invalid) const {
+unsigned SourceManager::getExpansionLineNumber(SourceLocation Loc,
+                                               bool *Invalid) const {
   if (isInvalid(Loc, Invalid)) return 0;
   std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
   return getLineNumber(LocInfo.first, LocInfo.second);
index 9b22c7f95673ed055ac62154430f1cb67e74490a..a372d7d6964fa3fd4830b907307ee91e2efc8d56 100644 (file)
@@ -274,8 +274,7 @@ void CodeGenFunction::EmitStaticVarDecl(const VarDecl &D,
   if (const AnnotateAttr *AA = D.getAttr<AnnotateAttr>()) {
     SourceManager &SM = CGM.getContext().getSourceManager();
     llvm::Constant *Ann =
-      CGM.EmitAnnotateAttr(GV, AA,
-                           SM.getInstantiationLineNumber(D.getLocation()));
+      CGM.EmitAnnotateAttr(GV, AA, SM.getExpansionLineNumber(D.getLocation()));
     CGM.AddAnnotation(Ann);
   }
 
index d7b6c7ec3df35e3000112e8fe7e5882542dd20ab..290fe242c91a716dd1ac2e66d18d4c71482d6050 100644 (file)
@@ -1311,8 +1311,8 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
 
   if (const AnnotateAttr *AA = D->getAttr<AnnotateAttr>()) {
     SourceManager &SM = Context.getSourceManager();
-    AddAnnotation(EmitAnnotateAttr(GV, AA,
-                              SM.getInstantiationLineNumber(D->getLocation())));
+    AddAnnotation(EmitAnnotateAttr(
+        GV, AA, SM.getExpansionLineNumber(D->getLocation())));
   }
 
   GV->setInitializer(Init);
index 3ded41c9854644455c6d6db7bf69938e0c496f6b..f1659eb295ace42268484c136f050826a85f5d8d 100644 (file)
@@ -96,11 +96,11 @@ void TextDiagnosticPrinter::HighlightRange(const CharSourceRange &R,
   if (Begin == End && R.getEnd().isMacroID())
     End = SM.getExpansionRange(R.getEnd()).second;
 
-  unsigned StartLineNo = SM.getInstantiationLineNumber(Begin);
+  unsigned StartLineNo = SM.getExpansionLineNumber(Begin);
   if (StartLineNo > LineNo || SM.getFileID(Begin) != FID)
     return;  // No intersection.
 
-  unsigned EndLineNo = SM.getInstantiationLineNumber(End);
+  unsigned EndLineNo = SM.getExpansionLineNumber(End);
   if (EndLineNo < LineNo || SM.getFileID(End) != FID)
     return;  // No intersection.
 
index 8b325dab9c8c7fb111e83a91f9e3cc5e4adee754..622c8ea905a51271c8d425d012606752200322a0 100644 (file)
@@ -1567,12 +1567,12 @@ StmtResult Parser::FuzzyParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
     // that the rest of the line is an assembly-language statement.
     SourceManager &SrcMgr = PP.getSourceManager();
     SourceLocation TokLoc = Tok.getLocation();
-    unsigned LineNo = SrcMgr.getInstantiationLineNumber(TokLoc);
+    unsigned LineNo = SrcMgr.getExpansionLineNumber(TokLoc);
     do {
       EndLoc = TokLoc;
       ConsumeAnyToken();
       TokLoc = Tok.getLocation();
-    } while ((SrcMgr.getInstantiationLineNumber(TokLoc) == LineNo) &&
+    } while ((SrcMgr.getExpansionLineNumber(TokLoc) == LineNo) &&
              Tok.isNot(tok::r_brace) && Tok.isNot(tok::semi) &&
              Tok.isNot(tok::eof));
   }
index 64e5309c4bf9ab38b67067fb9bff3af0af57b999..585b43cf548aed154aa3c717809ea45aabd50bf2 100644 (file)
@@ -933,8 +933,8 @@ void RewriteObjC::RewriteMethodDeclaration(ObjCMethodDecl *Method) {
   SourceLocation LocStart = Method->getLocStart();
   SourceLocation LocEnd = Method->getLocEnd();
 
-  if (SM->getInstantiationLineNumber(LocEnd) >
-      SM->getInstantiationLineNumber(LocStart)) {
+  if (SM->getExpansionLineNumber(LocEnd) >
+      SM->getExpansionLineNumber(LocStart)) {
     InsertText(LocStart, "#if 0\n");
     ReplaceText(LocEnd, 1, ";\n#endif\n");
   } else {
index bb889c8972b1ee9f73f454dd223ad61780270d4a..5e4c333e5bd05a24f1b34db11496bede85268a3b 100644 (file)
@@ -53,7 +53,7 @@ SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os,
     const CompoundLiteralExpr* CL = CR->getLiteralExpr();
     os << "stack memory associated with a compound literal "
           "declared on line "
-        << SM.getInstantiationLineNumber(CL->getLocStart())
+        << SM.getExpansionLineNumber(CL->getLocStart())
         << " returned to caller";    
     range = CL->getSourceRange();
   }
@@ -62,14 +62,14 @@ SourceRange StackAddrEscapeChecker::GenName(raw_ostream &os,
     SourceLocation L = ARE->getLocStart();
     range = ARE->getSourceRange();    
     os << "stack memory allocated by call to alloca() on line "
-       << SM.getInstantiationLineNumber(L);
+       << SM.getExpansionLineNumber(L);
   }
   else if (const BlockDataRegion *BR = dyn_cast<BlockDataRegion>(R)) {
     const BlockDecl *BD = BR->getCodeRegion()->getDecl();
     SourceLocation L = BD->getLocStart();
     range = BD->getSourceRange();
     os << "stack-allocated block declared on line "
-       << SM.getInstantiationLineNumber(L);
+       << SM.getExpansionLineNumber(L);
   }
   else if (const VarRegion *VR = dyn_cast<VarRegion>(R)) {
     os << "stack memory associated with local variable '"
index d0fde272b0718a337225064859e8eba8db1d372d..84535d5b1e0d555bfce3cd0719eefd66abd65d25 100644 (file)
@@ -213,7 +213,7 @@ PathDiagnosticBuilder::ExecutionContinues(llvm::raw_string_ostream& os,
 
   if (Loc.asStmt())
     os << "Execution continues on line "
-       << getSourceManager().getInstantiationLineNumber(Loc.asLocation())
+       << getSourceManager().getExpansionLineNumber(Loc.asLocation())
        << '.';
   else {
     os << "Execution jumps to the end of the ";
@@ -560,7 +560,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
           const PathDiagnosticLocation &End = PDB.getEnclosingStmtLocation(S);
 
           os << "Control jumps to line "
-          << End.asLocation().getInstantiationLineNumber();
+          << End.asLocation().getExpansionLineNumber();
           PD.push_front(new PathDiagnosticControlFlowPiece(Start, End,
                                                            os.str()));
           break;
@@ -578,11 +578,11 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
               default:
                 os << "No cases match in the switch statement. "
                 "Control jumps to line "
-                << End.asLocation().getInstantiationLineNumber();
+                << End.asLocation().getExpansionLineNumber();
                 break;
               case Stmt::DefaultStmtClass:
                 os << "Control jumps to the 'default' case at line "
-                << End.asLocation().getInstantiationLineNumber();
+                << End.asLocation().getExpansionLineNumber();
                 break;
 
               case Stmt::CaseStmtClass: {
@@ -609,7 +609,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
                   os << LHS->EvaluateAsInt(PDB.getASTContext());
 
                 os << ":'  at line "
-                << End.asLocation().getInstantiationLineNumber();
+                << End.asLocation().getExpansionLineNumber();
                 break;
               }
             }
@@ -979,10 +979,10 @@ bool EdgeBuilder::containsLocation(const PathDiagnosticLocation &Container,
   SourceLocation ContaineeRBeg = SM.getExpansionLoc(ContaineeR.getBegin());
   SourceLocation ContaineeREnd = SM.getExpansionLoc(ContaineeR.getEnd());
 
-  unsigned ContainerBegLine = SM.getInstantiationLineNumber(ContainerRBeg);
-  unsigned ContainerEndLine = SM.getInstantiationLineNumber(ContainerREnd);
-  unsigned ContaineeBegLine = SM.getInstantiationLineNumber(ContaineeRBeg);
-  unsigned ContaineeEndLine = SM.getInstantiationLineNumber(ContaineeREnd);
+  unsigned ContainerBegLine = SM.getExpansionLineNumber(ContainerRBeg);
+  unsigned ContainerEndLine = SM.getExpansionLineNumber(ContainerREnd);
+  unsigned ContaineeBegLine = SM.getExpansionLineNumber(ContaineeRBeg);
+  unsigned ContaineeEndLine = SM.getExpansionLineNumber(ContaineeREnd);
 
   assert(ContainerBegLine <= ContainerEndLine);
   assert(ContaineeBegLine <= ContaineeEndLine);
index 80e110241192d6b497ff23446a9d48f09753a771..4c3381f4074a23e16d43ae58e7a4ae7fe8bd2963 100644 (file)
@@ -2480,7 +2480,7 @@ CFRefLeakReport::CFRefLeakReport(CFRefBug& D, const CFRefCount &tf,
   Description.clear();
   llvm::raw_string_ostream os(Description);
   SourceManager& SMgr = Eng.getContext().getSourceManager();
-  unsigned AllocLine = SMgr.getInstantiationLineNumber(AllocSite);
+  unsigned AllocLine = SMgr.getExpansionLineNumber(AllocSite);
   os << "Potential leak ";
   if (tf.isGCEnabled()) {
     os << "(when using garbage collection) ";
index a9189f2f0a8a21364c012f722bc7de0bacd1f682..b654f1cf34711171134dfd1bf8033f6a39009f9f 100644 (file)
@@ -3099,7 +3099,7 @@ struct DOTGraphTraits<ExplodedNode*> :
 
           if (SLoc.isFileID()) {
             Out << "\\lline="
-              << GraphPrintSourceManager->getInstantiationLineNumber(SLoc)
+              << GraphPrintSourceManager->getExpansionLineNumber(SLoc)
               << " col="
               << GraphPrintSourceManager->getExpansionColumnNumber(SLoc)
               << "\\l";
@@ -3152,7 +3152,7 @@ struct DOTGraphTraits<ExplodedNode*> :
 
           if (SLoc.isFileID()) {
             Out << "\\lline="
-              << GraphPrintSourceManager->getInstantiationLineNumber(SLoc)
+              << GraphPrintSourceManager->getExpansionLineNumber(SLoc)
               << " col="
               << GraphPrintSourceManager->getExpansionColumnNumber(SLoc);
           }
index a3b8a78858f3fd34f60bac3a4f983d44d8cc39a9..9f8a989d8f6b74c1ec9323fb6c975563f165adf4 100644 (file)
@@ -221,7 +221,7 @@ 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().asLocation().getInstantiationLineNumber()
+      << (*D.rbegin()).getLocation().asLocation().getExpansionLineNumber()
       << ", column "
       << (*D.rbegin()).getLocation().asLocation().getExpansionColumnNumber()
       << "</a></td></tr>\n"
@@ -261,7 +261,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
     os << "\n<!-- BUGFILE " << DirName << Entry->getName() << " -->\n";
 
     os << "\n<!-- BUGLINE "
-       << D.back()->getLocation().asLocation().getInstantiationLineNumber()
+       << D.back()->getLocation().asLocation().getExpansionLineNumber()
        << " -->\n";
 
     os << "\n<!-- BUGPATHLENGTH " << D.size() << " -->\n";
@@ -550,10 +550,10 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID,
   const LangOptions &LangOpts = R.getLangOpts();
 
   SourceLocation InstantiationStart = SM.getExpansionLoc(Range.getBegin());
-  unsigned StartLineNo = SM.getInstantiationLineNumber(InstantiationStart);
+  unsigned StartLineNo = SM.getExpansionLineNumber(InstantiationStart);
 
   SourceLocation InstantiationEnd = SM.getExpansionLoc(Range.getEnd());
-  unsigned EndLineNo = SM.getInstantiationLineNumber(InstantiationEnd);
+  unsigned EndLineNo = SM.getExpansionLineNumber(InstantiationEnd);
 
   if (EndLineNo < StartLineNo)
     return;
index d923f30e37fe6f5d64736d54e62c0b86dcfd13f1..b244dea4e4b9a4a519fb21da773da818df8e492e 100644 (file)
@@ -142,7 +142,7 @@ static void EmitLocation(raw_ostream& o, const SourceManager &SM,
 
   Indent(o, indent) << "<dict>\n";
   Indent(o, indent) << " <key>line</key><integer>"
-                    << Loc.getInstantiationLineNumber() << "</integer>\n";
+                    << Loc.getExpansionLineNumber() << "</integer>\n";
   Indent(o, indent) << " <key>col</key><integer>"
                     << Loc.getExpansionColumnNumber() + offset << "</integer>\n";
   Indent(o, indent) << " <key>file</key><integer>"
index 6cab2b19e5c28c6f97678a7c8dcf7e4e6a6e0d58..8104828eccec154f4b20954e7708e6f8af851c4b 100644 (file)
@@ -2838,7 +2838,7 @@ void clang_getInstantiationLocation(CXSourceLocation location,
   if (file)
     *file = (void *)SM.getFileEntryForSLocEntry(sloc);
   if (line)
-    *line = SM.getInstantiationLineNumber(InstLoc);
+    *line = SM.getExpansionLineNumber(InstLoc);
   if (column)
     *column = SM.getExpansionColumnNumber(InstLoc);
   if (offset)