[PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

Naomi Musgrave via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 16:38:59 PDT 2015


nmusgrave added inline comments.

================
Comment at: lib/CodeGen/CGCXX.cpp:41
@@ +40,3 @@
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor && Layout.getFieldCount() > 0
+      && HasTrivialDestructorBody(Context, D->getParent(), D->getParent())) {
+        return true;
----------------
nmusgrave wrote:
> eugenis wrote:
> > I'm not sure this is correct. It says not to use an alias if D has trivial body. Should not it be the other way around?
> It's counter-intuitive:
> TryEmitBaseDestructorAsAlias returns false when TryEmitDefinitionAsAlias returns false.
> TryEmitDefinitionAsAlias returns false when an alias is successfully created (line 216 in this CL)
For example: line 3711 of clang/lib/CodeGen/MicrosoftCXXABI.cpp
 bool ProducedAlias = !CGM.TryEmitDefinitionAsAlias(
    GlobalDecl(dtor, Dtor_Complete), GlobalDecl(dtor, Dtor_Base), true); 

^uses the negation of the function's return value


http://reviews.llvm.org/D12022





More information about the cfe-commits mailing list