aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-26 20:04:19 +0000
committerChris Lattner <sabre@nondot.org>2009-01-26 20:04:19 +0000
commit659ac5f08775966b6c24eac74dbf5f8bc4628869 (patch)
treea9f4d615160fdab9ecc43db7813c506339898717 /clang/lib/Basic/SourceManager.cpp
parenta7bc8473a3837fc7552452973c191721d8eb5d5a (diff)
downloadllvm-659ac5f08775966b6c24eac74dbf5f8bc4628869.zip
llvm-659ac5f08775966b6c24eac74dbf5f8bc4628869.tar.gz
llvm-659ac5f08775966b6c24eac74dbf5f8bc4628869.tar.bz2
make getInstantiationLoc and getSpellingLoc handle multiply instantiated
locations, and move the slow case out of line. No perf change on cocoa.h llvm-svn: 63033
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 031bf4d..f9f51af 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -328,6 +328,27 @@ FileID SourceManager::getFileIDSlow(unsigned SLocOffset) const {
}
}
+SourceLocation SourceManager::
+getInstantiationLocSlowCase(SourceLocation Loc) const {
+ do {
+ std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
+ Loc =getSLocEntry(LocInfo.first).getInstantiation().getInstantiationLoc();
+ Loc = Loc.getFileLocWithOffset(LocInfo.second);
+ } 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 = Loc.getFileLocWithOffset(LocInfo.second);
+ } while (!Loc.isFileID());
+ return Loc;
+}
+
+
std::pair<FileID, unsigned>
SourceManager::getDecomposedInstantiationLocSlowCase(const SrcMgr::SLocEntry *E,
unsigned Offset) const {