fix a negated conditional in getDecomposedInstantiationLocSlowCase,

which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.

llvm-svn: 63030
This commit is contained in:
Chris Lattner 2009-01-26 19:41:58 +00:00
parent 9892ea2fbb
commit 31af4e08d1
1 changed files with 13 additions and 7 deletions

View File

@ -341,7 +341,7 @@ SourceManager::getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E,
FID = getFileID(Loc);
E = &getSLocEntry(FID);
Offset += Loc.getOffset()-E->getOffset();
} while (Loc.isFileID());
} while (!Loc.isFileID());
return std::make_pair(FID, Offset);
}
@ -349,12 +349,18 @@ SourceManager::getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E,
std::pair<FileID, unsigned>
SourceManager::getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry *E,
unsigned Offset) const {
// If this is an instantiation record, get and return the spelling.
SourceLocation Loc = E->getInstantiation().getSpellingLoc();
FileID FID = getFileID(Loc);
E = &getSLocEntry(FID);
Offset += Loc.getOffset()-E->getOffset();
assert(Loc.isFileID() && "Should only have one spelling link");
// If this is an instantiation record, walk through all the instantiation
// points.
FileID FID;
SourceLocation Loc;
do {
Loc = E->getInstantiation().getSpellingLoc();
FID = getFileID(Loc);
E = &getSLocEntry(FID);
Offset += Loc.getOffset()-E->getOffset();
} while (!Loc.isFileID());
return std::make_pair(FID, Offset);
}