aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PathDiagnostic.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-26 21:39:39 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-26 21:39:39 +0000
commit97b40036d4d4d1bf4e7be71fc2bce009de4e8c0c (patch)
treed2f2d461d2dac6eb923cd8931b483c48d9d91baf /lib/Analysis/PathDiagnostic.cpp
parentad75653f81dece1c806e9c28dd7e7582c9929a27 (diff)
- Implement PathDiagnosticLocation::asLocation.
- Switch PathDiagnosticEventPiece and PathDiagnosticMacroPiece to use PathDiagnosticLocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PathDiagnostic.cpp')
-rw-r--r--lib/Analysis/PathDiagnostic.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp
index 0ccb900645..940a9e2d98 100644
--- a/lib/Analysis/PathDiagnostic.cpp
+++ b/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 @@ void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
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));
+ }
+}