- Implement PathDiagnosticLocation::asLocation.
- Switch PathDiagnosticEventPiece and PathDiagnosticMacroPiece to use
PathDiagnosticLocation.
llvm-svn: 67774
diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index 0ccb900..940a9e2 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Analysis/PathDiagnostic.h"
+#include "clang/AST/Expr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Casting.h"
#include <sstream>
@@ -133,3 +134,17 @@
HandlePathDiagnostic(D);
}
+
+//===----------------------------------------------------------------------===//
+// PathDiagnosticLocation methods.
+//===----------------------------------------------------------------------===//
+
+FullSourceLoc PathDiagnosticLocation::asLocation() const {
+ switch (K) {
+ case SingleLoc:
+ case Range:
+ return FullSourceLoc(R.getBegin(), const_cast<SourceManager&>(SM));
+ case Statement:
+ return FullSourceLoc(S->getLocStart(), const_cast<SourceManager&>(SM));
+ }
+}