unsigned Offset; // low bit is set for instantiation info.
union {
FileInfo File;
- ExpansionInfo Instantiation;
+ ExpansionInfo Expansion;
};
public:
unsigned getOffset() const { return Offset >> 1; }
- bool isInstantiation() const { return Offset & 1; }
- bool isFile() const { return !isInstantiation(); }
+ bool isExpansion() const { return Offset & 1; }
+ bool isFile() const { return !isExpansion(); }
const FileInfo &getFile() const {
assert(isFile() && "Not a file SLocEntry!");
return File;
}
- const ExpansionInfo &getInstantiation() const {
- assert(isInstantiation() && "Not an instantiation SLocEntry!");
- return Instantiation;
+ const ExpansionInfo &getExpansion() const {
+ assert(isExpansion() && "Not a macro expansion SLocEntry!");
+ return Expansion;
}
static SLocEntry get(unsigned Offset, const FileInfo &FI) {
static SLocEntry get(unsigned Offset, const ExpansionInfo &Expansion) {
SLocEntry E;
E.Offset = (Offset << 1) | 1;
- E.Instantiation = Expansion;
+ E.Expansion = Expansion;
return E;
}
};
// If this isn't an instantiation, remember it. We have good locality
// across FileID lookups.
- if (!I->isInstantiation())
+ if (!I->isExpansion())
LastFileIDLookup = Res;
NumLinearScans += NumProbes+1;
return Res;
if (isOffsetInFileID(FileID::get(MiddleIndex), SLocOffset)) {
FileID Res = FileID::get(MiddleIndex);
- // If this isn't an instantiation, remember it. We have good locality
+ // If this isn't a macro expansion, remember it. We have good locality
// across FileID lookups.
- if (!LocalSLocEntryTable[MiddleIndex].isInstantiation())
+ if (!LocalSLocEntryTable[MiddleIndex].isExpansion())
LastFileIDLookup = Res;
NumBinaryProbes += NumProbes;
return Res;
if (E.getOffset() <= SLocOffset) {
FileID Res = FileID::get(-int(I) - 2);
- if (!E.isInstantiation())
+ if (!E.isExpansion())
LastFileIDLookup = Res;
NumLinearScans += NumProbes + 1;
return Res;
if (isOffsetInFileID(FileID::get(-int(MiddleIndex) - 2), SLocOffset)) {
FileID Res = FileID::get(-int(MiddleIndex) - 2);
- if (!E.isInstantiation())
+ if (!E.isExpansion())
LastFileIDLookup = Res;
NumBinaryProbes += NumProbes;
return Res;
do {
// Note: If Loc indicates an offset into a token that came from a macro
// expansion (e.g. the 5th character of the token) we do not want to add
- // this offset when going to the instantiation location. The expansion
+ // this offset when going to the expansion location. The expansion
// location is the macro invocation, which the offset has nothing to do
// 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()
- .getExpansionLocStart();
+ Loc = getSLocEntry(getFileID(Loc)).getExpansion().getExpansionLocStart();
} while (!Loc.isFileID());
return Loc;
SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const {
do {
std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
- Loc = getSLocEntry(LocInfo.first).getInstantiation().getSpellingLoc();
+ Loc = getSLocEntry(LocInfo.first).getExpansion().getSpellingLoc();
Loc = Loc.getFileLocWithOffset(LocInfo.second);
} while (!Loc.isFileID());
return Loc;
SourceLocation Loc;
unsigned Offset;
do {
- Loc = E->getInstantiation().getExpansionLocStart();
+ Loc = E->getExpansion().getExpansionLocStart();
FID = getFileID(Loc);
E = &getSLocEntry(FID);
FileID FID;
SourceLocation Loc;
do {
- Loc = E->getInstantiation().getSpellingLoc();
+ Loc = E->getExpansion().getSpellingLoc();
FID = getFileID(Loc);
E = &getSLocEntry(FID);
SourceLocation SourceManager::getImmediateSpellingLoc(SourceLocation Loc) const{
if (Loc.isFileID()) return Loc;
std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
- Loc = getSLocEntry(LocInfo.first).getInstantiation().getSpellingLoc();
+ Loc = getSLocEntry(LocInfo.first).getExpansion().getSpellingLoc();
return Loc.getFileLocWithOffset(LocInfo.second);
}
std::pair<SourceLocation,SourceLocation>
SourceManager::getImmediateExpansionRange(SourceLocation Loc) const {
assert(Loc.isMacroID() && "Not an instantiation loc!");
- const ExpansionInfo &Expansion =
- getSLocEntry(getFileID(Loc)).getInstantiation();
+ const ExpansionInfo &Expansion = getSLocEntry(getFileID(Loc)).getExpansion();
return Expansion.getExpansionLocRange();
}
FileID FID = getFileID(Loc);
const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
- const SrcMgr::ExpansionInfo &Expansion = E->getInstantiation();
+ const SrcMgr::ExpansionInfo &Expansion = E->getExpansion();
return Expansion.isMacroArgExpansion();
}
const SourceManager &SM) {
SourceLocation UpperLoc;
const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(Loc.first);
- if (Entry.isInstantiation())
- UpperLoc = Entry.getInstantiation().getExpansionLocStart();
+ if (Entry.isExpansion())
+ UpperLoc = Entry.getExpansion().getExpansionLocStart();
else
UpperLoc = Entry.getFile().getIncludeLoc();
return false; // Does not point at the start of token.
SourceLocation expansionLoc =
- SM.getSLocEntry(infoLoc.first)
- .getInstantiation().getExpansionLocStart();
+ SM.getSLocEntry(infoLoc.first).getExpansion().getExpansionLocStart();
if (expansionLoc.isFileID())
return true; // No other macro expansions, this is the first.
return false; // Still in the same FileID, does not point to the last token.
SourceLocation expansionLoc =
- SM.getSLocEntry(FID).getInstantiation().getExpansionLocEnd();
+ SM.getSLocEntry(FID).getExpansion().getExpansionLocEnd();
if (expansionLoc.isFileID())
return true; // No other macro expansions.