79 changes: 79 additions & 0 deletions test/APINotes/Inputs/roundtrip.apinotes
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
Name: AppKit
Availability: available
AvailabilityMsg: ''
Classes:
- Name: NSCell
Availability: available
AvailabilityMsg: ''
Methods:
- Selector: init
MethodKind: Instance
NullabilityOfRet: U
Availability: available
AvailabilityMsg: ''
DesignatedInit: true
- Selector: 'initImageCell:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: U
Availability: available
AvailabilityMsg: ''
DesignatedInit: true
- Selector: 'initTextCell:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: U
Availability: available
AvailabilityMsg: ''
DesignatedInit: true
- Selector: 'initWithCoder:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: U
Availability: available
AvailabilityMsg: ''
DesignatedInit: true
Required: true
- Name: NSView
AuditedForNullability: true
Availability: available
AvailabilityMsg: ''
Methods:
- Selector: 'addSubview:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: N
Availability: available
AvailabilityMsg: ''
- Selector: 'addSubview:positioned:relativeTo:'
MethodKind: Instance
Nullability: [ N, N, O ]
NullabilityOfRet: N
Availability: available
AvailabilityMsg: ''
- Selector: 'beginDraggingSessionWithItems:event:source:'
MethodKind: Instance
Nullability: [ U, U, N ]
NullabilityOfRet: N
Availability: available
AvailabilityMsg: ''
Properties:
- Name: enclosingScrollView
Nullability: O
Availability: available
AvailabilityMsg: ''
- Name: makeBackingLayer
Nullability: N
Availability: available
AvailabilityMsg: ''
Functions:
- Name: NSAvailableWindowDepths
NullabilityOfRet: N
Availability: available
AvailabilityMsg: ''
Globals:
- Name: NSCalibratedWhiteColorSpace
Nullability: N
Availability: available
AvailabilityMsg: ''
29 changes: 29 additions & 0 deletions test/APINotes/availability.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

#include "HeaderLib.h"
#import <SomeKit/SomeKit.h>
#import <SomeKit/SomeKit_Private.h>

int main() {
int i;
i = unavailable_function(); // expected-error{{'unavailable_function' is unavailable: I beg you not to use this}}
// expected-note@HeaderLib.h:8{{'unavailable_function' has been explicitly marked unavailable here}}
i = unavailable_global_int; // expected-error{{'unavailable_global_int' is unavailable}}
// expected-note@HeaderLib.h:9{{'unavailable_global_int' has been explicitly marked unavailable here}}

B *b = 0; // expected-error{{'B' is unavailable: just don't}}
// expected-note@SomeKit/SomeKit.h:15{{'B' has been explicitly marked unavailable here}}

id<InternalProtocol> proto = 0; // expected-error{{'InternalProtocol' is unavailable: not for you}}
// expected-note@SomeKit/SomeKit_Private.h:12{{'InternalProtocol' has been explicitly marked unavailable here}}

A *a = 0;
i = a.intValue; // expected-error{{intValue' is unavailable: wouldn't work anyway}}
// expected-note@SomeKit/SomeKit.h:12{{'intValue' has been explicitly marked unavailable here}}

[a transform:a]; // expected-error{{'transform:' is unavailable: anything but this}}
// expected-note@SomeKit/SomeKit.h:6{{'transform:' has been explicitly marked unavailable here}}

return 0;
}

33 changes: 33 additions & 0 deletions test/APINotes/cache.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// RUN: rm -rf %t/APINotesCache
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

// Check for the presence of the cached compiled form.
// RUN: ls %t/APINotesCache | grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"

// Run test again to ensure that caching doesn't cause problems.
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

// Check that the driver provides a default -fapinotes-cache-path=
// RUN: %clang -fsyntax-only -fapinotes -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -### 2>&1 | FileCheck --check-prefix=CHECK-DEFAULT-PATH %s
// CHECK-DEFAULT-PATH: -fapinotes-cache-path={{.*}}org.llvm.clang/APINotesCache

// Check that the driver passes through a provided -fapinotes-cache-path=
// RUN: %clang -fsyntax-only -fapinotes -fapinotes-cache-path=/wobble -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -### 2>&1 | FileCheck --check-prefix=CHECK-PATH %s
// CHECK-PATH: -fapinotes-cache-path=/wobble

#include "HeaderLib.h"
#import <SomeKit/SomeKit.h>

int main() {
int i;
i = unavailable_function(); // expected-error{{'unavailable_function' is unavailable: I beg you not to use this}}
// expected-note@HeaderLib.h:8{{'unavailable_function' has been explicitly marked unavailable here}}

A *a = 0;
[a transform:a]; // expected-error{{'transform:' is unavailable: anything but this}}
// expected-note@SomeKit/SomeKit.h:6{{'transform:' has been explicitly marked unavailable here}}

return 0;
}

49 changes: 49 additions & 0 deletions test/APINotes/cache_pruning.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// We need 'touch' and 'find' for this test to work.
// REQUIRES: shell

// RUN: rm -rf %t/APINotesCache

// Run Clang. This should generated the cached versions of both and a timestamp.
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -DINCLUDE_HEADERLIB
// RUN: ls %t/APINotesCache | grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "APINotes.timestamp"

// Set the timestamp back a very long time. We should try to prune,
// but nothing gets pruned because the API Notes files are new enough.
// RUN: touch -m -a -t 201101010000 %t/APINotes.timestamp
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s
// RUN: ls %t/APINotesCache | grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "APINotes.timestamp"

