[llvm-branch-commits] [cfe-branch] r71862 - /cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp

Mike Stump mrs at apple.com
Fri May 15 09:13:12 PDT 2009


Author: mrs
Date: Fri May 15 11:13:11 2009
New Revision: 71862

URL: http://llvm.org/viewvc/llvm-project?rev=71862&view=rev
Log:
Merge in 71831:

PathDiagnosticLocation::asRange(): for a PathDiagnosticLocation, the range of a DeclStmt is only the decl, not
the decl + initializer.

Modified:
    cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp

Modified: cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp?rev=71862&r1=71861&r2=71862&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/PathDiagnostic.cpp Fri May 15 11:13:11 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 llvm-branch-commits mailing list