summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-22 18:03:00 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-22 18:03:00 +0000
commit22579c4c8fd37d71ab876ffce643b34702d6cb0d (patch)
tree288580c1af553f4aa1801a304d308bcdaef60cdf /clang
parente4f25b706b564df9324f211bf7bf2ca1927e6fe6 (diff)
downloadbcm5719-llvm-22579c4c8fd37d71ab876ffce643b34702d6cb0d.tar.gz
bcm5719-llvm-22579c4c8fd37d71ab876ffce643b34702d6cb0d.zip
PathDiagnosticLocation: ranges for terminators now only include the first
character instead of the entire range for the IfStmt, ForStmt, etc. We may gradually refine these ranges later, but basically terminator ranges just refer to the first keyword. llvm-svn: 69812
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Analysis/PathDiagnostic.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index 1d00727d0a2..fa075a39595 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -166,8 +166,29 @@ SourceRange PathDiagnosticLocation::asRange() const {
case SingleLocK:
case RangeK:
break;
- case StmtK:
+ case StmtK: {
+ const Stmt *S = asStmt();
+ switch (S->getStmtClass()) {
+ default:
+ break;
+ // FIXME: Provide better range information for different
+ // terminators.
+ case Stmt::IfStmtClass:
+ case Stmt::WhileStmtClass:
+ case Stmt::DoStmtClass:
+ case Stmt::ForStmtClass:
+ case Stmt::ChooseExprClass:
+ case Stmt::IndirectGotoStmtClass:
+ case Stmt::SwitchStmtClass:
+ case Stmt::ConditionalOperatorClass:
+ case Stmt::ObjCForCollectionStmtClass: {
+ SourceLocation L = S->getLocStart();
+ return SourceRange(L, L);
+ }
+ }
+
return S->getSourceRange();
+ }
case DeclK:
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D))
return MD->getSourceRange();
OpenPOWER on IntegriCloud