Szelethus added inline comments.

================
Comment at: 
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp:126-127
   if (V.isUndef()) {
+    assert(!FR->getDecl()->getType()->isReferenceType() &&
+           "References must be initialized!");
     return addFieldToUninits(
----------------
NoQ wrote:
> Good catch.
> 
> It might still be possible to initialize a reference with an 
> already-undefined pointer if core checkers are turned off, but we don't 
> support turning them off, so i guess it's fine.
I removed it, because it did crash couple times on LLVM. Note that the assert 
checked whether the reference for undefined, not uninitialized :/.

It's no longer in the code, but this was it:
```
assert(!FR->getDecl()->getType()->isReferenceType() &&
       "References must be initialized!");
```


================
Comment at: test/Analysis/cxx-uninitialized-object.cpp:879-902
+struct LambdaWrapper {
+  void *func; // no-crash
+  int dontGetFilteredByNonPedanticMode = 0;
+
+  LambdaWrapper(void *ptr) : func(ptr) {} // expected-warning{{1 uninitialized 
field}}
+};
+
----------------
I'm 99% sure this is a FP, but it doesn't originate from the checker. Shouldn't 
`*ptr` be undef after the end of the code block as `lambda`'s lifetime ends?

Nevertheless, it did cause a crash, so here's a quick fix for it.


https://reviews.llvm.org/D51057



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to