Simplify logic to use SourceManager::getFileLoc(), per Argyrios's feedback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170487 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp
index 88a8706..d540964 100644
--- a/lib/Frontend/DiagnosticRenderer.cpp
+++ b/lib/Frontend/DiagnosticRenderer.cpp
@@ -153,10 +153,8 @@
SourceLocation UnexpandedLoc = Loc;
- // Perform the same walk as emitMacroExpansions, to find the ultimate
- // expansion location for the diagnostic.
- while (Loc.isMacroID())
- Loc = SM->getImmediateMacroCallerLoc(Loc);
+ // Find the ultimate expansion location for the diagnostic.
+ Loc = SM->getFileLoc(Loc);
PresumedLoc PLoc = SM->getPresumedLoc(Loc, DiagOpts->ShowPresumedLoc);