[PATCH] D37235: Let -Wdelete-non-virtual-dtor fire in system headers too.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 28 16:24:38 PDT 2017


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

(if you'd prefer to wait for Reid or Richard to take a look, that's OK too :) )

Looks good to me, though wouldn't mind if the tests were a bit simpler - if they can be made so.



================
Comment at: test/SemaCXX/destructor.cpp:3-28
+
+#if defined(BE_THE_HEADER)
+
+// Wdelete-non-virtual-dtor should warn about the delete from smart pointer
+// classes in system headers (std::unique_ptr...) too.
+
+#pragma clang system_header
----------------
Could this be simpler?

For example would it work to put this test at the end of the file, something like:

  struct foo { virtual void f(); };
  #pragma clang system_header
  void f(foo *p) { delete p; }


https://reviews.llvm.org/D37235





More information about the cfe-commits mailing list