// Set the HeaderLib access time back a very long time.
// This shouldn't prune anything, because the timestamp has been updated, so
// the pruning mechanism won't fire.
// RUN: find %t/APINotesCache -name APINotes-*.apinotesc | xargs touch -a -t 201101010000
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s
// RUN: ls %t/APINotesCache | grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "APINotes.timestamp"

// Set the timestack back a very long time. This should prune the
// HeaderLib file, because the pruning mechanism should fire and
// HeaderLib is both old and not used.
// RUN: touch -m -a -t 201101010000 %t/APINotesCache/APINotes.timestamp
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s
// RUN: ls %t/APINotesCache | not grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "APINotes.timestamp"

// Run Clang. This should generated the cached versions of both and a timestamp.
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -DINCLUDE_HEADERLIB
// RUN: ls %t/APINotesCache | grep "APINotes-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "SomeKit-.*.apinotesc"
// RUN: ls %t/APINotesCache | grep "APINotes.timestamp"

#ifdef INCLUDE_HEADERLIB
#include "HeaderLib.h"
#endif
#include <SomeKit/SomeKit.h>

int main() { return 0; }
14 changes: 14 additions & 0 deletions test/APINotes/nullability.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

#include "HeaderLib.h"

int main() {
custom_realloc(0, 0); // expected-warning{{null passed to a callee that requires a non-null argument}}
int i = 0;
do_something_with_pointers(&i, 0);
do_something_with_pointers(0, &i); // expected-warning{{null passed to a callee that requires a non-null argument}}

float *fp = global_int; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}}
return 0;
}

13 changes: 13 additions & 0 deletions test/APINotes/nullability.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

#import <SomeKit/SomeKit.h>


int main() {
A *a;

[a transform: 0 integer: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}}

return 0;
}

16 changes: 16 additions & 0 deletions test/APINotes/objc_designated_inits.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: %clang_cc1 -fapinotes -fapinotes-cache-path=%t/APINotesCache -fsyntax-only -I %S/Inputs/Headers -F %S/Inputs/Frameworks %s -verify

#include "HeaderLib.h"
#import <SomeKit/SomeKit.h>

@interface CSub : C
-(instancetype)initWithA:(A*)a;
@end

@implementation CSub
-(instancetype)initWithA:(A*)a { // expected-warning{{designated initializer missing a 'super' call to a designated initializer of the super class}}
// expected-note@SomeKit/SomeKit.h:20 2{{method marked as designated initializer of the class here}}
self = [super init]; // expected-warning{{designated initializer invoked a non-designated initializer}}
return self;
}
@end
6 changes: 6 additions & 0 deletions test/APINotes/yaml-convert-diags.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: rm -rf %t
// RUN: not %clang_cc1 -fsyntax-only -fapinotes -fapinotes-cache-path=%t %s -I %S/Inputs/BrokenHeaders2 2>&1 | FileCheck %s

#include "SomeBrokenLib.h"

// CHECK: error: multiple definitions of global function 'do_something_with_pointers'
31 changes: 31 additions & 0 deletions test/APINotes/yaml-os-availability.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# RUN: %clang -cc1apinotes -yaml-to-binary -target i386-apple-ios7 -o %t-ios.apinotesc %S/Inputs/os-availability.apinotes
# RUN: %clang -cc1apinotes -binary-to-yaml %t-ios.apinotesc -o %t.os-availability-ios.apinotes
# RUN: FileCheck %s -check-prefix=IOS < %t.os-availability-ios.apinotes

# RUN: %clang -cc1apinotes -yaml-to-binary -target x86_64-apple-macosx10.9 -o %t-osx.apinotesc %S/Inputs/os-availability.apinotes
# RUN: %clang -cc1apinotes -binary-to-yaml %t-osx.apinotesc -o %t.os-availability-osx.apinotes
# RUN: FileCheck %s -check-prefix=OSX < %t.os-availability-osx.apinotes

# IOS: Foundation
# IOS: NSArray
# IOS: initWithObjects
# IOS: familyNameios
# IOS: fontName
# IOS: NSCountedSet
# IOS: UIApplicationDelegate
# IOS: UIApplicationDelegateIOS
# IOS: NSAvailableWindowDepths
# IOS: NSAvailableWindowDepthsiOS
# IOS-NOT: NSCalibratedWhiteColorSpace

# OSX: Foundation
# qqOSX: NSArray
# OSX-NOT: initWithObjects
# OSX-NOT: familyNameios
# OSX: fontName
# OSX-NOT: NSCountedSet
# OSX: UIApplicationDelegate
# OSX-NOT: UIApplicationDelegateIOS
# OSX: NSAvailableWindowDepths
# OSX-NOT: NSAvailableWindowDepthsiOS
# OSX: NSCalibratedWhiteColorSpace
6 changes: 6 additions & 0 deletions test/APINotes/yaml-parse-diags.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fsyntax-only -fapinotes -fapinotes-cache-path=%t %s -I %S/Inputs/BrokenHeaders -verify

#include "SomeBrokenLib.h"

// expected-error@APINotes.apinotes:4{{unknown key 'Nu llabilityOfRet'}}
65 changes: 65 additions & 0 deletions test/APINotes/yaml-reader-errors.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# RUN: not %clang -cc1apinotes -yaml-to-binary -target i386-apple-ios7 -o %t.apinotesc %s > %t.err 2>&1
# RUN: FileCheck %s < %t.err

