diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-26 19:41:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-26 19:41:58 +0000 |
commit | 31af4e08d1f3565ead6e069508872f7cca04f531 (patch) | |
tree | 095ebc655af19d132ddf3d2d572416bd6f88f893 /clang/lib/Basic/SourceManager.cpp | |
parent | 9892ea2fbb47dba59daa21d3cfcf32eb10e99ee9 (diff) | |
download | bcm5719-llvm-31af4e08d1f3565ead6e069508872f7cca04f531.tar.gz bcm5719-llvm-31af4e08d1f3565ead6e069508872f7cca04f531.zip |
fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.
llvm-svn: 63030
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 42e6040b746..031bf4dcbcc 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -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); } |