summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-07-26 04:41:47 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-07-26 04:41:47 +0000
commit73ee5d7fae72fce0e4c2438836fad3eda722fe49 (patch)
treeefc879fdda3394dcc5932ff4c8dcd086875b9506 /clang/lib
parent26a27fb832392d3c6ea965ed44ed2158ecd5baf9 (diff)
downloadbcm5719-llvm-73ee5d7fae72fce0e4c2438836fad3eda722fe49.tar.gz
bcm5719-llvm-73ee5d7fae72fce0e4c2438836fad3eda722fe49.zip
Convert InstantiationInfo and much of the related code to ExpansionInfo
and various other 'expansion' based terms. I've tried to reformat where appropriate and catch as many references in comments but I'm going to do several more passes. Also I've tried to expand parameter names to be more clear where appropriate. llvm-svn: 136056
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Basic/SourceManager.cpp34
-rw-r--r--clang/lib/Lex/Lexer.cpp4
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp8
3 files changed, 23 insertions, 23 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index ba2dcdf7c21..aaa9c5dc6ce 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -521,9 +521,9 @@ SourceLocation
SourceManager::createMacroArgExpansionLoc(SourceLocation SpellingLoc,
SourceLocation ExpansionLoc,
unsigned TokLength) {
- InstantiationInfo II =
- InstantiationInfo::createForMacroArg(SpellingLoc, ExpansionLoc);
- return createExpansionLocImpl(II, TokLength);
+ ExpansionInfo Info = ExpansionInfo::createForMacroArg(SpellingLoc,
+ ExpansionLoc);
+ return createExpansionLocImpl(Info, TokLength);
}
SourceLocation
@@ -533,14 +533,13 @@ SourceManager::createExpansionLoc(SourceLocation SpellingLoc,
unsigned TokLength,
int LoadedID,
unsigned LoadedOffset) {
- InstantiationInfo II =
- InstantiationInfo::create(SpellingLoc, ExpansionLocStart,
- ExpansionLocEnd);
- return createExpansionLocImpl(II, TokLength, LoadedID, LoadedOffset);
+ ExpansionInfo Info = ExpansionInfo::create(SpellingLoc, ExpansionLocStart,
+ ExpansionLocEnd);
+ return createExpansionLocImpl(Info, TokLength, LoadedID, LoadedOffset);
}
SourceLocation
-SourceManager::createExpansionLocImpl(const InstantiationInfo &II,
+SourceManager::createExpansionLocImpl(const ExpansionInfo &Info,
unsigned TokLength,
int LoadedID,
unsigned LoadedOffset) {
@@ -549,11 +548,11 @@ SourceManager::createExpansionLocImpl(const InstantiationInfo &II,
unsigned Index = unsigned(-LoadedID) - 2;
assert(Index < LoadedSLocEntryTable.size() && "FileID out of range");
assert(!SLocEntryLoaded[Index] && "FileID already loaded");
- LoadedSLocEntryTable[Index] = SLocEntry::get(LoadedOffset, II);
+ LoadedSLocEntryTable[Index] = SLocEntry::get(LoadedOffset, Info);
SLocEntryLoaded[Index] = true;
return SourceLocation::getMacroLoc(LoadedOffset);
}
- LocalSLocEntryTable.push_back(SLocEntry::get(NextLocalOffset, II));
+ LocalSLocEntryTable.push_back(SLocEntry::get(NextLocalOffset, Info));
assert(NextLocalOffset + TokLength + 1 > NextLocalOffset &&
NextLocalOffset + TokLength + 1 <= CurrentLoadedOffset &&
"Ran out of source locations!");
@@ -794,7 +793,7 @@ getExpansionLocSlowCase(SourceLocation Loc) const {
// with. This is unlike when we get the spelling loc, because the offset
// directly correspond to the token whose spelling we're inspecting.
Loc = getSLocEntry(getFileID(Loc)).getInstantiation()
- .getInstantiationLocStart();
+ .getExpansionLocStart();
} while (!Loc.isFileID());
return Loc;
@@ -819,7 +818,7 @@ SourceManager::getDecomposedExpansionLocSlowCase(
SourceLocation Loc;
unsigned Offset;
do {
- Loc = E->getInstantiation().getInstantiationLocStart();
+ Loc = E->getInstantiation().getExpansionLocStart();
FID = getFileID(Loc);
E = &getSLocEntry(FID);
@@ -864,8 +863,9 @@ SourceLocation SourceManager::getImmediateSpellingLoc(SourceLocation Loc) const{
std::pair<SourceLocation,SourceLocation>
SourceManager::getImmediateExpansionRange(SourceLocation Loc) const {
assert(Loc.isMacroID() && "Not an instantiation loc!");
- const InstantiationInfo &II = getSLocEntry(getFileID(Loc)).getInstantiation();
- return II.getInstantiationLocRange();
+ const ExpansionInfo &Expansion =
+ getSLocEntry(getFileID(Loc)).getInstantiation();
+ return Expansion.getExpansionLocRange();
}
/// getExpansionRange - Given a SourceLocation object, return the range of
@@ -891,8 +891,8 @@ bool SourceManager::isMacroArgExpansion(SourceLocation Loc) const {
FileID FID = getFileID(Loc);
const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
- const SrcMgr::InstantiationInfo &II = E->getInstantiation();
- return II.isMacroArgExpansion();
+ const SrcMgr::ExpansionInfo &Expansion = E->getInstantiation();
+ return Expansion.isMacroArgExpansion();
}
@@ -1467,7 +1467,7 @@ static bool MoveUpIncludeHierarchy(std::pair<FileID, unsigned> &Loc,
SourceLocation UpperLoc;
const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(Loc.first);
if (Entry.isInstantiation())
- UpperLoc = Entry.getInstantiation().getInstantiationLocStart();
+ UpperLoc = Entry.getInstantiation().getExpansionLocStart();
else
UpperLoc = Entry.getFile().getIncludeLoc();
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index f5aa1347885..25e61131c3b 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -714,7 +714,7 @@ bool Lexer::isAtStartOfMacroExpansion(SourceLocation loc,
SourceLocation expansionLoc =
SM.getSLocEntry(infoLoc.first)
- .getInstantiation().getInstantiationLocStart();
+ .getInstantiation().getExpansionLocStart();
if (expansionLoc.isFileID())
return true; // No other macro expansions, this is the first.
@@ -744,7 +744,7 @@ bool Lexer::isAtEndOfMacroExpansion(SourceLocation loc,
return false; // Still in the same FileID, does not point to the last token.
SourceLocation expansionLoc =
- SM.getSLocEntry(FID).getInstantiation().getInstantiationLocEnd();
+ SM.getSLocEntry(FID).getInstantiation().getExpansionLocEnd();
if (expansionLoc.isFileID())
return true; // No other macro expansions.
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 7620cb7ee07..6e3966e65ba 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -1505,10 +1505,10 @@ void ASTWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
}
} else {
// The source location entry is a macro expansion.
- const SrcMgr::InstantiationInfo &Inst = SLoc->getInstantiation();
- Record.push_back(Inst.getSpellingLoc().getRawEncoding());
- Record.push_back(Inst.getInstantiationLocStart().getRawEncoding());
- Record.push_back(Inst.getInstantiationLocEnd().getRawEncoding());
+ const SrcMgr::ExpansionInfo &Expansion = SLoc->getInstantiation();
+ Record.push_back(Expansion.getSpellingLoc().getRawEncoding());
+ Record.push_back(Expansion.getExpansionLocStart().getRawEncoding());
+ Record.push_back(Expansion.getExpansionLocEnd().getRawEncoding());
// Compute the token length for this macro expansion.
unsigned NextOffset = SourceMgr.getNextLocalOffset();
OpenPOWER on IntegriCloud