---
Name: UIKit
Availability: iOS
AvailabilityMsg: iOSOnly
Classes:
- Name: UIFont
Availability: iOS
AvailabilityMsg: iOSOnly
Methods:
- Selector: 'fontWithName:size:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: O
Availability: iOS
AvailabilityMsg: iOSOnly
DesignatedInit: true
# CHECK: duplicate definition of method '-[UIFont fontWithName:size:]'
- Selector: 'fontWithName:size:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: O
Availability: iOS
AvailabilityMsg: iOSOnly
DesignatedInit: true
Properties:
- Name: familyName
Nullability: N
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: fontName
Nullability: N
Availability: iOS
AvailabilityMsg: iOSOnly
# CHECK: duplicate definition of property 'UIFont.familyName'
- Name: familyName
Nullability: N
Availability: iOS
AvailabilityMsg: iOSOnly
# CHECK: multiple definitions of class 'UIFont'
- Name: UIFont
Protocols:
- Name: MyProto
AuditedForNullability: true
# CHECK: multiple definitions of protocol 'MyProto'
- Name: MyProto
AuditedForNullability: true
Functions:
- Name: 'globalFoo'
Nullability: [ N, N, O, S ]
NullabilityOfRet: O
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: 'globalFoo2'
Nullability: [ N, N, O, S ]
NullabilityOfRet: O
Globals:
- Name: globalVar
Nullability: O
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: globalVar2
Nullability: O
102 changes: 102 additions & 0 deletions test/APINotes/yaml-reader-test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# RUN: %clang -cc1apinotes -dump %s | FileCheck %s
---
Name: UIKit
Availability: iOS
AvailabilityMsg: iOSOnly
Classes:
- Name: UIFont
Availability: iOS
AvailabilityMsg: iOSOnly
Methods:
- Selector: 'fontWithName:size:'
MethodKind: Instance
Nullability: [ N ]
NullabilityOfRet: O
Availability: iOS
AvailabilityMsg: iOSOnly
DesignatedInit: true
Properties:
- Name: familyName
Nullability: N
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: fontName
Nullability: N
Availability: iOS
AvailabilityMsg: iOSOnly
Protocols:
- Name: MyProto
AuditedForNullability: true
- Name: MyProto2
AuditedForNullability: true
Functions:
- Name: 'globalFoo'
Nullability: [ N, N, O, S ]
NullabilityOfRet: O
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: 'globalFoo2'
Nullability: [ N, N, O, S ]
NullabilityOfRet: O
Globals:
- Name: globalVar
Nullability: O
Availability: iOS
AvailabilityMsg: iOSOnly
- Name: globalVar2
Nullability: O


# CHECK: Name: UIKit
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: Classes:
# CHECK: - Name: UIFont
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: Methods:
# CHECK: - Selector: 'fontWithName:size:'
# CHECK: MethodKind: Instance
# CHECK: Nullability: [ N ]
# CHECK: NullabilityOfRet: O
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: DesignatedInit: true
# CHECK: Properties:
# CHECK: - Name: familyName
# CHECK: Nullability: N
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: - Name: fontName
# CHECK: Nullability: N
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK:Protocols:
# CHECK: - Name: MyProto
# CHECK: AuditedForNullability: true
# CHECK: Availability: available
# CHECK: AvailabilityMsg: ''
# CHECK: - Name: MyProto2
# CHECK: AuditedForNullability: true
# CHECK: Availability: available
# CHECK: AvailabilityMsg: ''
# CHECK:Functions:
# CHECK: - Name: globalFoo
# CHECK: Nullability: [ N, N, O, U ]
# CHECK: NullabilityOfRet: O
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: - Name: globalFoo2
# CHECK: Nullability: [ N, N, O, U ]
# CHECK: NullabilityOfRet: O
# CHECK: Availability: available
# CHECK: AvailabilityMsg: ''
# CHECK:Globals:
# CHECK: - Name: globalVar
# CHECK: Nullability: O
# CHECK: Availability: iOS
# CHECK: AvailabilityMsg: iOSOnly
# CHECK: - Name: globalVar2
# CHECK: Nullability: O
# CHECK: Availability: available
# CHECK: AvailabilityMsg:
10 changes: 10 additions & 0 deletions test/APINotes/yaml-roundtrip.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# RUN: %clang -cc1apinotes -yaml-to-binary -o %t.apinotesc %S/Inputs/roundtrip.apinotes
# RUN: %clang -cc1apinotes -binary-to-yaml -o %t.apinotes %t.apinotesc

# Handle the infurating '...' the YAML writer adds but the parser
# can't read.

# RUN: cp %S/Inputs/roundtrip.apinotes %t-reference.apinotes
# RUN: echo "..." >> %t-reference.apinotes
# RUN: diff %t-reference.apinotes %t.apinotes

3 changes: 2 additions & 1 deletion test/Misc/warning-flags.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This test serves two purposes:

The list of warnings below should NEVER grow. It should gradually shrink to 0.

CHECK: Warnings without flags (85):
CHECK: Warnings without flags (86):
CHECK-NEXT: ext_excess_initializers
CHECK-NEXT: ext_excess_initializers_in_char_array_initializer
CHECK-NEXT: ext_expected_semi_decl_list
Expand All @@ -40,6 +40,7 @@ CHECK-NEXT: pp_out_of_date_dependency
CHECK-NEXT: pp_poisoning_existing_macro
CHECK-NEXT: w_asm_qualifier_ignored
CHECK-NEXT: warn_accessor_property_type_mismatch
CHECK-NEXT: warn_apinotes_message
CHECK-NEXT: warn_arcmt_nsalloc_realloc
CHECK-NEXT: warn_asm_label_on_auto_decl
CHECK-NEXT: warn_c_kext
Expand Down
15 changes: 15 additions & 0 deletions test/Sema/attr-availability.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ extern int x2 __attribute__((availability(macosx,introduced=10.2))); // expected
extern int x2 __attribute__((availability(macosx,introduced=10.5))); // expected-warning {{availability does not match previous declaration}}



