[PATCH] D64464: [CodeGen] Emit destructor calls for non-trivial C structs

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 17:56:12 PDT 2019


ahatanak updated this revision to Diff 212942.
ahatanak marked 2 inline comments as done.
ahatanak added a comment.
Herald added a reviewer: martong.
Herald added a reviewer: shafik.

- Emit member access, compound literal, and call expressions as subexpressions of `ExprWithCleanups` if the expressions are of C struct types that require non-trivial destruction. This fixes the bug in IRGen where it was destructing the function return at the end of the enclosing scope rather than at the end of the full expression (see the changes made in test/CodeGenObjC/arc.m).
- Add compound literal expressions with automatic storage duration to the list of cleanup objects of `ExprWithCleanups` if the expressions have C struct types requiring non-trivial destruction. This enables IRGen to destruct the compound literals at the end of their enclosing scopes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D64464

Files:
  include/clang/AST/ASTImporter.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/TextNodeDumper.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTImporter.cpp
  lib/AST/JSONNodeDumper.cpp
  lib/AST/TextNodeDumper.cpp
  lib/CodeGen/CGBlocks.cpp
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/JumpDiagnostics.cpp
  lib/Sema/SemaExpr.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/AST/ast-dump-objc-arc-json.m
  test/AST/ast-dump-stmt.m
  test/CodeGenObjC/arc.m
  test/CodeGenObjC/strong-in-c-struct.m
  test/Import/objc-arc/Inputs/cleanup-objects.m
  test/Import/objc-arc/test-cleanup-object.m
  test/PCH/non-trivial-c-compound-literal.m
  test/SemaObjC/strong-in-c-struct.m
  tools/clang-import-test/clang-import-test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64464.212942.patch
Type: text/x-patch
Size: 34510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190802/86a73f78/attachment-0001.bin>


More information about the cfe-commits mailing list