This repository has been archived by the owner on Mar 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor][Extract] Correctly emit the return type for functions to
account for block extractions and copy blocks when extracting without ARC (cherry picked from commit 0405317) rdar://35578265
- Loading branch information
Showing
5 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: clang-refactor-test perform -action extract -selected=%s:16:27-18:4 %s -fobjc-arc | FileCheck %s | ||
// RUN: clang-refactor-test perform -action extract -selected=%s:16:27-18:4 %s | FileCheck --check-prefix=NOARC %s | ||
@interface I | ||
|
||
@end | ||
|
||
@implementation I | ||
|
||
- (void) doStuff: (int)x block: (void (^)(int))block { | ||
|
||
} | ||
|
||
- (void)foo {} | ||
|
||
- (void)viewDidLoad { | ||
[self doStuff: 2 block: ^(int returnCode) { | ||
[self foo]; | ||
}]; | ||
} | ||
// CHECK: "static void (^extracted(I *object))(int) {\nreturn ^(int returnCode) {\n [object foo];\n };\n}\n\n" [[@LINE-5]]:1 -> [[@LINE-5]]:1 | ||
// CHECK: "extracted(self)" [[@LINE-5]]:27 -> [[@LINE-3]]:4 | ||
// NOARC: "static void (^extracted(I *object))(int) {\nreturn [(^(int returnCode) {\n [object foo];\n }) copy];\n}\n\n" [[@LINE-7]]:1 -> [[@LINE-7]]:1 | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters