forked from OSchip/llvm-project
Rename getDecomposedInstantiationLoc to getDecomposedExpansionLoc.
llvm-svn: 135962
This commit is contained in:
parent
c84d769c68
commit
c7ca5218b6
|
@ -767,11 +767,11 @@ public:
|
||||||
return std::make_pair(FID, Loc.getOffset()-getSLocEntry(FID).getOffset());
|
return std::make_pair(FID, Loc.getOffset()-getSLocEntry(FID).getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getDecomposedInstantiationLoc - Decompose the specified location into a
|
/// getDecomposedExpansionLoc - Decompose the specified location into a
|
||||||
/// raw FileID + Offset pair. If the location is an instantiation record,
|
/// raw FileID + Offset pair. If the location is an instantiation record,
|
||||||
/// walk through it until we find the final location instantiated.
|
/// walk through it until we find the final location instantiated.
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
getDecomposedInstantiationLoc(SourceLocation Loc) const {
|
getDecomposedExpansionLoc(SourceLocation Loc) const {
|
||||||
FileID FID = getFileID(Loc);
|
FileID FID = getFileID(Loc);
|
||||||
const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
|
const SrcMgr::SLocEntry *E = &getSLocEntry(FID);
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ public:
|
||||||
if (Loc.isFileID())
|
if (Loc.isFileID())
|
||||||
return std::make_pair(FID, Offset);
|
return std::make_pair(FID, Offset);
|
||||||
|
|
||||||
return getDecomposedInstantiationLocSlowCase(E);
|
return getDecomposedExpansionLocSlowCase(E);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getDecomposedSpellingLoc - Decompose the specified location into a raw
|
/// getDecomposedSpellingLoc - Decompose the specified location into a raw
|
||||||
|
@ -1134,7 +1134,7 @@ private:
|
||||||
SourceLocation getSpellingLocSlowCase(SourceLocation Loc) const;
|
SourceLocation getSpellingLocSlowCase(SourceLocation Loc) const;
|
||||||
|
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E) const;
|
getDecomposedExpansionLocSlowCase(const SrcMgr::SLocEntry *E) const;
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
|
getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
|
||||||
unsigned Offset) const;
|
unsigned Offset) const;
|
||||||
|
|
|
@ -289,7 +289,7 @@ unsigned SourceManager::getLineTableFilenameID(StringRef Name) {
|
||||||
/// unspecified.
|
/// unspecified.
|
||||||
void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
|
void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
|
||||||
int FilenameID) {
|
int FilenameID) {
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
|
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
||||||
|
@ -319,7 +319,7 @@ void SourceManager::AddLineNote(SourceLocation Loc, unsigned LineNo,
|
||||||
return AddLineNote(Loc, LineNo, FilenameID);
|
return AddLineNote(Loc, LineNo, FilenameID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
|
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
||||||
|
@ -809,7 +809,7 @@ SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const {
|
||||||
|
|
||||||
|
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
SourceManager::getDecomposedInstantiationLocSlowCase(
|
SourceManager::getDecomposedExpansionLocSlowCase(
|
||||||
const SrcMgr::SLocEntry *E) const {
|
const SrcMgr::SLocEntry *E) const {
|
||||||
// If this is an instantiation record, walk through all the instantiation
|
// If this is an instantiation record, walk through all the instantiation
|
||||||
// points.
|
// points.
|
||||||
|
@ -961,7 +961,7 @@ unsigned SourceManager::getSpellingColumnNumber(SourceLocation Loc,
|
||||||
unsigned SourceManager::getInstantiationColumnNumber(SourceLocation Loc,
|
unsigned SourceManager::getInstantiationColumnNumber(SourceLocation Loc,
|
||||||
bool *Invalid) const {
|
bool *Invalid) const {
|
||||||
if (isInvalid(Loc, Invalid)) return 0;
|
if (isInvalid(Loc, Invalid)) return 0;
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
return getColumnNumber(LocInfo.first, LocInfo.second, Invalid);
|
return getColumnNumber(LocInfo.first, LocInfo.second, Invalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,7 +1156,7 @@ unsigned SourceManager::getSpellingLineNumber(SourceLocation Loc,
|
||||||
unsigned SourceManager::getInstantiationLineNumber(SourceLocation Loc,
|
unsigned SourceManager::getInstantiationLineNumber(SourceLocation Loc,
|
||||||
bool *Invalid) const {
|
bool *Invalid) const {
|
||||||
if (isInvalid(Loc, Invalid)) return 0;
|
if (isInvalid(Loc, Invalid)) return 0;
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
return getLineNumber(LocInfo.first, LocInfo.second);
|
return getLineNumber(LocInfo.first, LocInfo.second);
|
||||||
}
|
}
|
||||||
unsigned SourceManager::getPresumedLineNumber(SourceLocation Loc,
|
unsigned SourceManager::getPresumedLineNumber(SourceLocation Loc,
|
||||||
|
@ -1176,7 +1176,7 @@ unsigned SourceManager::getPresumedLineNumber(SourceLocation Loc,
|
||||||
SrcMgr::CharacteristicKind
|
SrcMgr::CharacteristicKind
|
||||||
SourceManager::getFileCharacteristic(SourceLocation Loc) const {
|
SourceManager::getFileCharacteristic(SourceLocation Loc) const {
|
||||||
assert(!Loc.isInvalid() && "Can't get file characteristic of invalid loc!");
|
assert(!Loc.isInvalid() && "Can't get file characteristic of invalid loc!");
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
const SLocEntry &SEntry = getSLocEntry(LocInfo.first, &Invalid);
|
const SLocEntry &SEntry = getSLocEntry(LocInfo.first, &Invalid);
|
||||||
if (Invalid || !SEntry.isFile())
|
if (Invalid || !SEntry.isFile())
|
||||||
|
@ -1223,7 +1223,7 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc) const {
|
||||||
if (Loc.isInvalid()) return PresumedLoc();
|
if (Loc.isInvalid()) return PresumedLoc();
|
||||||
|
|
||||||
// Presumed locations are always for instantiation points.
|
// Presumed locations are always for instantiation points.
|
||||||
std::pair<FileID, unsigned> LocInfo = getDecomposedInstantiationLoc(Loc);
|
std::pair<FileID, unsigned> LocInfo = getDecomposedExpansionLoc(Loc);
|
||||||
|
|
||||||
bool Invalid = false;
|
bool Invalid = false;
|
||||||
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
const SLocEntry &Entry = getSLocEntry(LocInfo.first, &Invalid);
|
||||||
|
|
|
@ -519,7 +519,7 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
|
||||||
// We have an insertion hint. Determine whether the inserted
|
// We have an insertion hint. Determine whether the inserted
|
||||||
// code is on the same line as the caret.
|
// code is on the same line as the caret.
|
||||||
std::pair<FileID, unsigned> HintLocInfo
|
std::pair<FileID, unsigned> HintLocInfo
|
||||||
= SM.getDecomposedInstantiationLoc(Hint->RemoveRange.getBegin());
|
= SM.getDecomposedExpansionLoc(Hint->RemoveRange.getBegin());
|
||||||
if (SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) ==
|
if (SM.getLineNumber(HintLocInfo.first, HintLocInfo.second) ==
|
||||||
SM.getLineNumber(FID, FileOffset)) {
|
SM.getLineNumber(FID, FileOffset)) {
|
||||||
// Insert the new code into the line just below the code
|
// Insert the new code into the line just below the code
|
||||||
|
|
|
@ -68,9 +68,9 @@ unsigned MacroInfo::getDefinitionLengthSlow(SourceManager &SM) const {
|
||||||
assert((macroEnd.isFileID() || lastToken.is(tok::comment)) &&
|
assert((macroEnd.isFileID() || lastToken.is(tok::comment)) &&
|
||||||
"Macro defined in macro?");
|
"Macro defined in macro?");
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
startInfo = SM.getDecomposedInstantiationLoc(macroStart);
|
startInfo = SM.getDecomposedExpansionLoc(macroStart);
|
||||||
std::pair<FileID, unsigned>
|
std::pair<FileID, unsigned>
|
||||||
endInfo = SM.getDecomposedInstantiationLoc(macroEnd);
|
endInfo = SM.getDecomposedExpansionLoc(macroEnd);
|
||||||
assert(startInfo.first == endInfo.first &&
|
assert(startInfo.first == endInfo.first &&
|
||||||
"Macro definition spanning multiple FileIDs ?");
|
"Macro definition spanning multiple FileIDs ?");
|
||||||
assert(startInfo.second <= endInfo.second);
|
assert(startInfo.second <= endInfo.second);
|
||||||
|
|
|
@ -825,7 +825,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit,
|
||||||
// If we are leaving the current presumed file, check to make sure the
|
// If we are leaving the current presumed file, check to make sure the
|
||||||
// presumed include stack isn't empty!
|
// presumed include stack isn't empty!
|
||||||
FileID CurFileID =
|
FileID CurFileID =
|
||||||
SM.getDecomposedInstantiationLoc(FlagTok.getLocation()).first;
|
SM.getDecomposedExpansionLoc(FlagTok.getLocation()).first;
|
||||||
PresumedLoc PLoc = SM.getPresumedLoc(FlagTok.getLocation());
|
PresumedLoc PLoc = SM.getPresumedLoc(FlagTok.getLocation());
|
||||||
if (PLoc.isInvalid())
|
if (PLoc.isInvalid())
|
||||||
return true;
|
return true;
|
||||||
|
@ -834,7 +834,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit,
|
||||||
// different physical file, then we aren't in a "1" line marker flag region.
|
// different physical file, then we aren't in a "1" line marker flag region.
|
||||||
SourceLocation IncLoc = PLoc.getIncludeLoc();
|
SourceLocation IncLoc = PLoc.getIncludeLoc();
|
||||||
if (IncLoc.isInvalid() ||
|
if (IncLoc.isInvalid() ||
|
||||||
SM.getDecomposedInstantiationLoc(IncLoc).first != CurFileID) {
|
SM.getDecomposedExpansionLoc(IncLoc).first != CurFileID) {
|
||||||
PP.Diag(FlagTok, diag::err_pp_linemarker_invalid_pop);
|
PP.Diag(FlagTok, diag::err_pp_linemarker_invalid_pop);
|
||||||
PP.DiscardUntilEndOfDirective();
|
PP.DiscardUntilEndOfDirective();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -324,7 +324,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter& R, FileID BugFileID,
|
||||||
|
|
||||||
SourceManager &SM = R.getSourceMgr();
|
SourceManager &SM = R.getSourceMgr();
|
||||||
assert(&Pos.getManager() == &SM && "SourceManagers are different!");
|
assert(&Pos.getManager() == &SM && "SourceManagers are different!");
|
||||||
std::pair<FileID, unsigned> LPosInfo = SM.getDecomposedInstantiationLoc(Pos);
|
std::pair<FileID, unsigned> LPosInfo = SM.getDecomposedExpansionLoc(Pos);
|
||||||
|
|
||||||
if (LPosInfo.first != BugFileID)
|
if (LPosInfo.first != BugFileID)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -439,7 +439,7 @@ bool CursorVisitor::visitPreprocessedEntitiesInRegion() {
|
||||||
// FIXME: My kingdom for a proper binary search approach to finding
|
// FIXME: My kingdom for a proper binary search approach to finding
|
||||||
// cursors!
|
// cursors!
|
||||||
std::pair<FileID, unsigned> Location
|
std::pair<FileID, unsigned> Location
|
||||||
= AU->getSourceManager().getDecomposedInstantiationLoc(
|
= AU->getSourceManager().getDecomposedExpansionLoc(
|
||||||
RegionOfInterest.getBegin());
|
RegionOfInterest.getBegin());
|
||||||
if (Location.first != AU->getSourceManager().getMainFileID())
|
if (Location.first != AU->getSourceManager().getMainFileID())
|
||||||
OnlyLocalDecls = false;
|
OnlyLocalDecls = false;
|
||||||
|
@ -463,9 +463,9 @@ bool CursorVisitor::visitPreprocessedEntitiesInRegion(InputIterator First,
|
||||||
// Find the file in which the region of interest lands.
|
// Find the file in which the region of interest lands.
|
||||||
SourceManager &SM = AU->getSourceManager();
|
SourceManager &SM = AU->getSourceManager();
|
||||||
std::pair<FileID, unsigned> Begin
|
std::pair<FileID, unsigned> Begin
|
||||||
= SM.getDecomposedInstantiationLoc(RegionOfInterest.getBegin());
|
= SM.getDecomposedExpansionLoc(RegionOfInterest.getBegin());
|
||||||
std::pair<FileID, unsigned> End
|
std::pair<FileID, unsigned> End
|
||||||
= SM.getDecomposedInstantiationLoc(RegionOfInterest.getEnd());
|
= SM.getDecomposedExpansionLoc(RegionOfInterest.getEnd());
|
||||||
|
|
||||||
// The region of interest spans files; we have to walk everything.
|
// The region of interest spans files; we have to walk everything.
|
||||||
if (Begin.first != End.first)
|
if (Begin.first != End.first)
|
||||||
|
@ -477,8 +477,7 @@ bool CursorVisitor::visitPreprocessedEntitiesInRegion(InputIterator First,
|
||||||
// Build the mapping from files to sets of preprocessed entities.
|
// Build the mapping from files to sets of preprocessed entities.
|
||||||
for (; First != Last; ++First) {
|
for (; First != Last; ++First) {
|
||||||
std::pair<FileID, unsigned> P
|
std::pair<FileID, unsigned> P
|
||||||
= SM.getDecomposedInstantiationLoc(
|
= SM.getDecomposedExpansionLoc((*First)->getSourceRange().getBegin());
|
||||||
(*First)->getSourceRange().getBegin());
|
|
||||||
|
|
||||||
ByFileMap[P.first].push_back(*First);
|
ByFileMap[P.first].push_back(*First);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue