Rename SourceManager::getInstantiationRange to getExpansionRange.

llvm-svn: 135915
This commit is contained in:
Chandler Carruth 2011-07-25 16:56:02 +00:00
parent 35f5320d8e
commit 6d28d7f2a3
9 changed files with 14 additions and 14 deletions

View File

@ -737,10 +737,10 @@ public:
std::pair<SourceLocation,SourceLocation> std::pair<SourceLocation,SourceLocation>
getImmediateInstantiationRange(SourceLocation Loc) const; getImmediateInstantiationRange(SourceLocation Loc) const;
/// getInstantiationRange - Given a SourceLocation object, return the /// getExpansionRange - Given a SourceLocation object, return the range of
/// range of tokens covered by the instantiation in the ultimate file. /// tokens covered by the expansion the ultimate file.
std::pair<SourceLocation,SourceLocation> std::pair<SourceLocation,SourceLocation>
getInstantiationRange(SourceLocation Loc) const; getExpansionRange(SourceLocation Loc) const;
/// getSpellingLoc - Given a SourceLocation object, return the spelling /// getSpellingLoc - Given a SourceLocation object, return the spelling

View File

@ -589,7 +589,7 @@ SourceLocation TransformActionsImpl::getLocForEndOfToken(SourceLocation loc,
SourceManager &SM, SourceManager &SM,
Preprocessor &PP) { Preprocessor &PP) {
if (loc.isMacroID()) if (loc.isMacroID())
loc = SM.getInstantiationRange(loc).second; loc = SM.getExpansionRange(loc).second;
return PP.getLocForEndOfToken(loc); return PP.getLocForEndOfToken(loc);
} }

View File

@ -95,7 +95,7 @@ SourceLocation trans::findLocationAfterSemi(SourceLocation loc,
if (loc.isMacroID()) { if (loc.isMacroID()) {
if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOptions())) if (!Lexer::isAtEndOfMacroExpansion(loc, SM, Ctx.getLangOptions()))
return SourceLocation(); return SourceLocation();
loc = SM.getInstantiationRange(loc).second; loc = SM.getExpansionRange(loc).second;
} }
loc = Lexer::getLocForEndOfToken(loc, /*Offset=*/0, SM, Ctx.getLangOptions()); loc = Lexer::getLocForEndOfToken(loc, /*Offset=*/0, SM, Ctx.getLangOptions());

View File

@ -866,10 +866,10 @@ SourceManager::getImmediateInstantiationRange(SourceLocation Loc) const {
return II.getInstantiationLocRange(); return II.getInstantiationLocRange();
} }
/// getInstantiationRange - Given a SourceLocation object, return the /// getExpansionRange - Given a SourceLocation object, return the range of
/// range of tokens covered by the instantiation in the ultimate file. /// tokens covered by the expansion in the ultimate file.
std::pair<SourceLocation,SourceLocation> std::pair<SourceLocation,SourceLocation>
SourceManager::getInstantiationRange(SourceLocation Loc) const { SourceManager::getExpansionRange(SourceLocation Loc) const {
if (Loc.isFileID()) return std::make_pair(Loc, Loc); if (Loc.isFileID()) return std::make_pair(Loc, Loc);
std::pair<SourceLocation,SourceLocation> Res = std::pair<SourceLocation,SourceLocation> Res =

View File

@ -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 range. If this is a function-like macro, we'd also like to
// highlight the arguments. // highlight the arguments.
if (Begin == End && R.getEnd().isMacroID()) if (Begin == End && R.getEnd().isMacroID())
End = SM.getInstantiationRange(R.getEnd()).second; End = SM.getExpansionRange(R.getEnd()).second;
unsigned StartLineNo = SM.getInstantiationLineNumber(Begin); unsigned StartLineNo = SM.getInstantiationLineNumber(Begin);
if (StartLineNo > LineNo || SM.getFileID(Begin) != FID) 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 // best we can do is to highlight the range. If this is a
// function-like macro, we'd also like to highlight the arguments. // function-like macro, we'd also like to highlight the arguments.
if (B == E && Info.getRange(i).getEnd().isMacroID()) 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<FileID, unsigned> BInfo = SM.getDecomposedLoc(B); std::pair<FileID, unsigned> BInfo = SM.getDecomposedLoc(B);
std::pair<FileID, unsigned> EInfo = SM.getDecomposedLoc(E); std::pair<FileID, unsigned> EInfo = SM.getDecomposedLoc(E);

View File

@ -687,7 +687,7 @@ SourceLocation Lexer::getLocForEndOfToken(SourceLocation Loc, unsigned Offset,
return SourceLocation(); // Points inside the macro expansion. return SourceLocation(); // Points inside the macro expansion.
// Continue and find the location just after 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); unsigned Len = Lexer::MeasureTokenLength(Loc, SM, Features);

View File

@ -838,7 +838,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// can matter for a function-like macro that expands to contain __LINE__. // 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 // Skip down through expansion points until we find a file loc for the
// end of the expansion history. // end of the expansion history.
Loc = SourceMgr.getInstantiationRange(Loc).second; Loc = SourceMgr.getExpansionRange(Loc).second;
PresumedLoc PLoc = SourceMgr.getPresumedLoc(Loc); PresumedLoc PLoc = SourceMgr.getPresumedLoc(Loc);
// __LINE__ expands to a simple numeric value. // __LINE__ expands to a simple numeric value.

View File

@ -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 // expansion by inserting a start tag before the macro expansion and
// end tag after it. // end tag after it.
std::pair<SourceLocation, SourceLocation> LLoc = std::pair<SourceLocation, SourceLocation> LLoc =
SM.getInstantiationRange(Tok.getLocation()); SM.getExpansionRange(Tok.getLocation());
// Ignore tokens whose instantiation location was not the main file. // Ignore tokens whose instantiation location was not the main file.
if (SM.getFileID(LLoc.first) != FID) { if (SM.getFileID(LLoc.first) != FID) {

View File

@ -117,7 +117,7 @@ CXSourceRange cxloc::translateSourceRange(const SourceManager &SM,
// location accordingly. // location accordingly.
SourceLocation EndLoc = R.getEnd(); SourceLocation EndLoc = R.getEnd();
if (EndLoc.isValid() && EndLoc.isMacroID()) if (EndLoc.isValid() && EndLoc.isMacroID())
EndLoc = SM.getInstantiationRange(EndLoc).second; EndLoc = SM.getExpansionRange(EndLoc).second;
if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) { if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) {
unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts); unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts);
EndLoc = EndLoc.getFileLocWithOffset(Length); EndLoc = EndLoc.getFileLocWithOffset(Length);