summaryrefslogtreecommitdiffstats
path: root/clang/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
commit7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da (patch)
treeae9b60641a6fc0cc884a79d8efaa939c3869497e /clang/lib/Basic/SourceManager.cpp
parente4549866175a8c2bef551fc7f1d4d7a643df26eb (diff)
downloadbcm5719-llvm-7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da.tar.gz
bcm5719-llvm-7f6b029c4e038ff7719d5ea1354ee4c5cae9d9da.zip
Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments. llvm-svn: 141771
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index a540f3b9450..364663ee326 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/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(
OpenPOWER on IntegriCloud