From 1e63c29a2d9752f804d2b05015018d715a79525f Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 15 May 2009 02:05:25 +0000 Subject: [PATCH] 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 --- lib/Analysis/PathDiagnostic.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) 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(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: -- 2.40.0