]> granicus.if.org Git - clang/commitdiff
When not emitting path diagnostics in BugReporter::EmitWarning(), use the
authorTed Kremenek <kremenek@apple.com>
Thu, 10 Apr 2008 16:12:38 +0000 (16:12 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 10 Apr 2008 16:12:38 +0000 (16:12 +0000)
BugReport-specific SourceRanges (when available).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49486 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BugReporter.cpp
utils/ccc-analyzer

index c851696a301d98267c9ea27aef23db3fe79d2587..0f7b2359444db652a2d4a7bb032fef65d2f16d5d 100644 (file)
@@ -358,8 +358,18 @@ void BugReporter::EmitWarning(BugReport& R, ExplodedNode<ValueState>* N) {
   if (!S)
     return;
   
-  SourceRange Range = S->getSourceRange();
+  const SourceRange *Beg, *End;
+  R.getRanges(Beg, End);
+  
+  if (Beg == End) {
+    SourceRange Range = S->getSourceRange();
+    
+    Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
+                ErrorDiag, NULL, 0, &Range, 1);   
+    
+  }
+  else
+    Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
+                ErrorDiag, NULL, 0, Beg, End - Beg);
   
-  Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()),
-              ErrorDiag, NULL, 0, &Range, 1);   
 }
index 038032f2dc3b160e69b582ead85186d06ce82ff1..23a6d6a857ca2a4b1c4bc6d5ee028114fcbcf641 100755 (executable)
@@ -74,7 +74,7 @@ def analyze(args,language,output,files,verbose,htmldir):
       command = 'cp'.split()
       args = command + files + target.split()      
     else:
-      command = 'clang --grsimple'.split()
+      command = 'clang -check-cfref'.split()
       args = command + args;
       
       if htmldir is not None: