Introduce SourceManager::getFileLoc which returns a file location
taking into account macro arguments.
llvm-svn: 141771
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index a540f3b..364663ee 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -815,6 +815,16 @@
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(