aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PathDiagnostic.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-26 21:48:17 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-26 21:48:17 +0000
commitbecf8886d10c41a4605c5e66cd806492eb8b864c (patch)
tree416434f5c82cc16821f4473003c3e6ebb88fda81 /lib/Analysis/PathDiagnostic.cpp
parentb77370289e818469250c640e1aa50b25ecffbce1 (diff)
Implement PathDiagnosticLocation::asRange() and PathDiagnosticLocation::asStmt().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67777 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 1441088e54..dd9a0a8f46 100644
--- a/lib/Analysis/PathDiagnostic.cpp
+++ b/lib/Analysis/PathDiagnostic.cpp
@@ -152,3 +152,18 @@ FullSourceLoc PathDiagnosticLocation::asLocation() const {
return FullSourceLoc(R.getBegin(), const_cast<SourceManager&>(SM));
}
+
+SourceRange PathDiagnosticLocation::asRange() const {
+ // Note that we want a 'switch' here so that the compiler can warn us in
+ // case we add more cases.
+ switch (K) {
+ case SingleLoc:
+ case Range:
+ break;
+ case Statement:
+ return S->getSourceRange();
+ }
+
+ return R;
+}
+