#if __has_feature(attribute_availability_swift)
# warning "okay"
// expected-warning@-1{{okay}}
#else
# error "Missing __has_feature"
#endif


extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable)));
extern int noSwiftGlobal1 __attribute__((availability(macosx, introduced=10.1))); // okay
extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable, message="and this one has a message"))); // okay

extern int noSwiftGlobal2 __attribute__((availability(swift, introduced=5))); // expected-warning{{only 'unavailable' is supported for Swift availability}}

enum Original {
OriginalDeprecated __attribute__((availability(macosx, deprecated=10.2))), // expected-note + {{'OriginalDeprecated' has been explicitly marked deprecated here}}
OriginalUnavailable __attribute__((availability(macosx, unavailable))) // expected-note + {{'OriginalUnavailable' has been explicitly marked unavailable here}}
Expand Down
12 changes: 12 additions & 0 deletions test/Sema/attr-noescape.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only

#if !__has_attribute(noescape)
# error "missing noescape attribute"
#endif

int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}}

void foo(__attribute__((noescape)) int *int_ptr,
__attribute__((noescape)) int (^block)(int),
__attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute ignored on parameter of non-pointer type 'int'}}
}
158 changes: 158 additions & 0 deletions test/SemaObjC/attr-swift.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// RUN: %clang_cc1 -verify -fsyntax-only -fobjc-arc -fblocks %s

// --- swift_private ---

__attribute__((swift_private))
@protocol FooProto
@end

__attribute__((swift_private))
@interface Foo
@end

@interface Bar
@property id prop __attribute__((swift_private));
- (void)instMethod __attribute__((swift_private));
+ (instancetype)bar __attribute__((swift_private));
@end

void function(id) __attribute__((swift_private));

struct __attribute__((swift_private)) Point {
int x;
int y;
};

enum __attribute__((swift_private)) Colors {
Red, Green, Blue
};

typedef struct {
float x, y, z;
} Point3D __attribute__((swift_private));


// --- swift_name ---

__attribute__((swift_name("SNFooType")))
@protocol SNFoo
@end

__attribute__((swift_name("SNFooClass")))
@interface SNFoo <SNFoo>
- (instancetype)init __attribute__((swift_name("init()")));
- (instancetype)initWithValue:(int)value __attribute__((swift_name("fooWithValue(_:)")));

+ (void)refresh __attribute__((swift_name("refresh()")));

+ (instancetype)foo __attribute__((swift_name("foo()")));
+ (SNFoo *)fooWithValue:(int)value __attribute__((swift_name("foo(value:)")));
+ (SNFoo *)fooWithValue:(int)value value:(int)value2 __attribute__((swift_name("foo(value:extra:)")));
+ (SNFoo *)fooWithConvertingValue:(int)value value:(int)value2 __attribute__((swift_name("init(_:extra:)")));

+ (SNFoo *)fooWithOtherValue:(int)value __attribute__((swift_name("init"))); // expected-error {{parameter of 'swift_name' attribute must be a Swift function name string}}
+ (SNFoo *)fooWithAnotherValue:(int)value __attribute__((swift_name("foo()"))); // expected-warning {{too few parameters in 'swift_name' attribute (expected 1; got 0)}}
+ (SNFoo *)fooWithYetAnotherValue:(int)value __attribute__((swift_name("foo(value:extra:)"))); // expected-warning {{too many parameters in 'swift_name' attribute (expected 1; got 2)}}

+ (SNFoo *)fooAndReturnErrorCode:(int *)errorCode __attribute__((swift_name("foo()"))); // no-warning
+ (SNFoo *)fooWithValue:(int)value andReturnErrorCode:(int *)errorCode __attribute__((swift_name("foo(value:)"))); // no-warning
+ (SNFoo *)fooFromErrorCode:(const int *)errorCode __attribute__((swift_name("foo()"))); // expected-warning {{too few parameters in 'swift_name' attribute (expected 1; got 0)}}
+ (SNFoo *)fooWithValue:(int)value fromErrorCode:(const int *)errorCode __attribute__((swift_name("foo(value:)"))); // expected-warning {{too few parameters in 'swift_name' attribute (expected 2; got 1)}}
+ (SNFoo *)fooWithPointerA:(int *)value andReturnErrorCode:(int *)errorCode __attribute__((swift_name("foo()"))); // no-warning
+ (SNFoo *)fooWithPointerB:(int *)value andReturnErrorCode:(int *)errorCode __attribute__((swift_name("foo(pointer:)"))); // no-warning
+ (SNFoo *)fooWithPointerC:(int *)value andReturnErrorCode:(int *)errorCode __attribute__((swift_name("foo(pointer:errorCode:)"))); // no-warning
+ (SNFoo *)fooWithOtherFoo:(SNFoo *)other __attribute__((swift_name("foo()"))); // expected-warning {{too few parameters in 'swift_name' attribute (expected 1; got 0)}}

