[PATCH] D104082: [CodeGen] Don't create a fake FunctionDecl when generating block/block_byref copy/dispose helper functions

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 10 17:53:49 PDT 2021


ahatanak created this revision.
ahatanak added reviewers: rjmccall, aprantl, vsk.
ahatanak added a project: clang.
ahatanak requested review of this revision.

These fake functions were causing clang to crash when https://reviews.llvm.org/D98799 made some changes.

The line number information is no longer emitted for the `__Block_byref_object` helper functions (see clang/test/CodeGenCXX/debug-info-blocks.cpp), but I think that's okay since the line numbers were incorrect when the helper functions were shared among multiple `__block` variables. For example, the line number for `__Block_byref_object_copy_` and `__Block_byref_object_dispose_` was the line number for `__block id b` in `func0`, which was incorrect if the helper functions were called when `func1` was called.

  void (^gb)();
  
  int func0() {
    __block id b;
    gb = ^{ (void)b; };
    return 0;
  }
  
  int func1() {
    __block id b;
    gb = ^{ (void)b; };
    return 0;
  }


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104082

Files:
  clang/lib/CodeGen/CGBlocks.cpp
  clang/test/CodeGenCXX/debug-info-blocks.cpp
  clang/test/CodeGenObjC/debug-info-block-helper.m
  clang/test/CodeGenObjC/debug-info-blocks.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104082.351314.patch
Type: text/x-patch
Size: 5968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210611/febf41b4/attachment.bin>


More information about the cfe-commits mailing list