[PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

Evgeniy Stepanov via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 16:59:08 PDT 2015


eugenis added inline comments.

================
Comment at: lib/CodeGen/CGCXX.cpp:45
@@ +44,3 @@
+  // destructors.
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor)
+    return true;
----------------
This simply suppresses all dtor alias under UseAfterDtor, effectively disabling the second check below.
Remove it.

================
Comment at: lib/CodeGen/CGCXX.cpp:130
@@ -115,3 +129,3 @@
                                              bool InEveryTU) {
-  if (!getCodeGenOpts().CXXCtorDtorAliases)
+  if(!getCodeGenOpts().CXXCtorDtorAliases)
     return true;
----------------
formatting

================
Comment at: lib/CodeGen/CGCXX.cpp:147
@@ +146,3 @@
+  // If sanitizing memory to check for use-after-dtor, do not emit as
+  //  an alias, unless this class owns no members.
+  const CXXMethodDecl *MD =
----------------
... with trivial destructors

================
Comment at: lib/CodeGen/CGClass.cpp:1547
@@ +1546,3 @@
+      // Nothing to poison.
+      if (Layout.getFieldCount() == 0)
+        return;
----------------
Probably better check Dtor->getParent()->field_empty() for consistency.

================
Comment at: lib/CodeGen/CGClass.cpp:1551
@@ +1550,3 @@
+      // Prevent the current stack frame from disappearing from the stack trace.
+      CGF.CurFn->addFnAttr("disable-tail-calls", "true");
+
----------------
disable tail calls only when !field_empty()


http://reviews.llvm.org/D12022





More information about the cfe-commits mailing list