aboutsummaryrefslogtreecommitdiff
path: root/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
commitaddb797ca2b5afc1a1e82fd8d5d6eb2a592e75a9 (patch)
tree21e8163c516d0e79395f85f494744ed47c940f71 /lib/Basic/SourceManager.cpp
parent9e5e4aaf8b8835b552819d68d29b6d94115d8a0b (diff)
make getInstantiationLoc and getSpellingLoc handle multiply instantiated
locations, and move the slow case out of line. No perf change on cocoa.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 031bf4dcbc..f9f51afef8 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/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 {