]> granicus.if.org Git - clang/commit
Distinguish `__block` variables that are captured by escaping blocks
authorAkira Hatanaka <ahatanaka@apple.com>
Sat, 8 Sep 2018 20:03:00 +0000 (20:03 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Sat, 8 Sep 2018 20:03:00 +0000 (20:03 +0000)
commitc500c067925f3be65c645c21ff369e0f8137d0d8
tree640cd0bb22e8f38ddaef038453d3dc9cf4e63604
parentbfe49d565c4fe4c87c797bf4319e7e673ef4dbb2
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

rdar://problem/39352313

Differential Revision: https://reviews.llvm.org/D51564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341754 91177308-0d34-0410-b5e6-96231b3b80d8
30 files changed:
include/clang/AST/Decl.h
include/clang/Sema/ScopeInfo.h
lib/AST/Decl.cpp
lib/CodeGen/CGBlocks.cpp
lib/CodeGen/CGClass.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h
lib/Sema/ScopeInfo.cpp
lib/Sema/Sema.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaExpr.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriterDecl.cpp
test/CodeGen/block-byref-aggr.c
test/CodeGen/blocks-seq.c
test/CodeGen/exceptions.c
test/CodeGen/personality.c
test/CodeGenCXX/block-capture.cpp
test/CodeGenCXX/blocks.cpp
test/CodeGenCXX/debug-info-blocks.cpp
test/CodeGenCXX/noescape.cpp
test/CodeGenObjC/arc-no-arc-exceptions.m
test/CodeGenObjC/arc-unoptimized-byref-var.m
test/CodeGenObjC/blocks-1.m
test/CodeGenObjC/noescape.m
test/CodeGenObjCXX/arc-blocks.mm
test/PCH/block-helpers.cpp
test/SemaObjCXX/blocks.mm
test/SemaObjCXX/noescape.mm