-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APINotes] Upstream the remaining API Notes fixes and tests
This upstreams the last bits of Clang API Notes functionality that is currently implemented in the Apple fork: https://github.com/apple/llvm-project/tree/next/clang/lib/APINotes
- Loading branch information
Showing
96 changed files
with
1,829 additions
and
20 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,8 @@ | ||
Name: SomeOtherKit | ||
Classes: | ||
- Name: A | ||
Methods: | ||
- Selector: "methodB" | ||
MethodKind: Instance | ||
Availability: none | ||
AvailabilityMsg: "anything but this" |
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,5 @@ | ||
Name: SomeBrokenLib | ||
Functions: | ||
- Name: do_something_with_pointers | ||
Nu llabilityOfRet: O | ||
# the space is intentional, to make sure we don't crash on malformed API Notes |
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,6 @@ | ||
#ifndef SOME_BROKEN_LIB_H | ||
#define SOME_BROKEN_LIB_H | ||
|
||
void do_something_with_pointers(int *ptr1, int *ptr2); | ||
|
||
#endif // SOME_BROKEN_LIB_H |
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,7 @@ | ||
Name: SomeBrokenLib | ||
Functions: | ||
- Name: do_something_with_pointers | ||
NullabilityOfRet: O | ||
- Name: do_something_with_pointers | ||
NullabilityOfRet: O | ||
|
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,6 @@ | ||
#ifndef SOME_BROKEN_LIB_H | ||
#define SOME_BROKEN_LIB_H | ||
|
||
void do_something_with_pointers(int *ptr1, int *ptr2); | ||
|
||
#endif // SOME_BROKEN_LIB_H |
1 change: 1 addition & 0 deletions
1
...rks/FrameworkWithActualPrivateModule.framework/Headers/FrameworkWithActualPrivateModule.h
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 @@ | ||
extern int FrameworkWithActualPrivateModule; |
5 changes: 5 additions & 0 deletions
5
...tes/Inputs/Frameworks/FrameworkWithActualPrivateModule.framework/Modules/module.modulemap
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,5 @@ | ||
framework module FrameworkWithActualPrivateModule { | ||
umbrella header "FrameworkWithActualPrivateModule.h" | ||
export * | ||
module * { export * } | ||
} |
5 changes: 5 additions & 0 deletions
5
...ts/Frameworks/FrameworkWithActualPrivateModule.framework/Modules/module.private.modulemap
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,5 @@ | ||
framework module FrameworkWithActualPrivateModule_Private { | ||
umbrella header "FrameworkWithActualPrivateModule_Private.h" | ||
export * | ||
module * { export * } | ||
} |
1 change: 1 addition & 0 deletions
1
...lPrivateModule.framework/PrivateHeaders/FrameworkWithActualPrivateModule_Private.apinotes
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 @@ | ||
Name: FrameworkWithActualPrivateModule_Private |
2 changes: 2 additions & 0 deletions
2
...thActualPrivateModule.framework/PrivateHeaders/FrameworkWithActualPrivateModule_Private.h
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,2 @@ | ||
#include <FrameworkWithActualPrivateModule/FrameworkWithActualPrivateModule.h> | ||
extern int FrameworkWithActualPrivateModule_Private; |
1 change: 1 addition & 0 deletions
1
...Notes/Inputs/Frameworks/FrameworkWithWrongCase.framework/Headers/FrameworkWithWrongCase.h
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 @@ | ||
extern int FrameworkWithWrongCase; |
5 changes: 5 additions & 0 deletions
5
...test/APINotes/Inputs/Frameworks/FrameworkWithWrongCase.framework/Modules/module.modulemap
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,5 @@ | ||
framework module FrameworkWithWrongCase { | ||
umbrella header "FrameworkWithWrongCase.h" | ||
export * | ||
module * { export * } | ||
} |
1 change: 1 addition & 0 deletions
1
...s/FrameworkWithWrongCase.framework/PrivateHeaders/FrameworkWithWrongCase_Private.apinotes
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 @@ | ||
Name: FrameworkWithWrongCase |
1 change: 1 addition & 0 deletions
1
...rameworks/FrameworkWithWrongCasePrivate.framework/Headers/FrameworkWithWrongCasePrivate.h
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 @@ | ||
extern int FrameworkWithWrongCasePrivate; |
5 changes: 5 additions & 0 deletions
5
...INotes/Inputs/Frameworks/FrameworkWithWrongCasePrivate.framework/Modules/module.modulemap
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,5 @@ | ||
framework module FrameworkWithWrongCasePrivate { | ||
umbrella header "FrameworkWithWrongCasePrivate.h" | ||
export * | ||
module * { export * } | ||
} |
1 change: 1 addition & 0 deletions
1
...nputs/Frameworks/FrameworkWithWrongCasePrivate.framework/Modules/module.private.modulemap
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 @@ | ||
module FrameworkWithWrongCasePrivate.Inner {} |
1 change: 1 addition & 0 deletions
1
...hWrongCasePrivate.framework/PrivateHeaders/FrameworkWithWrongCasePrivate_Private.apinotes
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 @@ | ||
Name: FrameworkWithWrongCasePrivate |
11 changes: 11 additions & 0 deletions
11
clang/test/APINotes/Inputs/Frameworks/LayeredKit.framework/Headers/LayeredKit.h
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,11 @@ | ||
@import LayeredKitImpl; | ||
|
||
// @interface declarations already don't inherit attributes from forward | ||
// declarations, so in order to test this properly we have to /not/ define | ||
// UpwardClass anywhere. | ||
|
||
// @interface UpwardClass | ||
// @end | ||
|
||
@protocol UpwardProto | ||
@end |
5 changes: 5 additions & 0 deletions
5
clang/test/APINotes/Inputs/Frameworks/LayeredKit.framework/Modules/module.modulemap
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,5 @@ | ||
framework module LayeredKit { | ||
umbrella header "LayeredKit.h" | ||
export * | ||
module * { export * } | ||
} |
9 changes: 9 additions & 0 deletions
9
.../test/APINotes/Inputs/Frameworks/LayeredKitImpl.framework/Headers/LayeredKitImpl.apinotes
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,9 @@ | ||
Name: LayeredKitImpl | ||
Classes: | ||
- Name: PerfectlyNormalClass | ||
Availability: none | ||
- Name: UpwardClass | ||
Availability: none | ||
Protocols: | ||
- Name: UpwardProto | ||
Availability: none |
7 changes: 7 additions & 0 deletions
7
clang/test/APINotes/Inputs/Frameworks/LayeredKitImpl.framework/Headers/LayeredKitImpl.h
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,7 @@ | ||
@protocol UpwardProto; | ||
@class UpwardClass; | ||
|
||
@interface PerfectlyNormalClass | ||
@end | ||
|
||
void doImplementationThings(UpwardClass *first, id <UpwardProto> second) __attribute((unavailable)); |
5 changes: 5 additions & 0 deletions
5
clang/test/APINotes/Inputs/Frameworks/LayeredKitImpl.framework/Modules/module.modulemap
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,5 @@ | ||
framework module LayeredKitImpl { | ||
umbrella header "LayeredKitImpl.h" | ||
export * | ||
module * { export * } | ||
} |
5 changes: 5 additions & 0 deletions
5
clang/test/APINotes/Inputs/Frameworks/SimpleKit.framework/Modules/module.modulemap
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,5 @@ | ||
framework module SimpleKit { | ||
umbrella header "SimpleKit.h" | ||
export * | ||
module * { export * } | ||
} |
74 changes: 74 additions & 0 deletions
74
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/APINotes/SomeKit.apinotes
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,74 @@ | ||
Name: SomeKit | ||
Classes: | ||
- Name: A | ||
Methods: | ||
- Selector: "transform:" | ||
MethodKind: Instance | ||
Availability: none | ||
AvailabilityMsg: "anything but this" | ||
- Selector: "transform:integer:" | ||
MethodKind: Instance | ||
NullabilityOfRet: N | ||
Nullability: [ N, S ] | ||
Properties: | ||
- Name: intValue | ||
PropertyKind: Instance | ||
Availability: none | ||
AvailabilityMsg: "wouldn't work anyway" | ||
- Name: nonnullAInstance | ||
PropertyKind: Instance | ||
Nullability: N | ||
- Name: nonnullAClass | ||
PropertyKind: Class | ||
Nullability: N | ||
- Name: nonnullABoth | ||
Nullability: N | ||
- Name: B | ||
Availability: none | ||
AvailabilityMsg: "just don't" | ||
- Name: C | ||
Methods: | ||
- Selector: "initWithA:" | ||
MethodKind: Instance | ||
DesignatedInit: true | ||
- Name: OverriddenTypes | ||
Methods: | ||
- Selector: "methodToMangle:second:" | ||
MethodKind: Instance | ||
ResultType: 'char *' | ||
Parameters: | ||
- Position: 0 | ||
Type: 'SOMEKIT_DOUBLE *' | ||
- Position: 1 | ||
Type: 'float *' | ||
Properties: | ||
- Name: intPropertyToMangle | ||
PropertyKind: Instance | ||
Type: 'double *' | ||
Functions: | ||
- Name: global_int_fun | ||
ResultType: 'char *' | ||
Parameters: | ||
- Position: 0 | ||
Type: 'double *' | ||
- Position: 1 | ||
Type: 'float *' | ||
Globals: | ||
- Name: global_int_ptr | ||
Type: 'double *' | ||
SwiftVersions: | ||
- Version: 3.0 | ||
Classes: | ||
- Name: A | ||
Methods: | ||
- Selector: "transform:integer:" | ||
MethodKind: Instance | ||
NullabilityOfRet: O | ||
Nullability: [ O, S ] | ||
Properties: | ||
- Name: explicitNonnullInstance | ||
PropertyKind: Instance | ||
Nullability: O | ||
- Name: explicitNullableInstance | ||
PropertyKind: Instance | ||
Nullability: N |
15 changes: 15 additions & 0 deletions
15
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/APINotes/SomeKit_private.apinotes
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,15 @@ | ||
Name: SomeKit | ||
Classes: | ||
- Name: A | ||
Methods: | ||
- Selector: "privateTransform:input:" | ||
MethodKind: Instance | ||
NullabilityOfRet: N | ||
Nullability: [ N, S ] | ||
Properties: | ||
- Name: internalProperty | ||
Nullability: N | ||
Protocols: | ||
- Name: InternalProtocol | ||
Availability: none | ||
AvailabilityMsg: "not for you" |
55 changes: 55 additions & 0 deletions
55
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/Headers/SomeKitForNullAnnotation.h
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,55 @@ | ||
#ifndef SOMEKIT_H | ||
#define SOMEKIT_H | ||
|
||
#define ROOT_CLASS __attribute__((objc_root_class)) | ||
|
||
ROOT_CLASS | ||
@interface A | ||
-(A*)transform:(A*)input; | ||
-(A*)transform:(A*)input integer:(int)integer; | ||
|
||
@property (nonatomic, readonly, retain) A* someA; | ||
@property (nonatomic, retain) A* someOtherA; | ||
|
||
@property (nonatomic) int intValue; | ||
@end | ||
|
||
@interface B : A | ||
@end | ||
|
||
@interface C : A | ||
- (instancetype)init; | ||
- (instancetype)initWithA:(A*)a; | ||
@end | ||
|
||
|
||
@interface MyClass : A | ||
- Inst; | ||
+ Clas; | ||
@end | ||
|
||
struct CGRect { | ||
float origin; | ||
float size; | ||
}; | ||
typedef struct CGRect NSRect; | ||
|
||
@interface I | ||
- (void) Meth : (NSRect[4])exposedRects; | ||
- (void) Meth1 : (const I*)exposedRects; | ||
- (void) Meth2 : (const I*)exposedRects; | ||
- (void) Meth3 : (I*)exposedRects; | ||
- (const I*) Meth4; | ||
- (const I*) Meth5 : (int) Arg1 : (const I*)Arg2 : (double)Arg3 : (const I*) Arg4 :(const volatile id) Arg5; | ||
- (volatile const I*) Meth6 : (const char *)Arg1 : (const char *)Arg2 : (double)Arg3 : (const I*) Arg4 :(const volatile id) Arg5; | ||
@end | ||
|
||
@class NSURL, NSArray, NSError; | ||
@interface INTF_BLOCKS | ||
+ (void)getNonLocalVersionsOfItemAtURL:(NSURL *)url completionHandler:(void (^)(NSArray *nonLocalFileVersions, NSError *error))completionHandler; | ||
+ (void *)getNonLocalVersionsOfItemAtURL2:(NSURL *)url completionHandler:(void (^)(NSArray *nonLocalFileVersions, NSError *error))completionHandler; | ||
+ (NSError **)getNonLocalVersionsOfItemAtURL3:(int)url completionHandler:(void (^)(NSArray *nonLocalFileVersions, NSError *error))completionHandler; | ||
+ (id)getNonLocalVersionsOfItemAtURL4:(NSURL *)url completionHandler:(void (^)(int nonLocalFileVersions, NSError *error, NSURL*))completionHandler; | ||
@end | ||
|
||
#endif |
5 changes: 5 additions & 0 deletions
5
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/Modules/module.modulemap
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,5 @@ | ||
framework module SomeKit { | ||
umbrella header "SomeKit.h" | ||
export * | ||
module * { export * } | ||
} |
8 changes: 8 additions & 0 deletions
8
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/Modules/module.private.modulemap
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,8 @@ | ||
module SomeKit.Private { | ||
header "SomeKit_Private.h" | ||
export * | ||
|
||
explicit module NullAnnotation { | ||
header "SomeKit_PrivateForNullAnnotation.h" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
clang/test/APINotes/Inputs/Frameworks/SomeKit.framework/Modules/module_private.modulemap
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,8 @@ | ||
explicit framework module SomeKit.Private { | ||
header "SomeKit_Private.h" | ||
explicit NullAnnotation { header "SomeKit_PrivateForNullAnnotation.h" } | ||
export * | ||
module * { export * } | ||
syntax error | ||
|
||
} |
Oops, something went wrong.