+ (instancetype)specialFoo __attribute__((swift_name("init(options:)")));
+ (instancetype)specialBar __attribute__((swift_name("init(options:extra:)"))); // expected-warning {{too many parameters in 'swift_name' attribute (expected 0; got 2)}}
+ (instancetype)specialBaz __attribute__((swift_name("init(_:)"))); // expected-warning {{too many parameters in 'swift_name' attribute (expected 0; got 1)}}
+ (instancetype)specialGarply __attribute__((swift_name("foo(options:)"))); // expected-warning {{too many parameters in 'swift_name' attribute (expected 0; got 1)}}

+ (instancetype)trailingParen __attribute__((swift_name("foo("))); // expected-error {{parameter of 'swift_name' attribute must be a Swift function name string}}
+ (instancetype)trailingColon:(int)value __attribute__((swift_name("foo(value)"))); // expected-error {{parameter of 'swift_name' attribute must be a Swift function name string}}
+ (instancetype)initialIgnore:(int)value __attribute__((swift_name("_(value:)"))); // expected-error {{parameter of 'swift_name' attribute must be a Swift function name string}}
+ (instancetype)middleOmitted:(int)value __attribute__((swift_name("foo(:)"))); // expected-error {{parameter of 'swift_name' attribute must be a Swift function name string}}

@property(strong) id someProp __attribute__((swift_name("prop")));
@end

enum __attribute__((swift_name("MoreColors"))) MoreColors {
Cyan,
Magenta,
Yellow __attribute__((swift_name("RoseGold"))),
Black __attribute__((swift_name("SpaceGrey()"))) // expected-error {{parameter of 'swift_name' attribute must be an ASCII identifier string}}
};

struct __attribute__((swift_name("FooStruct"))) BarStruct {
int x, y, z __attribute__((swift_name("zed")));
};

int global_int __attribute__((swift_name("GlobalInt")));

void foo1(int i) __attribute__((swift_name("foo"))); // expected-error{{parameter of 'swift_name' attribute must be a Swift function name string}}
void foo2(int i) __attribute__((swift_name("foo()"))); // expected-warning{{too few parameters in 'swift_name' attribute (expected 1; got 0)}}
void foo2(int i) __attribute__((swift_name("foo(a:b:)"))); // expected-warning{{too many parameters in 'swift_name' attribute (expected 1; got 2)}}
void foo3(int i, int j) __attribute__((swift_name("fooWithX(_:y:)"))); // okay
void foo4(int i, int *error) __attribute__((swift_name("fooWithA(_:)"))); // okay

typedef int some_int_type __attribute__((swift_name("SomeInt")));

// --- swift_error ---

@class NSError;

typedef struct __attribute__((objc_bridge(NSError))) __CFError *CFErrorRef;

@interface Erroneous
- (_Bool) tom0: (NSError**) err __attribute__((swift_error(none)));
- (_Bool) tom1: (NSError**) err __attribute__((swift_error(nonnull_error)));
- (_Bool) tom2: (NSError**) err __attribute__((swift_error(null_result))); // expected-error {{'swift_error' attribute with 'null_result' convention can only be applied to a method returning a pointer}}
- (_Bool) tom3: (NSError**) err __attribute__((swift_error(nonzero_result)));
- (_Bool) tom4: (NSError**) err __attribute__((swift_error(zero_result)));

- (Undeclared) richard0: (NSError**) err __attribute__((swift_error(none))); // expected-error {{expected a type}}
- (Undeclared) richard1: (NSError**) err __attribute__((swift_error(nonnull_error))); // expected-error {{expected a type}}
- (Undeclared) richard2: (NSError**) err __attribute__((swift_error(null_result))); // expected-error {{expected a type}}
// FIXME: the follow-on warnings should really be suppressed, but apparently having an ill-formed return type doesn't mark anything as invalid
- (Undeclared) richard3: (NSError**) err __attribute__((swift_error(nonzero_result))); // expected-error {{expected a type}} expected-error {{can only be applied}}
- (Undeclared) richard4: (NSError**) err __attribute__((swift_error(zero_result))); // expected-error {{expected a type}} expected-error {{can only be applied}}

- (instancetype) harry0: (NSError**) err __attribute__((swift_error(none)));
- (instancetype) harry1: (NSError**) err __attribute__((swift_error(nonnull_error)));
- (instancetype) harry2: (NSError**) err __attribute__((swift_error(null_result)));
- (instancetype) harry3: (NSError**) err __attribute__((swift_error(nonzero_result))); // expected-error {{'swift_error' attribute with 'nonzero_result' convention can only be applied to a method returning an integral type}}
- (instancetype) harry4: (NSError**) err __attribute__((swift_error(zero_result))); // expected-error {{'swift_error' attribute with 'zero_result' convention can only be applied to a method returning an integral type}}

- (instancetype) harry0 __attribute__((swift_error(none)));
- (instancetype) harry1 __attribute__((swift_error(nonnull_error))); // expected-error {{'swift_error' attribute can only be applied to a method with an error parameter}}
- (instancetype) harry2 __attribute__((swift_error(null_result))); // expected-error {{'swift_error' attribute can only be applied to a method with an error parameter}}
- (instancetype) harry3 __attribute__((swift_error(nonzero_result))); // expected-error {{'swift_error' attribute can only be applied to a method with an error parameter}}
- (instancetype) harry4 __attribute__((swift_error(zero_result))); // expected-error {{'swift_error' attribute can only be applied to a method with an error parameter}}
@end

