[cfe-commits] r124212 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp test/Analysis/blocks.m

Ted Kremenek kremenek at apple.com
Tue Jan 25 11:13:43 PST 2011


Author: kremenek
Date: Tue Jan 25 13:13:42 2011
New Revision: 124212

URL: http://llvm.org/viewvc/llvm-project?rev=124212&view=rev
Log:
Tweak wording of static analyzer diagnostic
for a block capturing the value of an uninitialized
variable.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
    cfe/trunk/test/Analysis/blocks.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp?rev=124212&r1=124211&r2=124212&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp Tue Jan 25 13:13:42 2011
@@ -82,14 +82,14 @@
     if (state->getSVal(VR).isUndef())
       if (ExplodedNode *N = C.generateSink()) {
         if (!BT)
-          BT = new BuiltinBug("Captured block variable is uninitialized");
+          BT = new BuiltinBug("uninitialized variable captured by block");
 
         // Generate a bug report.
         llvm::SmallString<128> buf;
         llvm::raw_svector_ostream os(buf);
 
-        os << "Variable '" << VD->getName() << "' is captured by block with "
-              "a garbage value";
+        os << "Variable '" << VD->getName() 
+           << "' is uninitialized when captured by block";
 
         EnhancedBugReport *R = new EnhancedBugReport(*BT, os.str(), N);
         if (const Expr *Ex = FindBlockDeclRefExpr(BE->getBody(), VD))

Modified: cfe/trunk/test/Analysis/blocks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/blocks.m?rev=124212&r1=124211&r2=124212&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/blocks.m (original)
+++ cfe/trunk/test/Analysis/blocks.m Tue Jan 25 13:13:42 2011
@@ -73,7 +73,7 @@
 void test2() {
   static int y = 0;
   int x;
-  ^{ y = x + 1; }();  // expected-warning{{Variable 'x' is captured by block with a garbage value}}
+  ^{ y = x + 1; }();  // expected-warning{{Variable 'x' is uninitialized when captured by block}}
 }
 
 void test2_b() {
@@ -86,5 +86,5 @@
 
 void test2_c() {
   typedef void (^myblock)(void);
-  myblock f = ^() { f(); }; // expected-warning{{Variable 'f' is captured by block with a garbage value}}
+  myblock f = ^() { f(); }; // expected-warning{{Variable 'f' is uninitialized when captured by block}}
 }
\ No newline at end of file





More information about the cfe-commits mailing list