[PATCH] D66094: [CodeGen] Emit destructor calls for non-trivial C structs returned by function calls and loaded from volatile objects

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 16:14:00 PDT 2020


ahatanak added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:677
+      E->getType().isDestructedType() == QualType::DK_nontrivial_c_struct)
+    Cleanup.setExprNeedsCleanups(true);
+
----------------
rjmccall wrote:
> Why only when the l-value is volatile?
I was trying to avoid emitting `ExprWithCleanups` when it wasn't needed and it seemed that it wasn't needed for non-volatile types. I'm not sure it's important, so I've removed the check for volatile. Also, `ExprWithCleanups` shouldn't' be emitted when this is in file scope, so I fixed that too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66094





More information about the cfe-commits mailing list