[PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 3 15:12:35 PDT 2015


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

LGTM with a couple of tweaks.


================
Comment at: lib/CodeGen/CGCXX.cpp:45-46
@@ +44,4 @@
+  //  an alias, unless this class owns no members.
+  unsigned totalFields =
+      std::distance(D->getParent()->field_begin(), D->getParent()->field_end());
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor && totalFields > 0)
----------------
You can just use `!D->getParent()->field_empty()`

================
Comment at: lib/CodeGen/CGClass.cpp:1289
@@ -1288,7 +1288,3 @@
 
-static bool
-FieldHasTrivialDestructorBody(ASTContext &Context, const FieldDecl *Field);
-
-static bool
-HasTrivialDestructorBody(ASTContext &Context,
+bool CodeGenModule::HasTrivialDestructorBody(ASTContext &Context,
                          const CXXRecordDecl *BaseClassDecl,
----------------
I think you no longer need to make these functions members.


http://reviews.llvm.org/D12022





More information about the cfe-commits mailing list