[cfe-commits] r63030 - /cfe/trunk/lib/Basic/SourceManager.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 26 11:41:59 PST 2009
Author: lattner
Date: Mon Jan 26 13:41:58 2009
New Revision: 63030
URL: http://llvm.org/viewvc/llvm-project?rev=63030&view=rev
Log:
fix a negated conditional in getDecomposedInstantiationLocSlowCase,
which I think is rdar://6527005, and make getDecomposedSpellingLocSlowCase
handle nested spelling locations.
Modified:
cfe/trunk/lib/Basic/SourceManager.cpp
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=63030&r1=63029&r2=63030&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Jan 26 13:41:58 2009
@@ -341,7 +341,7 @@
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 @@
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);
}
More information about the cfe-commits
mailing list