diff options
-rw-r--r-- | clang/include/clang/Basic/Attr.td | 4 | ||||
-rw-r--r-- | clang/test/Sema/attr-external-source-symbol.c | 14 | ||||
-rw-r--r-- | clang/test/Sema/internal_linkage.c | 8 |
3 files changed, 22 insertions, 4 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index aa3cc6944bb..e14ce0da91b 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -723,7 +723,7 @@ static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) { } def ExternalSourceSymbol : InheritableAttr { - let Spellings = [Clang<"external_source_symbol">]; + let Spellings = [Clang<"external_source_symbol", 1>]; let Args = [StringArgument<"language", 1>, StringArgument<"definedIn", 1>, BoolArgument<"generatedDeclaration", 1>]; @@ -2817,7 +2817,7 @@ def OMPDeclareTargetDecl : Attr { } def InternalLinkage : InheritableAttr { - let Spellings = [Clang<"internal_linkage">]; + let Spellings = [Clang<"internal_linkage", 1>]; let Subjects = SubjectList<[Var, Function, CXXRecord]>; let Documentation = [InternalLinkageDocs]; } diff --git a/clang/test/Sema/attr-external-source-symbol.c b/clang/test/Sema/attr-external-source-symbol.c index af6e6bc79e7..dfed609c8e8 100644 --- a/clang/test/Sema/attr-external-source-symbol.c +++ b/clang/test/Sema/attr-external-source-symbol.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify -fdouble-square-bracket-attributes %s void threeClauses() __attribute__((external_source_symbol(language="Swift", defined_in="module", generated_declaration))); @@ -17,3 +17,15 @@ void namedDeclsOnly() { return 1; }; } + +void threeClauses2() [[clang::external_source_symbol(language="Swift", defined_in="module", generated_declaration)]]; + +void twoClauses2() [[clang::external_source_symbol(language="Swift", defined_in="module")]]; + +void fourClauses2() +[[clang::external_source_symbol(language="Swift", defined_in="module", generated_declaration, generated_declaration)]]; // expected-error {{duplicate 'generated_declaration' clause in an 'external_source_symbol' attribute}} + +void oneClause2() [[clang::external_source_symbol(generated_declaration)]]; + +void noArguments2() +[[clang::external_source_symbol]]; // expected-error {{'external_source_symbol' attribute takes at least 1 argument}} diff --git a/clang/test/Sema/internal_linkage.c b/clang/test/Sema/internal_linkage.c index 37090a33331..57315d826e2 100644 --- a/clang/test/Sema/internal_linkage.c +++ b/clang/test/Sema/internal_linkage.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -fdouble-square-bracket-attributes %s int var __attribute__((internal_linkage)); int var2 __attribute__((internal_linkage,common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \ @@ -19,3 +19,9 @@ struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_link }; __attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}} + +int var6 [[clang::internal_linkage]]; +int var7 [[clang::internal_linkage]] __attribute__((common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \ + // expected-note{{conflicting attribute is here}} +__attribute__((common)) int var8 [[clang::internal_linkage]]; // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \ + // expected-note{{conflicting attribute is here}} |