aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-12 07:07:40 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-12 07:07:40 +0000
commit796dbfb6c43336f58c026137c438e53eadc381f7 (patch)
tree829f4eaa5e22ed5f76cd80f103556ee7309d9d5c /lib/Basic/SourceManager.cpp
parentb6a4ac41353476ed771d02ae6a96c2663625ffcd (diff)
Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/SourceManager.cpp')
-rw-r--r--lib/Basic/SourceManager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index a540f3b945..364663ee32 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -815,6 +815,16 @@ SourceLocation SourceManager::getSpellingLocSlowCase(SourceLocation Loc) const {
return Loc;
}
+SourceLocation SourceManager::getFileLocSlowCase(SourceLocation Loc) const {
+ do {
+ if (isMacroArgExpansion(Loc))
+ Loc = getImmediateSpellingLoc(Loc);
+ else
+ Loc = getImmediateExpansionRange(Loc).first;
+ } while (!Loc.isFileID());
+ return Loc;
+}
+
std::pair<FileID, unsigned>
SourceManager::getDecomposedExpansionLocSlowCase(