]> granicus.if.org Git - clang/commitdiff
Mechanically rename SourceManager::getInstantiationLoc and
authorChandler Carruth <chandlerc@gmail.com>
Mon, 25 Jul 2011 16:49:02 +0000 (16:49 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 25 Jul 2011 16:49:02 +0000 (16:49 +0000)
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

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

24 files changed:
include/clang/Basic/SourceLocation.h
include/clang/Basic/SourceManager.h
lib/ARCMigrate/PlistReporter.cpp
lib/ARCMigrate/TransBlockObjCVariable.cpp
lib/ARCMigrate/TransformActions.cpp
lib/Basic/DiagnosticIDs.cpp
lib/Basic/SourceLocation.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/Frontend/DependencyFile.cpp
lib/Frontend/TextDiagnosticPrinter.cpp
lib/Lex/Lexer.cpp
lib/Lex/TokenLexer.cpp
lib/Parse/ParseExpr.cpp
lib/Rewrite/HTMLRewrite.cpp
lib/Rewrite/RewriteMacros.cpp
lib/Rewrite/RewriteObjC.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaDeclCXX.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
tools/libclang/CIndex.cpp
tools/libclang/CIndexUSRs.cpp

index 01e2b2c29942668e6dcbc908f74befc5ea7796fa..34620a7ff48e59823058dba852d3cf0b6e8af493 100644 (file)
@@ -274,7 +274,7 @@ public:
 
   FileID getFileID() const;
 
-  FullSourceLoc getInstantiationLoc() const;
+  FullSourceLoc getExpansionLoc() const;
   FullSourceLoc getSpellingLoc() const;
 
   unsigned getInstantiationLineNumber(bool *Invalid = 0) const;
index 6e035fcb80f0d36743fe6e917bc243684a908bdb..373125ea05112ea925a64a03465876ce29be0fbb 100644 (file)
@@ -723,11 +723,11 @@ public:
     return SourceLocation::getFileLoc(FileOffset);
   }
 