extern _Bool tom0(CFErrorRef *) __attribute__((swift_error(none)));
extern _Bool tom1(CFErrorRef *) __attribute__((swift_error(nonnull_error)));
extern _Bool tom2(CFErrorRef *) __attribute__((swift_error(null_result))); // expected-error {{'swift_error' attribute with 'null_result' convention can only be applied to a function returning a pointer}}
extern _Bool tom3(CFErrorRef *) __attribute__((swift_error(nonzero_result)));
extern _Bool tom4(CFErrorRef *) __attribute__((swift_error(zero_result)));

extern Undeclared richard0(CFErrorRef *) __attribute__((swift_error(none))); // expected-error {{unknown type name 'Undeclared'}}
extern Undeclared richard1(CFErrorRef *) __attribute__((swift_error(nonnull_error))); // expected-error {{unknown type name 'Undeclared'}}
extern Undeclared richard2(CFErrorRef *) __attribute__((swift_error(null_result))); // expected-error {{unknown type name 'Undeclared'}}
extern Undeclared richard3(CFErrorRef *) __attribute__((swift_error(nonzero_result))); // expected-error {{unknown type name 'Undeclared'}}
extern Undeclared richard4(CFErrorRef *) __attribute__((swift_error(zero_result))); // expected-error {{unknown type name 'Undeclared'}}

extern void *harry0(CFErrorRef *) __attribute__((swift_error(none)));
extern void *harry1(CFErrorRef *) __attribute__((swift_error(nonnull_error)));
extern void *harry2(CFErrorRef *) __attribute__((swift_error(null_result)));
extern void *harry3(CFErrorRef *) __attribute__((swift_error(nonzero_result))); // expected-error {{'swift_error' attribute with 'nonzero_result' convention can only be applied to a function returning an integral type}}
extern void *harry4(CFErrorRef *) __attribute__((swift_error(zero_result))); // expected-error {{'swift_error' attribute with 'zero_result' convention can only be applied to a function returning an integral type}}

extern void *wilma0(void) __attribute__((swift_error(none)));
extern void *wilma1(void) __attribute__((swift_error(nonnull_error))); // expected-error {{'swift_error' attribute can only be applied to a function with an error parameter}}
extern void *wilma2(void) __attribute__((swift_error(null_result))); // expected-error {{'swift_error' attribute can only be applied to a function with an error parameter}}
extern void *wilma3(void) __attribute__((swift_error(nonzero_result))); // expected-error {{'swift_error' attribute can only be applied to a function with an error parameter}}
extern void *wilma4(void) __attribute__((swift_error(zero_result))); // expected-error {{'swift_error' attribute can only be applied to a function with an error parameter}}


extern _Bool suzanne __attribute__((swift_error(none))); // expected-error {{'swift_error' attribute only applies to functions and methods}}
23 changes: 23 additions & 0 deletions test/SemaObjC/subclassing-restricted-attr.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
// rdar://16560476

__attribute__((objc_subclassing_restricted))
@interface Leaf // okay
@end

__attribute__((objc_subclassing_restricted))
@interface SubClassOfLeaf : Leaf // expected-note {{class is declared here}}
@end


@interface SubClass : SubClassOfLeaf // expected-error {{cannot subclass a class with objc_subclassing_restricted attribute}}
@end

__attribute__((objc_root_class))
@interface PlainRoot
@end

__attribute__((objc_subclassing_restricted))
@interface Sub2Class : PlainRoot // okay
@end
2 changes: 1 addition & 1 deletion tools/arcmt-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangARCMigrate.a clangRewrite.a \
clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \
clangSema.a clangEdit.a clangAnalysis.a clangAST.a clangLex.a \
clangBasic.a
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile
3 changes: 2 additions & 1 deletion tools/c-arcmt-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ USEDLIBS = clang.a \
clangFrontend.a clangDriver.a \
clangStaticAnalyzerCheckers.a clangStaticAnalyzerCore.a \
clangSerialization.a clangParse.a clangSema.a \
clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangBasic.a
clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangAPINotes.a \
clangBasic.a

include $(CLANG_LEVEL)/Makefile
2 changes: 1 addition & 1 deletion tools/c-index-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ USEDLIBS = clang.a \
clangToolingCore.a \
clangSerialization.a clangParse.a clangSema.a \
clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
clangBasic.a
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile

Expand Down
1 change: 1 addition & 0 deletions tools/clang-check/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_clang_executable(clang-check
)

