r207562 - [analyzer] Improve test from r207486.

Jordan Rose jordan_rose at apple.com
Tue Apr 29 10:08:17 PDT 2014


Author: jrose
Date: Tue Apr 29 12:08:17 2014
New Revision: 207562

URL: http://llvm.org/viewvc/llvm-project?rev=207562&view=rev
Log:
[analyzer] Improve test from r207486.

The constructor that comes right before a variable declaration in the CFG might
not be the initialization of that variable. Previously, we just checked that
the variable's initializer expression was different from the construction
expression, but forgot to see whether the variable had an initializer expression
at all.

Thanks for the prompting, David.

Modified:
    cfe/trunk/test/Analysis/ctor.mm

Modified: cfe/trunk/test/Analysis/ctor.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/ctor.mm?rev=207562&r1=207561&r2=207562&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/ctor.mm (original)
+++ cfe/trunk/test/Analysis/ctor.mm Tue Apr 29 12:08:17 2014
@@ -678,17 +678,20 @@ namespace InitializerList {
 namespace PR19579 {
   class C {};
 
-  struct S {
-    C c;
-    int i;
-  };
-
   void f() {
     C();
     int a;
+
+    extern void use(int);
+    use(a); // expected-warning{{uninitialized}}
   }
 
   void g() {
+    struct S {
+      C c;
+      int i;
+    };
+    
     // This order triggers the initialization of the inner "a" after the
     // constructor for "C" is run, which used to confuse the analyzer
     // (is "C()" the initialization of "a"?).





More information about the cfe-commits mailing list