diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-15 02:05:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-15 02:05:25 +0000 |
commit | 1e63c29a2d9752f804d2b05015018d715a79525f (patch) | |
tree | 8fc3cfde26a9d75d1b038489b4421eb87aed70dd /lib/Analysis/PathDiagnostic.cpp | |
parent | ddb7babf448822e0f8da07fdf9446cf515d04ad5 (diff) |
PathDiagnosticLocation::asRange(): for a PathDiagnosticLocation, the range of a DeclStmt is only the decl, not
the decl + initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PathDiagnostic.cpp')
-rw-r--r-- | lib/Analysis/PathDiagnostic.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp index 1a4af471f5..ec96329852 100644 --- a/lib/Analysis/PathDiagnostic.cpp +++ b/lib/Analysis/PathDiagnostic.cpp @@ -173,6 +173,15 @@ PathDiagnosticRange PathDiagnosticLocation::asRange() const { switch (S->getStmtClass()) { default: break; + case Stmt::DeclStmtClass: { + const DeclStmt *DS = cast<DeclStmt>(S); + if (DS->isSingleDecl()) { + // Should always be the case, but we'll be defensive. + return SourceRange(DS->getLocStart(), + DS->getSingleDecl()->getLocation()); + } + break; + } // FIXME: Provide better range information for different // terminators. case Stmt::IfStmtClass: |