target_link_libraries(clang-check
clangAPINotes
clangAST
clangBasic
clangDriver
Expand Down
2 changes: 1 addition & 1 deletion tools/clang-check/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ USEDLIBS = clangFrontend.a clangCodeGen.a clangIndex.a \
clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \
clangStaticAnalyzerCore.a clangAnalysis.a clangRewriteFrontend.a \
clangRewrite.a clangEdit.a clangAST.a clangLex.a \
clangBasic.a
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile
2 changes: 1 addition & 1 deletion tools/clang-format/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ TOOL_NO_EXPORTS = 1
include $(CLANG_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangFormat.a clangToolingCore.a clangDriver.a clangRewrite.a \
clangLex.a clangBasic.a
clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile
2 changes: 1 addition & 1 deletion tools/diagtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include $(CLANG_LEVEL)/../../Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \
clangSema.a clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
clangBasic.a
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile

2 changes: 2 additions & 0 deletions tools/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ add_clang_executable(clang
driver.cpp
cc1_main.cpp
cc1as_main.cpp
apinotes_main.cpp
)

target_link_libraries(clang
clangBasic
clangAPINotes
clangCodeGen
clangDriver
clangFrontend
Expand Down
3 changes: 2 additions & 1 deletion tools/driver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ ifeq ($(ENABLE_CLANG_ARCMT),1)
USEDLIBS += clangARCMigrate.a
endif

USEDLIBS += clangAnalysis.a clangEdit.a clangAST.a clangLex.a clangBasic.a
USEDLIBS += clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile

Expand Down
149 changes: 149 additions & 0 deletions tools/driver/apinotes_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
//===-- api_notes.cpp - API Notes Driver ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file provides conversion between the YAML (source) and binary forms
/// of API notes.
///
//===----------------------------------------------------------------------===//
#include "clang/APINotes/APINotesYAMLCompiler.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Triple.h"

using namespace llvm;
namespace api_notes = clang::api_notes;

int cc1apinotes_main(ArrayRef<const char *> Argv, const char *Argv0,
void *MainAddr) {

// Mark all our options with this category, everything else (except for
// -version and -help) will be hidden.
static cl::OptionCategory APINotesCategory("API Notes options");

static cl::opt<api_notes::ActionType>
Action(cl::desc("Mode:"), cl::init(api_notes::ActionType::None),
cl::values(
clEnumValN(api_notes::ActionType::YAMLToBinary,
"yaml-to-binary",
"Convert YAML to binary format"),
clEnumValN(api_notes::ActionType::BinaryToYAML,
"binary-to-yaml",
"Convert binary format to YAML"),
clEnumValN(api_notes::ActionType::Dump,
"dump",
"Parse and dump the output"),
clEnumValEnd),
cl::cat(APINotesCategory));

static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input file>"),
cl::Required, cl::cat(APINotesCategory));

static cl::opt<std::string>
Target("target", cl::desc("Generate binary format for the given target"),
cl::cat(APINotesCategory));

static cl::opt<std::string>
OutputFilename("o", cl::desc("Output file name"), cl::cat(APINotesCategory));

cl::HideUnrelatedOptions(APINotesCategory);

SmallVector<const char *, 4> Args;
Args.push_back(Argv0);
Args.append(Argv.begin(), Argv.end());
cl::ParseCommandLineOptions(Args.size(),
Args.data(),
"Clang API Notes Tool\n");

if (Action == clang::api_notes::ActionType::None) {
errs() << "action required\n";
cl::PrintHelpMessage();
return 1;
}

auto fileBufOrErr = MemoryBuffer::getFile(InputFilename);
if (std::error_code EC = fileBufOrErr.getError()) {
llvm::errs() << "\n Could not open input file: " + EC.message() << '\n';
return true;
}
StringRef input = fileBufOrErr.get()->getBuffer();

switch (Action) {
case api_notes::ActionType::None:
llvm_unreachable("handled above");

case api_notes::ActionType::YAMLToBinary: {
if (OutputFilename.empty()) {
errs() << "output file is required\n";
cl::PrintHelpMessage();
return 1;
}

api_notes::OSType targetOS = api_notes::OSType::Absent;
// TODO: Check that we've specified the target.
if (!Target.empty()) {
llvm::Triple target(llvm::Triple::normalize(Target));
switch (target.getOS()) {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
targetOS = api_notes::OSType::OSX;
break;
case llvm::Triple::IOS:
targetOS = api_notes::OSType::IOS;
break;
default:
errs() << "target is not supported\n";
return 1;
}
}
std::error_code EC;
llvm::raw_fd_ostream os(OutputFilename, EC,
llvm::sys::fs::OpenFlags::F_None);

if (api_notes::compileAPINotes(input, os, targetOS))
return 1;

os.flush();

return os.has_error();
}

case api_notes::ActionType::BinaryToYAML: {
if (OutputFilename.empty()) {
errs() << "output file required\n";
cl::PrintHelpMessage();
return 1;
}

std::error_code EC;
llvm::raw_fd_ostream os(OutputFilename, EC,
llvm::sys::fs::OpenFlags::F_None);

if (api_notes::decompileAPINotes(std::move(fileBufOrErr.get()), os))
return 1;

os.flush();

return os.has_error();
}

case api_notes::ActionType::Dump:
return api_notes::parseAndDumpAPINotes(input);
}

return 1;
}

4 changes: 4 additions & 0 deletions tools/driver/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ extern int cc1_main(ArrayRef<const char *> Argv, const char *Argv0,
void *MainAddr);
extern int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0,
void *MainAddr);
extern int cc1apinotes_main(ArrayRef<const char *> Argv, const char *Argv0,
void *MainAddr);

static void insertTargetAndModeArgs(StringRef Target, StringRef Mode,
SmallVectorImpl<const char *> &ArgVector,
Expand Down Expand Up @@ -301,6 +303,8 @@ static int ExecuteCC1Tool(ArrayRef<const char *> argv, StringRef Tool) {
return cc1_main(argv.slice(2), argv[0], GetExecutablePathVP);
if (Tool == "as")
return cc1as_main(argv.slice(2), argv[0], GetExecutablePathVP);
if (Tool == "apinotes")
return cc1apinotes_main(argv.slice(2), argv[0], GetExecutablePathVP);

// Reject unknown tools.
llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
Expand Down
1 change: 1 addition & 0 deletions tools/libclang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ set(SOURCES

set(LIBS
clangAST
clangAPINotes
clangBasic
clangFrontend
clangIndex
Expand Down
2 changes: 1 addition & 1 deletion tools/libclang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ USEDLIBS = clangIndex.a clangARCMigrate.a \
clangRewrite.a \
clangAnalysis.a clangEdit.a \
clangASTMatchers.a \
clangAST.a clangLex.a clangBasic.a
clangAST.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/Makefile

Expand Down
51 changes: 51 additions & 0 deletions unittests/AST/DeclTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//

#include "MatchVerifier.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/Tooling.h"
#include "gtest/gtest.h"
Expand Down Expand Up @@ -57,3 +58,53 @@ TEST(Decl, CleansUpAPValues) {
"constexpr _Complex __uint128_t c = 0xffffffffffffffff;",
Args));
}

TEST(Decl, Availability) {
const char *CodeStr = "int x __attribute__((availability(macosx, "
"introduced=10.2, deprecated=10.8, obsoleted=10.10)));";
auto Matcher = varDecl(hasName("x"));
std::vector<std::string> Args = {"-target", "x86_64-apple-macosx10.9"};

class AvailabilityVerifier : public MatchVerifier<clang::VarDecl> {
public:
void verify(const MatchFinder::MatchResult &Result,
const clang::VarDecl &Node) override {
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 1)) !=
clang::AR_NotYetIntroduced) {
setFailure("failed introduced");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 2)) !=
clang::AR_Available) {
setFailure("failed available (exact)");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 3)) !=
clang::AR_Available) {
setFailure("failed available");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 8)) !=
clang::AR_Deprecated) {
setFailure("failed deprecated (exact)");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 9)) !=
clang::AR_Deprecated) {
setFailure("failed deprecated");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 10)) !=
clang::AR_Unavailable) {
setFailure("failed obsoleted (exact)");
}
if (Node.getAvailability(nullptr, clang::VersionTuple(10, 11)) !=
clang::AR_Unavailable) {
setFailure("failed obsoleted");
}

