[PATCH] D34275: [analyzer] Re-implemente current virtual calls checker in a path-sensitive way

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 00:09:50 PDT 2017


NoQ added a comment.

Thanks, works now! Apart from the minor comment on the hanging header file in the tests, this looks good and i have no further nits :)

//*summons @dcoughlin to have a look at English in the warning messages*//



================
Comment at: test/Analysis/virtualcall.cpp:15-21
+#if PUREONLY
+	// expected-warning-re at -2 {{{{^}}Call to pure virtual function during construction}}
+	// expected-note-re at -3 {{{{^}}Call to pure virtual function during construction}}
+#else 
+	// expected-warning-re at -5 {{{{^}}Call to virtual function during construction}}
+	// expected-note-re at -6 {{{{^}}Call to virtual function during construction}}
 #endif
----------------
I think it might be worth it to highlight that the function is pure virtual even in non-pure-only mode (if you have time for that).


================
Comment at: test/Analysis/virtualcall.cpp:137-141
-#include "virtualcall.h"
+class Y {
+public:
+  virtual void foobar();
+  void fooY() {
+    F f1;
+    foobar(); 
+#if !PUREONLY
+  	// expected-warning-re at -2 {{{{^}}Call to virtual function during construction}}
+  	// expected-note-re at -3 {{{{^}}Call to virtual function during construction}}
+#endif
+  }
+  Y() { fooY(); }
+#if !PUREONLY
+  	// expected-note-re at -2 {{{{^}}This constructor of an object of type 'Y' has not returned when the virtual method was called}}
+  	// expected-note-re at -3 {{{{^}}Calling 'Y::fooY'}}
+#endif
+};
 
-#define AS_SYSTEM
-#include "virtualcall.h"
-#undef AS_SYSTEM
----------------
There used to be a test case in this header; we should restore the test or remove the file if it's no longer relevant.


https://reviews.llvm.org/D34275





More information about the cfe-commits mailing list