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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 21:18:07 PDT 2020


rjmccall added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:677
+      E->getType().isDestructedType() == QualType::DK_nontrivial_c_struct)
+    Cleanup.setExprNeedsCleanups(true);
+
----------------
Why only when the l-value is volatile?


================
Comment at: clang/lib/Sema/SemaExpr.cpp:5733
+      QualType::DK_nontrivial_c_struct)
+    Cleanup.setExprNeedsCleanups(true);
+
----------------
You should do this in `MaybeBindToTemporary`, and then you probably don't need it in most of these other places.


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