if (Node.getAvailability() != clang::AR_Deprecated)
setFailure("did not default to target OS version");

setSuccess();
}
};

AvailabilityVerifier Verifier;
EXPECT_TRUE(Verifier.match(CodeStr, Matcher, Args, Lang_C));
}
3 changes: 2 additions & 1 deletion unittests/AST/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
clangRewrite.a clangRewriteFrontend.a \
clangParse.a clangSema.a clangAnalysis.a \
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a \
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
3 changes: 2 additions & 1 deletion unittests/ASTMatchers/Dynamic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
clangDynamicASTMatchers.a \
clangAnalysis.a clangEdit.a clangAST.a clangASTMatchers.a \
clangLex.a \
clangBasic.a
clangBasic.a \
clangAPINotes.a

include $(CLANG_LEVEL)/unittests/Makefile
3 changes: 2 additions & 1 deletion unittests/ASTMatchers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
clangRewrite.a clangRewriteFrontend.a \
clangParse.a clangSema.a clangAnalysis.a \
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a \
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
2 changes: 1 addition & 1 deletion unittests/CodeGen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader mc option \
USEDLIBS = clangCodeGen.a clangFrontend.a clangSerialization.a \
clangDriver.a \
clangParse.a clangSema.a clangAnalysis.a \
clangEdit.a clangAST.a clangLex.a clangBasic.a
clangEdit.a clangAST.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
2 changes: 1 addition & 1 deletion unittests/Format/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangFormat.a clangTooling.a clangToolingCore.a clangFrontend.a \
clangSerialization.a clangDriver.a clangParse.a clangRewrite.a \
clangRewriteFrontend.a clangSema.a clangAnalysis.a clangEdit.a \
clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
clangAST.a clangASTMatchers.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
2 changes: 1 addition & 1 deletion unittests/Frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
clangStaticAnalyzerCheckers.a clangStaticAnalyzerCore.a \
clangARCMigrate.a clangRewrite.a \
clangRewriteFrontend.a clangEdit.a \
clangAnalysis.a clangAST.a clangLex.a clangBasic.a
clangAnalysis.a clangAST.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
1 change: 1 addition & 0 deletions unittests/Lex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ target_link_libraries(LexTests
clangAST
clangBasic
clangLex
clangAPINotes
clangParse
clangSema
)
2 changes: 1 addition & 1 deletion unittests/Lex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ CLANG_LEVEL = ../..
TESTNAME = Lex
LINK_COMPONENTS := mcparser support mc bitreader
USEDLIBS = clangParse.a clangSema.a clangAnalysis.a clangEdit.a \
clangSerialization.a clangAST.a clangLex.a clangBasic.a
clangSerialization.a clangAST.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
3 changes: 2 additions & 1 deletion unittests/Sema/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \
clangRewrite.a clangRewriteFrontend.a \
clangParse.a clangSema.a clangAnalysis.a \
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
clangEdit.a clangAST.a clangASTMatchers.a clangLex.a \
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
2 changes: 1 addition & 1 deletion unittests/Tooling/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ USEDLIBS = clangTooling.a clangToolingCore.a clangFrontend.a \
clangSerialization.a clangDriver.a \
clangParse.a clangRewrite.a clangRewriteFrontend.a \
clangSema.a clangAnalysis.a clangEdit.a \
clangAST.a clangASTMatchers.a clangLex.a clangBasic.a
clangAST.a clangASTMatchers.a clangLex.a clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile
2 changes: 1 addition & 1 deletion unittests/libclang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ USEDLIBS = clang.a \
clangToolingCore.a \
clangSerialization.a clangParse.a clangSema.a \
clangAnalysis.a clangEdit.a clangAST.a clangLex.a \
clangBasic.a
clangAPINotes.a clangBasic.a

include $(CLANG_LEVEL)/unittests/Makefile