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

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 16:16:07 PDT 2022


vitalybuka accepted this revision.
vitalybuka added a comment.
Herald added a project: All.

@eugenis I will prepare google3 and land it?



================
Comment at: clang/lib/CodeGen/CGClass.cpp:1872
 
       // Ignore trivial destructors.
+      if (BaseClassDecl->hasTrivialDestructor()) {
----------------
kda wrote:
> Maybe not "Ignore"?
@kda I assume it's about inconsistent comment about?



================
Comment at: compiler-rt/test/msan/dtor-base-access.cpp:36
 
+Derived *g;
+
----------------
kda wrote:
> maybe in good faith '= nullptr'?
according standard declarations like this are always zero initialized already


================
Comment at: compiler-rt/test/msan/dtor-base-access.cpp:63
+
+  g->~Derived();
+  // not ok to access everything
----------------
kda wrote:
> Is calling destructor preferred to 'delete g'?  Seems like 'delete' would be obvious inversion of 'new' on line 56.
after delete we can't do asserts below, which are the goal


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