[cfe-commits] r71831 - /cfe/trunk/lib/Analysis/PathDiagnostic.cpp

Ted Kremenek kremenek at apple.com
Thu May 14 19:05:25 PDT 2009


Author: kremenek
Date: Thu May 14 21:05:25 2009
New Revision: 71831

URL: http://llvm.org/viewvc/llvm-project?rev=71831&view=rev
Log:
PathDiagnosticLocation::asRange(): for a PathDiagnosticLocation, the range of a DeclStmt is only the decl, not
the decl + initializer.

Modified:
    cfe/trunk/lib/Analysis/PathDiagnostic.cpp

Modified: cfe/trunk/lib/Analysis/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PathDiagnostic.cpp?rev=71831&r1=71830&r2=71831&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/Analysis/PathDiagnostic.cpp Thu May 14 21:05:25 2009
@@ -173,6 +173,15 @@
       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:





More information about the cfe-commits mailing list