From 6d28d7f2a3079745a79fb95210e641ca844a902a Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 25 Jul 2011 16:56:02 +0000 Subject: [PATCH] Rename SourceManager::getInstantiationRange to getExpansionRange. llvm-svn: 135915 --- clang/include/clang/Basic/SourceManager.h | 6 +++--- clang/lib/ARCMigrate/TransformActions.cpp | 2 +- clang/lib/ARCMigrate/Transforms.cpp | 2 +- clang/lib/Basic/SourceManager.cpp | 6 +++--- clang/lib/Frontend/TextDiagnosticPrinter.cpp | 4 ++-- clang/lib/Lex/Lexer.cpp | 2 +- clang/lib/Lex/PPMacroExpansion.cpp | 2 +- clang/lib/Rewrite/HTMLRewrite.cpp | 2 +- clang/tools/libclang/CIndex.cpp | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index 373125ea0511..6ade7b4ed5f1 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -737,10 +737,10 @@ public: std::pair getImmediateInstantiationRange(SourceLocation Loc) const; - /// getInstantiationRange - Given a SourceLocation object, return the - /// range of tokens covered by the instantiation in the ultimate file. + /// getExpansionRange - Given a SourceLocation object, return the range of + /// tokens covered by the expansion the ultimate file. std::pair - getInstantiationRange(SourceLocation Loc) const; + getExpansionRange(SourceLocation Loc) const; /// getSpellingLoc - Given a SourceLocation object, return the spelling diff --git a/clang/lib/ARCMigrate/TransformActions.cpp b/clang/lib/ARCMigrate/TransformActions.cpp index 0f498f1c2016..65623a1b313a 100644 --- a/clang/lib/ARCMigrate/TransformActions.cpp +++ b/clang/lib/ARCMigrate/TransformActions.cpp @@ -589,7 +589,7 @@ SourceLocation TransformActionsImpl::getLocForEndOfToken(SourceLocation loc, SourceManager &SM, Preprocessor &PP) { if (loc.isMacroID()) - loc = SM.getInstantiationRange(loc).second; + loc = SM.getExpansionRange(loc).second; return PP.getLocForEndOfToken(loc); } diff --git a/clang/lib/ARCMigrate/Transforms.cpp b/clang/lib/ARCMigrate/Transforms.cpp index 42bda9c44301..c584d6a24362 100644 --- a/clang/lib/ARCMigrate/Transforms.cpp +++ b/clang/lib/ARCMigrate/Transforms.cpp @@ -95,7 +95,7 @@ SourceLocation trans::findLocationAfterSemi(SourceLocation loc, if (loc.isMacroID()) { if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOptions())) return SourceLocation(); - loc = SM.getInstantiationRange(loc).second; + loc = SM.getExpansionRange(loc).second; } loc = Lexer::getLocForEndOfToken(loc, /*Offset=*/0, SM, Ctx.getLangOptions()); diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index cbac7ffa31d4..aad23ad6db37 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -866,10 +866,10 @@ SourceManager::getImmediateInstantiationRange(SourceLocation Loc) const { return II.getInstantiationLocRange(); } -/// getInstantiationRange - Given a SourceLocation object, return the -/// range of tokens covered by the instantiation in the ultimate file. +/// getExpansionRange - Given a SourceLocation object, return the range of +/// tokens covered by the expansion in the ultimate file. std::pair -SourceManager::getInstantiationRange(SourceLocation Loc) const { +SourceManager::getExpansionRange(SourceLocation Loc) const { if (Loc.isFileID()) return std::make_pair(Loc, Loc); std::pair Res = diff --git a/clang/lib/Frontend/TextDiagnosticPrinter.cpp b/clang/lib/Frontend/TextDiagnosticPrinter.cpp index 1f766594034a..2bd7394c4759 100644 --- a/clang/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/TextDiagnosticPrinter.cpp @@ -94,7 +94,7 @@ void TextDiagnosticPrinter::HighlightRange(const CharSourceRange &R, // highlight the range. If this is a function-like macro, we'd also like to // highlight the arguments. if (Begin == End && R.getEnd().isMacroID()) - End = SM.getInstantiationRange(R.getEnd()).second; + End = SM.getExpansionRange(R.getEnd()).second; unsigned StartLineNo = SM.getInstantiationLineNumber(Begin); if (StartLineNo > LineNo || SM.getFileID(Begin) != FID) @@ -932,7 +932,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, // best we can do is to highlight the range. If this is a // function-like macro, we'd also like to highlight the arguments. if (B == E && Info.getRange(i).getEnd().isMacroID()) - E = SM.getInstantiationRange(Info.getRange(i).getEnd()).second; + E = SM.getExpansionRange(Info.getRange(i).getEnd()).second; std::pair BInfo = SM.getDecomposedLoc(B); std::pair EInfo = SM.getDecomposedLoc(E); diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 0ea8c12a7271..320971a6b82e 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -687,7 +687,7 @@ SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset, return SourceLocation(); // Points inside the macro expansion. // Continue and find the location just after the macro expansion. - Loc = SM.getInstantiationRange(Loc).second; + Loc = SM.getExpansionRange(Loc).second; } unsigned Len = Lexer::MeasureTokenLength(Loc, SM, Features); diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index d4fb28046a60..52b1fd22da19 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -838,7 +838,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // can matter for a function-like macro that expands to contain __LINE__. // Skip down through expansion points until we find a file loc for the // end of the expansion history. - Loc = SourceMgr.getInstantiationRange(Loc).second; + Loc = SourceMgr.getExpansionRange(Loc).second; PresumedLoc PLoc = SourceMgr.getPresumedLoc(Loc); // __LINE__ expands to a simple numeric value. diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index c76befbbd7f3..27f383f46ce4 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -519,7 +519,7 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) { // expansion by inserting a start tag before the macro expansion and // end tag after it. std::pair LLoc = - SM.getInstantiationRange(Tok.getLocation()); + SM.getExpansionRange(Tok.getLocation()); // Ignore tokens whose instantiation location was not the main file. if (SM.getFileID(LLoc.first) != FID) { diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 18842dc8278b..df9304992cb7 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -117,7 +117,7 @@ CXSourceRange cxloc::translateSourceRange(const SourceManager &SM, // location accordingly. SourceLocation EndLoc = R.getEnd(); if (EndLoc.isValid() && EndLoc.isMacroID()) - EndLoc = SM.getInstantiationRange(EndLoc).second; + EndLoc = SM.getExpansionRange(EndLoc).second; if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) { unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts); EndLoc = EndLoc.getFileLocWithOffset(Length);