mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-30 17:21:10 +00:00
98322d3eb4
The attributes changes were left out of Clang 17. Attributes that used to take a string literal now accept an unevaluated string literal instead, which means they reject numeric escape sequences and strings literal with an encoding prefix - but the later was already ill-formed in most cases. We need to know that we are going to parse an unevaluated string literal before we do - so we can reject numeric escape sequence, so we derive from Attrs.td which attributes parameters are expected to be string literals. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D156237
39 lines
1.3 KiB
Objective-C
39 lines
1.3 KiB
Objective-C
// RUN: %clang_cc1 -verify -fsyntax-only %s
|
|
|
|
// expected-error@+1 {{'__swift_bridge__' attribute takes one argument}}
|
|
__attribute__((__swift_bridge__))
|
|
@interface I
|
|
@end
|
|
|
|
// expected-error@+1 {{expected string literal as argument of '__swift_bridge__' attribute}}
|
|
__attribute__((__swift_bridge__(1)))
|
|
@interface J
|
|
@end
|
|
|
|
// expected-error@+1 {{'__swift_bridge__' attribute takes one argument}}
|
|
__attribute__((__swift_bridge__("K", 1)))
|
|
@interface K
|
|
@end
|
|
|
|
@interface L
|
|
// expected-error@+1 {{'__swift_bridge__' attribute only applies to tag types, typedefs, Objective-C interfaces, and Objective-C protocols}}
|
|
- (void)method __attribute__((__swift_bridge__("method")));
|
|
@end
|
|
|
|
__attribute__((__swift_bridge__("Array")))
|
|
@interface NSArray
|
|
@end
|
|
|
|
__attribute__((__swift_bridge__("ProtocolP")))
|
|
@protocol P
|
|
@end
|
|
|
|
typedef NSArray *NSArrayAlias __attribute__((__swift_bridge__("ArrayAlias")));
|
|
|
|
struct __attribute__((__swift_bridge__("StructT"))) T {};
|
|
|
|
// Duplicate attributes with the same arguments are fine.
|
|
struct __attribute__((swift_bridge("foo"), swift_bridge("foo"))) S;
|
|
// Duplicate attributes with different arguments are not.
|
|
struct __attribute__((swift_bridge("foo"), swift_bridge("bar"))) S; // expected-warning {{attribute 'swift_bridge' is already applied with different arguments}}
|