Came up with two more missing tests:

  ```
  NoReturnDtor *fooArray = 0;
  delete[] fooArray; // should not call destructor, checked below
  clang_analyzer_eval(true); // expected-warning{{TRUE}}
  ```

  ```
  NoReturnDtor *p = new NoReturnDtor[2];
  delete[] p; // Calls the base destructor which aborts, checked below
  clang_analyzer_eval(true); // no warn
  ```

  The first one works, but the second one doesn't. I know our array handling is 
weak, but we should probably still understand why. Is it a CFG issue?


================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:580
@@ +579,3 @@
+  if (State->isNull(ArgVal).isConstrainedTrue()) {
+    QualType DTy = DE->getDestroyedType();
+    const CXXDestructorDecl *Dtor = DTy->getAsCXXRecordDecl()->getDestructor();
----------------
This is now missing the part that drills down to the base element. Since we 
don't care about qualifiers, we can just use getBaseElementTypeUnsafe. (No 
one's actually checking that all PostImplicitCalls have a valid decl, but they 
probably should.)


http://llvm-reviews.chandlerc.com/D1594
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to