llvm-6502/lib/Transforms/ObjCARC
Michael Gottesman 72196ab082 [objc-arc] Turn off the objc_retainBlock -> objc_retain optimization.
The reason that I am turning off this optimization is that there is an
additional case where a block can escape that has come up. Specifically, this
occurs when a block is used in a scope outside of its current scope.

This can cause a captured retainable object pointer whose life is preserved by
the objc_retainBlock to be deallocated before the block is invoked.

An example of the code needed to trigger the bug is:

----
\#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
  void (^somethingToDoLater)();

  {
    NSObject *obj = [NSObject new];

    somethingToDoLater = ^{
      [obj self]; // Crashes here
    };
  }

  NSLog(@"test.");

  somethingToDoLater();
  return 0;
}
----

In the next commit, I remove all the dead code that results from this.

Once I put in the fixing commit I will bring back the tests that I deleted in
this commit.

rdar://14802782.
rdar://14868830.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189869 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-03 22:40:54 +00:00
..
ARCRuntimeEntryPoints.h [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
CMakeLists.txt Extracted ObjCARCContract from ObjCARCOpts into its own file. 2013-01-29 03:03:03 +00:00
DependencyAnalysis.cpp Kill every call to @clang.arc.use in the ARC contract phase. 2013-03-22 21:38:36 +00:00
DependencyAnalysis.h [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
LLVMBuild.txt Added missing dashes from header declaration comment. 2013-01-29 04:53:55 +00:00
Makefile
ObjCARC.cpp This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
ObjCARC.h [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
ObjCARCAliasAnalysis.cpp [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
ObjCARCAliasAnalysis.h [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
ObjCARCAPElim.cpp Hopefully fix the Windows build failure introduced in r173769 2013-01-29 09:09:27 +00:00
ObjCARCContract.cpp [objc-arc] Updated ObjCARCContract to use ARCRuntimeEntryPoints. 2013-07-06 01:39:26 +00:00
ObjCARCExpand.cpp Sorted includes using utils/sort_includes. 2013-01-29 04:20:52 +00:00
ObjCARCOpts.cpp [objc-arc] Turn off the objc_retainBlock -> objc_retain optimization. 2013-09-03 22:40:54 +00:00
ObjCARCUtil.cpp [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00
ProvenanceAnalysis.cpp Changed isStoredObjCPointer => IsStoredObjCPointer. No functionality change. 2013-02-12 23:35:08 +00:00
ProvenanceAnalysis.h [objc-arc] Changed 'mode: c++' => 'C++' at Nick Lewycky's suggestion. Also removed unnecessary mode: c++ lines from .cpp files. 2013-07-10 18:49:00 +00:00