-  /// getInstantiationLoc - Given a SourceLocation object, return the
-  /// instantiation location referenced by the ID.
-  SourceLocation getInstantiationLoc(SourceLocation Loc) const {
+  /// getExpansionLoc - Given a SourceLocation object, return the expansion
+  /// location referenced by the ID.
+  SourceLocation getExpansionLoc(SourceLocation Loc) const {
     // Handle the non-mapped case inline, defer to out of line code to handle
-    // instantiations.
+    // expansions.
     if (Loc.isFileID()) return Loc;
     return getInstantiationLocSlowCase(Loc);
   }
index ba74caef54048af7fef91dc1fff197c829d3da3b..1b487ce8a01751dcf972867a4eefb82c754b19fa 100644 (file)
@@ -22,7 +22,7 @@ typedef llvm::DenseMap<FileID, unsigned> FIDMap;
 static void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
                    const SourceManager &SM, SourceLocation L) {
 
-  FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
+  FileID FID = SM.getFileID(SM.getExpansionLoc(L));
   FIDMap::iterator I = FIDs.find(FID);
   if (I != FIDs.end()) return;
   FIDs[FID] = V.size();
@@ -31,7 +31,7 @@ static void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
 
 static unsigned GetFID(const FIDMap& FIDs, const SourceManager &SM,
                        SourceLocation L) {
-  FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
+  FileID FID = SM.getFileID(SM.getExpansionLoc(L));
   FIDMap::const_iterator I = FIDs.find(FID);
   assert(I != FIDs.end());
   return I->second;
@@ -47,7 +47,7 @@ static void EmitLocation(raw_ostream& o, const SourceManager &SM,
                          SourceLocation L, const FIDMap &FM,
                          unsigned indent, bool extend = false) {
 
-  FullSourceLoc Loc(SM.getInstantiationLoc(L), const_cast<SourceManager&>(SM));
+  FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager&>(SM));
 
   // Add in the length of the token, so that we cover multi-char tokens.
   unsigned offset =
index 505b4ef8a0c8cb8ee176adc083e985bff2904474..48c0ca9cefe5128504dd1e39e027772e550a6f20 100644 (file)
@@ -100,7 +100,7 @@ public:
         bool useWeak = canApplyWeak(Pass.Ctx, var->getType());
         SourceManager &SM = Pass.Ctx.getSourceManager();
         Transaction Trans(Pass.TA);
-        Pass.TA.replaceText(SM.getInstantiationLoc(attr->getLocation()),
+        Pass.TA.replaceText(SM.getExpansionLoc(attr->getLocation()),
                             "__block",
                             useWeak ? "__weak" : "__unsafe_unretained");
       }
index ca72aab2949ae9b70090f28f24eed6cb8e566e59..0f498f1c20169127c78c2ada1747f31e724e0e03 100644 (file)
@@ -68,11 +68,11 @@ class TransformActionsImpl {
       SourceLocation beginLoc = range.getBegin(), endLoc = range.getEnd();
       assert(beginLoc.isValid() && endLoc.isValid());
       if (range.isTokenRange()) {
-        Begin = FullSourceLoc(srcMgr.getInstantiationLoc(beginLoc), srcMgr);
+        Begin = FullSourceLoc(srcMgr.getExpansionLoc(beginLoc), srcMgr);
         End = FullSourceLoc(getLocForEndOfToken(endLoc, srcMgr, PP), srcMgr);
       } else {
-        Begin = FullSourceLoc(srcMgr.getInstantiationLoc(beginLoc), srcMgr);
-        End = FullSourceLoc(srcMgr.getInstantiationLoc(endLoc), srcMgr);
+        Begin = FullSourceLoc(srcMgr.getExpansionLoc(beginLoc), srcMgr);
+        End = FullSourceLoc(srcMgr.getExpansionLoc(endLoc), srcMgr);
       }
       assert(Begin.isValid() && End.isValid());
     } 
@@ -381,7 +381,7 @@ bool TransformActionsImpl::canInsert(SourceLocation loc) {
     return false;
 
   SourceManager &SM = Ctx.getSourceManager();
-  if (SM.isInSystemHeader(SM.getInstantiationLoc(loc)))
+  if (SM.isInSystemHeader(SM.getExpansionLoc(loc)))
     return false;
 
   if (loc.isFileID())
@@ -394,7 +394,7 @@ bool TransformActionsImpl::canInsertAfterToken(SourceLocation loc) {
     return false;
 
   SourceManager &SM = Ctx.getSourceManager();
-  if (SM.isInSystemHeader(SM.getInstantiationLoc(loc)))
+  if (SM.isInSystemHeader(SM.getExpansionLoc(loc)))
     return false;
 
   if (loc.isFileID())
@@ -416,7 +416,7 @@ bool TransformActionsImpl::canReplaceText(SourceLocation loc, StringRef text) {
     return false;
 
   SourceManager &SM = Ctx.getSourceManager();
-  loc = SM.getInstantiationLoc(loc);
+  loc = SM.getExpansionLoc(loc);
 
   // Break down the source location.
   std::pair<FileID, unsigned> locInfo = SM.getDecomposedLoc(loc);
@@ -477,7 +477,7 @@ void TransformActionsImpl::commitReplaceText(SourceLocation loc,
                                              StringRef text,
                                              StringRef replacementText) {
   SourceManager &SM = Ctx.getSourceManager();
-  loc = SM.getInstantiationLoc(loc);
+  loc = SM.getExpansionLoc(loc);
   // canReplaceText already checked if loc points at text.
   SourceLocation afterText = loc.getFileLocWithOffset(text.size());
 
@@ -491,7 +491,7 @@ void TransformActionsImpl::commitIncreaseIndentation(SourceRange range,
   IndentationRanges.push_back(
                  std::make_pair(CharRange(CharSourceRange::getTokenRange(range),
                                           SM, PP),
-                                SM.getInstantiationLoc(parentIndent)));
+                                SM.getExpansionLoc(parentIndent)));
 }
 
 void TransformActionsImpl::commitClearDiagnostic(ArrayRef<unsigned> IDs,
@@ -501,7 +501,7 @@ void TransformActionsImpl::commitClearDiagnostic(ArrayRef<unsigned> IDs,
 
 void TransformActionsImpl::addInsertion(SourceLocation loc, StringRef text) {
   SourceManager &SM = Ctx.getSourceManager();
-  loc = SM.getInstantiationLoc(loc);
+  loc = SM.getExpansionLoc(loc);
   for (std::list<CharRange>::reverse_iterator
          I = Removals.rbegin(), E = Removals.rend(); I != E; ++I) {
     if (!SM.isBeforeInTranslationUnit(loc, I->End))
index 19f627e8041319d259f5dfd43fb2b5c4cfc5c458..08e4420c410b8578cf27fa12d977441b4564ca8e 100644 (file)
@@ -540,7 +540,7 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass,
       Diag.SuppressSystemWarnings &&
       Loc.isValid() &&
       Diag.getSourceManager().isInSystemHeader(
-          Diag.getSourceManager().getInstantiationLoc(Loc)))
+          Diag.getSourceManager().getExpansionLoc(Loc)))
     return DiagnosticIDs::Ignored;
 
   return Result;
index cf89edb935c9e334397d5a7b25bd4b70dfb69656..84f03fb35091e37098fba2a5d3699708ac23e95e 100644 (file)
@@ -54,7 +54,7 @@ void SourceLocation::print(raw_ostream &OS, const SourceManager &SM)const{
     return;
   }
 
-  SM.getInstantiationLoc(*this).print(OS, SM);
+  SM.getExpansionLoc(*this).print(OS, SM);
 
   OS << " <Spelling=";
   SM.getSpellingLoc(*this).print(OS, SM);
@@ -75,9 +75,9 @@ FileID FullSourceLoc::getFileID() const {
 }
 
 
-FullSourceLoc FullSourceLoc::getInstantiationLoc() const {
+FullSourceLoc FullSourceLoc::getExpansionLoc() const {
   assert(isValid());
-  return FullSourceLoc(SrcMgr->getInstantiationLoc(*this), *SrcMgr);
+  return FullSourceLoc(SrcMgr->getExpansionLoc(*this), *SrcMgr);
 }
 
 FullSourceLoc FullSourceLoc::getSpellingLoc() const {
index 9cfb71e82532a0b601027959c9d1659fd3cfa09e..44c16a32b3631856e6f5f179b389f9994f417d95 100644 (file)
@@ -51,7 +51,7 @@ CGDebugInfo::~CGDebugInfo() {
 
 void CGDebugInfo::setLocation(SourceLocation Loc) {
   if (Loc.isValid())
-    CurLoc = CGM.getContext().getSourceManager().getInstantiationLoc(Loc);
+    CurLoc = CGM.getContext().getSourceManager().getExpansionLoc(Loc);
 }
 
 /// getContextDescriptor - Get context info for the decl.
@@ -1740,7 +1740,7 @@ void CGDebugInfo::EmitStopPoint(CGBuilderTy &Builder) {
   // Don't bother if things are the same as last time.
   SourceManager &SM = CGM.getContext().getSourceManager();
   if (CurLoc == PrevLoc || 
-      SM.getInstantiationLoc(CurLoc) == SM.getInstantiationLoc(PrevLoc))
+      SM.getExpansionLoc(CurLoc) == SM.getExpansionLoc(PrevLoc))
     // New Builder may not be in sync with CGDebugInfo.
     if (!Builder.getCurrentDebugLocation().isUnknown())
       return;
index 9cffed2b357e8bafe75985aa7bf7b9eb6e373372..843586437821cd608b11bc9bd5356e8d21c8ade6 100644 (file)
@@ -123,7 +123,7 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc,
   SourceManager &SM = PP->getSourceManager();
 
   const FileEntry *FE =
-    SM.getFileEntryForID(SM.getFileID(SM.getInstantiationLoc(Loc)));
+    SM.getFileEntryForID(SM.getFileID(SM.getExpansionLoc(Loc)));
   if (FE == 0) return;
 
   StringRef Filename = FE->getName();
index 83a1a371881b1fa291c4f790acd9a0828e17ee25..1f766594034a9d69b5ef582329b40a9b2c7153c7 100644 (file)
@@ -85,8 +85,8 @@ void TextDiagnosticPrinter::HighlightRange(const CharSourceRange &R,
          "Expect a correspondence between source and caret line!");
   if (!R.isValid()) return;
 
-  SourceLocation Begin = SM.getInstantiationLoc(R.getBegin());
-  SourceLocation End = SM.getInstantiationLoc(R.getEnd());
+  SourceLocation Begin = SM.getExpansionLoc(R.getBegin());
+  SourceLocation End = SM.getExpansionLoc(R.getEnd());
 
   // If the End location and the start location are the same and are a macro
   // location, then the range was something that came from a macro expansion
@@ -914,7 +914,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
                 
         if (DiagOpts->ShowSourceRanges && Info.getNumRanges()) {
           FileID CaretFileID =
-            SM.getFileID(SM.getInstantiationLoc(Info.getLocation()));
+            SM.getFileID(SM.getExpansionLoc(Info.getLocation()));
           bool PrintedRange = false;
 
           for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) {
@@ -923,8 +923,8 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
 
             SourceLocation B = Info.getRange(i).getBegin();
             SourceLocation E = Info.getRange(i).getEnd();
-            B = SM.getInstantiationLoc(B);
-            E = SM.getInstantiationLoc(E);
+            B = SM.getExpansionLoc(B);
+            E = SM.getExpansionLoc(E);
 
             // If the End location and the start location are the same and are a
             // macro location, then the range was something that came from a
index 575cb4af25d23fc0374263dd38900374e70fe7af..0ea8c12a72711402fec1925c05ae518976877fb0 100644 (file)
@@ -394,7 +394,7 @@ unsigned Lexer::MeasureTokenLength(SourceLocation Loc,
 
   // If this comes from a macro expansion, we really do want the macro name, not
   // the token this macro expanded to.
-  Loc = SM.getInstantiationLoc(Loc);
+  Loc = SM.getExpansionLoc(Loc);
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
   bool Invalid = false;
   StringRef Buffer = SM.getBufferData(LocInfo.first, &Invalid);
index aab72e0ef35d4f77e6ae7cfc29a43f692a3aaf4d..22f94e097ed633a49c77d42b3f37a2ca4f434393 100644 (file)
@@ -55,7 +55,7 @@ void TokenLexer::Init(Token &Tok, SourceLocation ELEnd, MacroArgs *Actuals) {
     // definition. Tokens that get lexed directly from the definition will
     // have their locations pointing inside this chunk. This is to avoid
     // creating separate source location entries for each token.
-    SourceLocation macroStart = SM.getInstantiationLoc(Tokens[0].getLocation());
+    SourceLocation macroStart = SM.getExpansionLoc(Tokens[0].getLocation());
     MacroDefStartInfo = SM.getDecomposedLoc(macroStart);
     MacroExpansionStart = SM.createInstantiationLoc(macroStart,
                                               ExpandLocStart,
index 2799fedecd3d0d952056130b1523c6384a757460..b961e60d1ee1598cc8cbeeaa5c74170a756fdcee 100644 (file)
@@ -311,7 +311,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) {
         const char *FIText = ": ";
         const SourceManager &SM = PP.getSourceManager();
         if (FILoc.isFileID() || PP.isAtStartOfMacroExpansion(FILoc)) {
-          FILoc = SM.getInstantiationLoc(FILoc);
+          FILoc = SM.getExpansionLoc(FILoc);
           bool IsInvalid = false;
           const char *SourcePtr =
             SM.getCharacterData(FILoc.getFileLocWithOffset(-1), &IsInvalid);
index be75f973a7d029f97d2243a3b1d2dc7bbc36bd4f..c76befbbd7f30e6d3f1660e179441a142a30e7ac 100644 (file)
@@ -33,8 +33,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.getInstantiationLoc(B);
-  E = SM.getInstantiationLoc(E);
+  B = SM.getExpansionLoc(B);
+  E = SM.getExpansionLoc(E);
   FileID FID = SM.getFileID(B);
   assert(SM.getFileID(E) == FID && "B/E not in the same file!");
 
@@ -542,7 +542,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const 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) &&
-           SM.getInstantiationLoc(Tok.getLocation()) == LLoc.first) {
+           SM.getExpansionLoc(Tok.getLocation()) == LLoc.first) {
       // Insert a newline if the macro expansion is getting large.
       if (LineLen > 60) {
         Expansion += "<br>";
index d1dda91ad05302af13a98a7b09ed86d302d056c6..d56910037c6c974879284129bd56e6dbbe575678 100644 (file)
@@ -112,7 +112,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS) {
   // 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.getInstantiationLoc(PPTok.getLocation());
+    SourceLocation PPLoc = SM.getExpansionLoc(PPTok.getLocation());
 
     // If PPTok is from a different source file, ignore it.
     if (!SM.isFromMainFile(PPLoc)) {
@@ -197,7 +197,7 @@ void clang::RewriteMacrosInInput(Preprocessor &PP, raw_ostream *OS) {
     while (PPOffs < RawOffs) {
       Expansion += ' ' + PP.getSpelling(PPTok);
       PP.Lex(PPTok);
-      PPLoc = SM.getInstantiationLoc(PPTok.getLocation());
+      PPLoc = SM.getExpansionLoc(PPTok.getLocation());
       PPOffs = SM.getFileOffset(PPLoc);
     }
     Expansion += ' ';
index 524d78e9ce7472e5324dc641ce34d48945894dc2..64e5309c4bf9ab38b67067fb9bff3af0af57b999 100644 (file)
@@ -690,7 +690,7 @@ void RewriteObjC::HandleTopLevelSingleDecl(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->getInstantiationLoc(Loc);
+  Loc = SM->getExpansionLoc(Loc);
 
   // If this is for a builtin, ignore it.
   if (Loc.isInvalid()) return;
@@ -2342,13 +2342,13 @@ void RewriteObjC::RewriteTypeOfDecl(VarDecl *ND) {
       startLoc = ECE->getLParenLoc();
     else
       startLoc = E->getLocStart();
-    startLoc = SM->getInstantiationLoc(startLoc);
+    startLoc = SM->getExpansionLoc(startLoc);
     const char *endBuf = SM->getCharacterData(startLoc);
     ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString);
   }
   else {
     SourceLocation X = ND->getLocEnd();
-    X = SM->getInstantiationLoc(X);
+    X = SM->getExpansionLoc(X);
     const char *endBuf = SM->getCharacterData(X);
     ReplaceText(DeclLoc, endBuf-startBuf-1, TypeAsString);
   }
@@ -5108,7 +5108,7 @@ void RewriteObjC::RewriteByRefVar(VarDecl *ND) {
     DeclLoc = ND->getLocation();
   const char *startBuf = SM->getCharacterData(DeclLoc);
   SourceLocation X = ND->getLocEnd();
-  X = SM->getInstantiationLoc(X);
+  X = SM->getExpansionLoc(X);
   const char *endBuf = SM->getCharacterData(X);
   std::string Name(ND->getNameAsString());
   std::string ByrefType;
@@ -5203,7 +5203,7 @@ void RewriteObjC::RewriteByRefVar(VarDecl *ND) {
       startLoc = ECE->getLParenLoc();
     else
       startLoc = E->getLocStart();
-    startLoc = SM->getInstantiationLoc(startLoc);
+    startLoc = SM->getExpansionLoc(startLoc);
     endBuf = SM->getCharacterData(startLoc);
     ByrefType += " " + Name;
     ByrefType += " = {(void*)";
index 7f0e4769c58848bcc69e401d4aa915c4d07b1dcb..bcac88a43d3e81cae7a0e698374a41658aa9566a 100644 (file)
@@ -687,7 +687,7 @@ bool Sema::findMacroSpelling(SourceLocation &locref, StringRef name) {
 
   // There's no good way right now to look at the intermediate
   // instantiations, so just jump to the instantiation location.
-  loc = getSourceManager().getInstantiationLoc(loc);
+  loc = getSourceManager().getExpansionLoc(loc);
 
   // If that's written with the name, stop here.
   SmallVector<char, 16> buffer;
index e45df45b313fed8d7adf7e6879381fd62df4193e..f688d9ddab02fb352efd23a60db659505a4f51a5 100644 (file)
@@ -4947,7 +4947,7 @@ Decl *Sema::ActOnUsingDirective(Scope *S,
                                       IdentLoc, Named, CommonAncestor);
 
     if (IsUsingDirectiveInToplevelContext(CurContext) &&
-        !SourceMgr.isFromMainFile(SourceMgr.getInstantiationLoc(IdentLoc))) {
+        !SourceMgr.isFromMainFile(SourceMgr.getExpansionLoc(IdentLoc))) {
       Diag(IdentLoc, diag::warn_using_directive_in_header);
     }
 
index 2f7b67aa062d403a55574fdce522a1a882cd2fb5..e09519634e21222405b6b84580bf476a015992af 100644 (file)
@@ -974,10 +974,10 @@ bool EdgeBuilder::containsLocation(const PathDiagnosticLocation &Container,
   SourceRange ContaineeR = Containee.asRange();
 
   SourceManager &SM = PDB.getSourceManager();
-  SourceLocation ContainerRBeg = SM.getInstantiationLoc(ContainerR.getBegin());
-  SourceLocation ContainerREnd = SM.getInstantiationLoc(ContainerR.getEnd());
-  SourceLocation ContaineeRBeg = SM.getInstantiationLoc(ContaineeR.getBegin());
-  SourceLocation ContaineeREnd = SM.getInstantiationLoc(ContaineeR.getEnd());
+  SourceLocation ContainerRBeg = SM.getExpansionLoc(ContainerR.getBegin());
+  SourceLocation ContainerREnd = SM.getExpansionLoc(ContainerR.getEnd());
+  SourceLocation ContaineeRBeg = SM.getExpansionLoc(ContaineeR.getBegin());
+  SourceLocation ContaineeREnd = SM.getExpansionLoc(ContaineeR.getEnd());
 
   unsigned ContainerBegLine = SM.getInstantiationLineNumber(ContainerRBeg);
   unsigned ContainerEndLine = SM.getInstantiationLineNumber(ContainerREnd);
@@ -1010,8 +1010,8 @@ void EdgeBuilder::rawAddEdge(PathDiagnosticLocation NewLoc) {
     return;
 
   // FIXME: Ignore intra-macro edges for now.
-  if (NewLocClean.asLocation().getInstantiationLoc() ==
-      PrevLocClean.asLocation().getInstantiationLoc())
+  if (NewLocClean.asLocation().getExpansionLoc() ==
+      PrevLocClean.asLocation().getExpansionLoc())
     return;
 
   PD.push_front(new PathDiagnosticControlFlowPiece(NewLocClean, PrevLocClean));
@@ -1495,7 +1495,7 @@ static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) {
     // Determine the instantiation location, which is the location we group
     // related PathDiagnosticPieces.
     SourceLocation InstantiationLoc = Loc.isMacroID() ?
-                                      SM.getInstantiationLoc(Loc) :
+                                      SM.getExpansionLoc(Loc) :
                                       SourceLocation();
 
     if (Loc.isFileID()) {
@@ -1517,7 +1517,7 @@ static void CompactPathDiagnostic(PathDiagnostic &PD, const SourceManager& SM) {
     PathDiagnosticMacroPiece *MacroGroup = 0;
 
     SourceLocation ParentInstantiationLoc = InstantiationLoc.isMacroID() ?
-                                          SM.getInstantiationLoc(Loc) :
+                                          SM.getExpansionLoc(Loc) :
                                           SourceLocation();
 
     // Walk the entire macro stack.
index 56cdee6545661eb43c1ec544e7af03d8e98a0aa7..59799ee3ac35e5a7fc8cd5fb0429251593b9af6b 100644 (file)
@@ -143,7 +143,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
 
   // 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().asLocation().getInstantiationLoc();
+    FullSourceLoc L = I->getLocation().asLocation().getExpansionLoc();
 
     if (FID.isInvalid()) {
       FID = SMgr.getFileID(L);
@@ -154,12 +154,12 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
     for (PathDiagnosticPiece::range_iterator RI=I->ranges_begin(),
                                              RE=I->ranges_end(); RI!=RE; ++RI) {
 
-      SourceLocation L = SMgr.getInstantiationLoc(RI->getBegin());
+      SourceLocation L = SMgr.getExpansionLoc(RI->getBegin());
 
       if (!L.isFileID() || SMgr.getFileID(L) != FID)
         return; // FIXME: Emit a warning?
 
-      L = SMgr.getInstantiationLoc(RI->getEnd());
+      L = SMgr.getExpansionLoc(RI->getEnd());
 
       if (!L.isFileID() || SMgr.getFileID(L) != FID)
         return; // FIXME: Emit a warning?
@@ -335,7 +335,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
   // Compute the column number.  Rewind from the current position to the start
   // of the line.
   unsigned ColNo = SM.getColumnNumber(LPosInfo.first, LPosInfo.second);
-  const char *TokInstantiationPtr =Pos.getInstantiationLoc().getCharacterData();
+  const char *TokInstantiationPtr =Pos.getExpansionLoc().getCharacterData();
   const char *LineStart = TokInstantiationPtr-ColNo;
 
   // Compute LineEnd.
@@ -441,7 +441,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
 
     // Get the name of the macro by relexing it.
     {
-      FullSourceLoc L = MP->getLocation().asLocation().getInstantiationLoc();
+      FullSourceLoc L = MP->getLocation().asLocation().getExpansionLoc();
       assert(L.isFileID());
       StringRef BufferInfo = L.getBufferData();
       const char* MacroName = L.getDecomposedLoc().second + BufferInfo.data();
@@ -549,10 +549,10 @@ void HTMLDiagnostics::HighlightRange(Rewriter& R, FileID BugFileID,
   SourceManager &SM = R.getSourceMgr();
   const LangOptions &LangOpts = R.getLangOpts();
 
-  SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin());
+  SourceLocation InstantiationStart = SM.getExpansionLoc(Range.getBegin());
   unsigned StartLineNo = SM.getInstantiationLineNumber(InstantiationStart);
 
-  SourceLocation InstantiationEnd = SM.getInstantiationLoc(Range.getEnd());
+  SourceLocation InstantiationEnd = SM.getExpansionLoc(Range.getEnd());
   unsigned EndLineNo = SM.getInstantiationLineNumber(InstantiationEnd);
 
   if (EndLineNo < StartLineNo)
index 9ebc2562edf940b97ecb0f682e71b595d7710d5e..673277e950c14a32a25e4f99f55ba763e2c85015 100644 (file)
@@ -109,7 +109,7 @@ PlistDiagnostics::getGenerationScheme() const {
 static void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
                    const SourceManager* SM, SourceLocation L) {
 
-  FileID FID = SM->getFileID(SM->getInstantiationLoc(L));
+  FileID FID = SM->getFileID(SM->getExpansionLoc(L));
   FIDMap::iterator I = FIDs.find(FID);
   if (I != FIDs.end()) return;
   FIDs[FID] = V.size();
@@ -118,7 +118,7 @@ static void AddFID(FIDMap &FIDs, SmallVectorImpl<FileID> &V,
 
 static unsigned GetFID(const FIDMap& FIDs, const SourceManager &SM,
                        SourceLocation L) {
-  FileID FID = SM.getFileID(SM.getInstantiationLoc(L));
+  FileID FID = SM.getFileID(SM.getExpansionLoc(L));
   FIDMap::const_iterator I = FIDs.find(FID);
   assert(I != FIDs.end());
   return I->second;
@@ -134,7 +134,7 @@ static void EmitLocation(raw_ostream& o, const SourceManager &SM,
                          SourceLocation L, const FIDMap &FM,
                          unsigned indent, bool extend = false) {
 
-  FullSourceLoc Loc(SM.getInstantiationLoc(L), const_cast<SourceManager&>(SM));
+  FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager&>(SM));
 
   // Add in the length of the token, so that we cover multi-char tokens.
   unsigned offset =
index dd024f817e65a806a103d0a62f5c7b5487399830..e8b027d21cac1fe6d2e362f36a996f6bc106504e 100644 (file)
@@ -267,7 +267,7 @@ void AnalysisConsumer::HandleCode(Decl *D) {
   // Don't run the actions on declarations in header files unless
   // otherwise specified.
   SourceManager &SM = Ctx->getSourceManager();
-  SourceLocation SL = SM.getInstantiationLoc(D->getLocation());
+  SourceLocation SL = SM.getExpansionLoc(D->getLocation());
   if (!Opts.AnalyzeAll && !SM.isFromMainFile(SL))
     return;
 
index 7838384f3bcce5bb6461ed443aad15970d6af3a0..18842dc8278b37de4903d812f122dcf626bd2df8 100644 (file)
@@ -2824,7 +2824,7 @@ void clang_getInstantiationLocation(CXSourceLocation location,
 
   const SourceManager &SM =
     *static_cast<const SourceManager*>(location.ptr_data[0]);
-  SourceLocation InstLoc = SM.getInstantiationLoc(Loc);
+  SourceLocation InstLoc = SM.getExpansionLoc(Loc);
 
   // Check that the FileID is invalid on the expansion location.
   // This can manifest in invalid code.
@@ -2865,7 +2865,7 @@ void clang_getSpellingLocation(CXSourceLocation location,
         SM.getFileEntryForID(SM.getDecomposedLoc(SimpleSpellingLoc).first))
       SpellLoc = SimpleSpellingLoc;
     else
-      SpellLoc = SM.getInstantiationLoc(SpellLoc);
+      SpellLoc = SM.getExpansionLoc(SpellLoc);
   }
 
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(SpellLoc);
index 7026f99227370be1bfcea2f622c2a96a63bc7661..464dbb0ac7dff97d594ba7bcc7e17d15f18d73ca 100644 (file)
@@ -486,7 +486,7 @@ bool USRGenerator::GenLoc(const Decl *D) {
     IgnoreResults = true;
     return true;
   }
-  L = SM.getInstantiationLoc(L);
+  L = SM.getExpansionLoc(L);
   const std::pair<FileID, unsigned> &Decomposed = SM.getDecomposedLoc(L);
   const FileEntry *FE = SM.getFileEntryForID(Decomposed.first);
   if (FE) {