[PATCH] D119300: Use-after-dtor detection for trivial base classes.

Kevin Athey via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 12:14:57 PST 2022


kda added inline comments.


================
Comment at: clang/lib/CodeGen/CGClass.cpp:1872
 
       // Ignore trivial destructors.
+      if (BaseClassDecl->hasTrivialDestructor()) {
----------------
Maybe not "Ignore"?


================
Comment at: clang/lib/CodeGen/CGClass.cpp:1907
 
     // Ignore trivial destructors.
+    if (BaseClassDecl->hasTrivialDestructor()) {
----------------
not "ignore".


================
Comment at: compiler-rt/test/msan/dtor-base-access.cpp:11
 class Base {
  public:
+   int b;
----------------
nit: inconsistent indent with line 18.


================
Comment at: compiler-rt/test/msan/dtor-base-access.cpp:36
 
+Derived *g;
+
----------------
maybe in good faith '= nullptr'?


================
Comment at: compiler-rt/test/msan/dtor-base-access.cpp:63
+
+  g->~Derived();
+  // not ok to access everything
----------------
Is calling destructor preferred to 'delete g'?  Seems like 'delete' would be obvious inversion of 'new' on line 56.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119300/new/

https://reviews.llvm.org/D119300



More information about the cfe-commits mailing list