diff --git a/clang/include/clang/Basic/AttributeCommonInfo.h b/clang/include/clang/Basic/AttributeCommonInfo.h index 21a7a88a3fb98..77b5eb8a1a7cc 100644 --- a/clang/include/clang/Basic/AttributeCommonInfo.h +++ b/clang/include/clang/Basic/AttributeCommonInfo.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H #include "clang/Basic/AttributeScopeInfo.h" +#include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/TokenKinds.h" @@ -175,6 +176,10 @@ class AttributeCommonInfo { : AttributeCommonInfo(nullptr, AttributeScopeInfo(), AttrRange, K, FormUsed) {} + AttributeCommonInfo(SourceRange AttrRange, AttributeScopeInfo AttrScope, + Kind K, Form FormUsed) + : AttributeCommonInfo(nullptr, AttrScope, AttrRange, K, FormUsed) {} + AttributeCommonInfo(AttributeCommonInfo &&) = default; AttributeCommonInfo(const AttributeCommonInfo &) = default; @@ -292,6 +297,18 @@ inline bool doesKeywordAttributeTakeArgs(tok::TokenKind Kind) { } } +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const AttributeCommonInfo *CI) { + DB.AddTaggedVal(reinterpret_cast(CI), + DiagnosticsEngine::ak_attr_info); + return DB; +} + +inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, + const AttributeCommonInfo &CI) { + return DB << &CI; +} + } // namespace clang #endif // LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H diff --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h index 7ae4ef7df138c..c7a627600f3cc 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -289,6 +289,9 @@ class DiagnosticsEngine : public RefCountedBase { /// Expr * ak_expr, + + /// AttributeCommonInfo * + ak_attr_info, }; /// Represents on argument value, which is a union discriminated diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 968edd967e0c5..49cf1154bff2a 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3290,10 +3290,11 @@ def err_attribute_wrong_number_arguments : Error< def err_attribute_wrong_number_arguments_for : Error < "%0 attribute references function %1, which %plural{0:takes no arguments|1:takes one argument|" ":takes exactly %2 arguments}2">; -def err_callback_attribute_wrong_arg_count : Error< - "'callback' attribute references function of type %0 which expects %1 " - "%plural{1:argument|:arguments}1 but attribute specifies %2 parameter index " - "%plural{1:argument|:arguments}2">; +def err_attribute_wrong_arg_count_for_func + : Error<"%0 attribute references function of type %1 which expects %2 " + "%plural{1:argument|:arguments}2 but attribute specifies %3 " + "parameter index " + "%plural{1:argument|:arguments}3">; def err_attribute_bounds_for_function : Error< "%0 attribute references parameter %1, but the function %2 has only %3 parameters">; def err_attribute_no_member_function : Error< @@ -4712,9 +4713,9 @@ def note_protocol_decl : Note< "protocol is declared here">; def note_protocol_decl_undefined : Note< "protocol %0 has no definition">; -def err_attribute_preferred_name_arg_invalid : Error< - "argument %0 to 'preferred_name' attribute is not a typedef for " - "a specialization of %1">; +def err_attribute_not_typedef_for_specialization + : Error<"argument %0 to %1 attribute is not a typedef for " + "a specialization of %2">; def err_attribute_builtin_alias : Error< "%0 attribute can only be applied to a ARM, HLSL, SPIR-V or RISC-V builtin">; diff --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h index 6b3c5a173417a..18d52782db2c5 100644 --- a/clang/include/clang/Sema/ParsedAttr.h +++ b/clang/include/clang/Sema/ParsedAttr.h @@ -1094,45 +1094,6 @@ enum AttributeDeclKind { ExpectedTypedef, }; -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ParsedAttr &At) { - DB.AddTaggedVal(reinterpret_cast(At.getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ParsedAttr *At) { - DB.AddTaggedVal(reinterpret_cast(At->getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - -/// AttributeCommonInfo has a non-explicit constructor which takes an -/// SourceRange as its only argument, this constructor has many uses so making -/// it explicit is hard. This constructor causes ambiguity with -/// DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, SourceRange R). -/// We use SFINAE to disable any conversion and remove any ambiguity. -template < - typename ACI, - std::enable_if_t::value, int> = 0> -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI &CI) { - DB.AddTaggedVal(reinterpret_cast(CI.getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - -template < - typename ACI, - std::enable_if_t::value, int> = 0> -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI *CI) { - DB.AddTaggedVal(reinterpret_cast(CI->getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - } // namespace clang #endif // LLVM_CLANG_SEMA_PARSEDATTR_H diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 20a4c3a43d2ca..0fa9234159f22 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -506,7 +506,15 @@ void clang::FormatASTNodeDiagnosticArgument( case DiagnosticsEngine::ak_attr: { const Attr *At = reinterpret_cast(Val); assert(At && "Received null Attr object!"); - OS << '\'' << At->getSpelling() << '\''; + + OS << '\''; + if (At->hasScope()) { + OS << At->getNormalizedFullName(At->getScopeName()->getName(), + At->getSpelling()); + } else { + OS << At->getSpelling(); + } + OS << '\''; NeedQuotes = false; break; } @@ -516,6 +524,20 @@ void clang::FormatASTNodeDiagnosticArgument( E->printPretty(OS, /*Helper=*/nullptr, Context.getPrintingPolicy()); break; } + case DiagnosticsEngine::ak_attr_info: { + AttributeCommonInfo *AT = reinterpret_cast(Val); + assert(AT && "Received null AttributeCommonInfo object!"); + + OS << '\''; + if (AT->isStandardAttributeSyntax()) { + OS << AT->getNormalizedFullName(); + } else { + OS << AT->getAttrName()->getName(); + } + OS << '\''; + NeedQuotes = false; + break; + } } if (NeedQuotes) { diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index ab0525e96f3ba..e33e843db6a44 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -1348,6 +1348,7 @@ void Diagnostic::FormatDiagnostic(const char *DiagStr, const char *DiagEnd, case DiagnosticsEngine::ak_declcontext: case DiagnosticsEngine::ak_attr: case DiagnosticsEngine::ak_expr: + case DiagnosticsEngine::ak_attr_info: getDiags()->ConvertArgToString(Kind, getRawArg(ArgNo), StringRef(Modifier, ModifierLen), StringRef(Argument, ArgumentLen), diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c5d5d03cc99c7..7ebb53318702c 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1226,8 +1226,8 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) { } } - S.Diag(AL.getLoc(), diag::err_attribute_preferred_name_arg_invalid) - << T << CTD; + S.Diag(AL.getLoc(), diag::err_attribute_not_typedef_for_specialization) + << T << AL << CTD; if (const auto *TT = T->getAs()) S.Diag(TT->getDecl()->getLocation(), diag::note_entity_declared_at) << TT->getDecl(); @@ -4194,8 +4194,9 @@ static void handleCallbackAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } if (CalleeFnProtoType->getNumParams() != EncodingIndices.size() - 1) { - S.Diag(AL.getLoc(), diag::err_callback_attribute_wrong_arg_count) - << QualType{CalleeFnProtoType, 0} << CalleeFnProtoType->getNumParams() + S.Diag(AL.getLoc(), diag::err_attribute_wrong_arg_count_for_func) + << AL << QualType{CalleeFnProtoType, 0} + << CalleeFnProtoType->getNumParams() << (unsigned)(EncodingIndices.size() - 1); return; } @@ -8020,9 +8021,7 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) { } void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { - std::string NormalizedFullName = '\'' + AL.getNormalizedFullName() + '\''; SourceRange NR = AL.getNormalizedRange(); - StringRef ScopeName = AL.getNormalizedScopeName(); std::optional CorrectedScopeName = AL.tryGetCorrectedScopeName(ScopeName); @@ -8044,7 +8043,7 @@ void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { Diag(CorrectedScopeName ? NR.getBegin() : AL.getRange().getBegin(), diag::warn_unknown_attribute_ignored_suggestion); - D << NormalizedFullName << CorrectedFullName; + D << AL << CorrectedFullName; if (AL.isExplicitScope()) { D << FixItHint::CreateReplacement(NR, CorrectedFullName) << NR; @@ -8058,8 +8057,7 @@ void Sema::DiagnoseUnknownAttribute(const ParsedAttr &AL) { } } } else { - Diag(NR.getBegin(), diag::warn_unknown_attribute_ignored) - << NormalizedFullName << NR; + Diag(NR.getBegin(), diag::warn_unknown_attribute_ignored) << AL << NR; } } diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index ba55f8263e475..968b96990bd85 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -1640,6 +1640,15 @@ bool SemaHLSL::handleResourceTypeAttr(QualType T, const ParsedAttr &AL) { return false; Attr *A = nullptr; + + AttributeCommonInfo ACI( + AL.getLoc(), AttributeScopeInfo(AL.getScopeName(), AL.getScopeLoc()), + AttributeCommonInfo::NoSemaHandlerAttribute, + { + AttributeCommonInfo::AS_CXX11, 0, false /*IsAlignas*/, + false /*IsRegularKeywordAttribute*/ + }); + switch (AL.getKind()) { case ParsedAttr::AT_HLSLResourceClass: { if (!AL.isArgIdent(0)) { @@ -1659,16 +1668,16 @@ bool SemaHLSL::handleResourceTypeAttr(QualType T, const ParsedAttr &AL) { << "ResourceClass" << Identifier; return false; } - A = HLSLResourceClassAttr::Create(getASTContext(), RC, AL.getLoc()); + A = HLSLResourceClassAttr::Create(getASTContext(), RC, ACI); break; } case ParsedAttr::AT_HLSLROV: - A = HLSLROVAttr::Create(getASTContext(), AL.getLoc()); + A = HLSLROVAttr::Create(getASTContext(), ACI); break; case ParsedAttr::AT_HLSLRawBuffer: - A = HLSLRawBufferAttr::Create(getASTContext(), AL.getLoc()); + A = HLSLRawBufferAttr::Create(getASTContext(), ACI); break; case ParsedAttr::AT_HLSLContainedType: { @@ -1683,7 +1692,7 @@ bool SemaHLSL::handleResourceTypeAttr(QualType T, const ParsedAttr &AL) { if (SemaRef.RequireCompleteType(TSI->getTypeLoc().getBeginLoc(), QT, diag::err_incomplete_type)) return false; - A = HLSLContainedTypeAttr::Create(getASTContext(), TSI, AL.getLoc()); + A = HLSLContainedTypeAttr::Create(getASTContext(), TSI, ACI); break; } diff --git a/clang/test/AST/ByteCode/functions.cpp b/clang/test/AST/ByteCode/functions.cpp index a767d104b3c8a..b5e6f5bd7ece2 100644 --- a/clang/test/AST/ByteCode/functions.cpp +++ b/clang/test/AST/ByteCode/functions.cpp @@ -637,7 +637,7 @@ namespace { namespace { /// The InitListExpr here is of void type. - void bir [[clang::annotate("B", {1, 2, 3, 4})]] (); // both-error {{'annotate' attribute requires parameter 1 to be a constant expression}} \ + void bir [[clang::annotate("B", {1, 2, 3, 4})]] (); // both-error {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} \ // both-note {{subexpression not valid in a constant expression}} } diff --git a/clang/test/C/C23/n3037.c b/clang/test/C/C23/n3037.c index 966b583c9f376..ce6f4c4ea7acf 100644 --- a/clang/test/C/C23/n3037.c +++ b/clang/test/C/C23/n3037.c @@ -60,7 +60,7 @@ union purr { float y; int x; }; // c23-error {{type 'union purr' has incompatibl // The presence of an attribute makes two types not compatible. struct [[gnu::packed]] attr_test { // c17-note {{previous definition is here}} \ - c23-note {{attribute 'packed' here}} + c23-note {{attribute 'gnu::packed' here}} int x; }; @@ -75,26 +75,26 @@ struct attr_test_2 { // c17-note {{previous definition is here}} struct [[gnu::packed]] attr_test_2 { // c17-error {{redefinition of 'attr_test_2'}} \ c23-error {{type 'struct attr_test_2' has an attribute which currently causes the types to be treated as though they are incompatible}} \ - c23-note {{attribute 'packed' here}} + c23-note {{attribute 'gnu::packed' here}} int x; }; // This includes the same attribute on both types. struct [[gnu::packed]] attr_test_3 { // c17-note {{previous definition is here}} \ - c23-note {{attribute 'packed' here}} + c23-note {{attribute 'gnu::packed' here}} int x; }; struct [[gnu::packed]] attr_test_3 { // c17-error {{redefinition of 'attr_test_3'}} \ c23-error {{type 'struct attr_test_3' has an attribute which currently causes the types to be treated as though they are incompatible}} \ - c23-note {{attribute 'packed' here}} + c23-note {{attribute 'gnu::packed' here}} int x; }; // Everything which applies to the tag itself also applies to fields. struct field_attr_test_1 { // c17-note {{previous definition is here}} int x; - [[gnu::packed]] int y; // c23-note {{attribute 'packed' here}} + [[gnu::packed]] int y; // c23-note {{attribute 'gnu::packed' here}} }; struct field_attr_test_1 { // c17-error {{redefinition of 'field_attr_test_1'}} \ @@ -104,7 +104,7 @@ struct field_attr_test_1 { // c17-error {{redefinition of 'field_attr_test_1'}} }; struct field_attr_test_2 { // c17-note {{previous definition is here}} - [[gnu::packed]] int x; // c23-note {{attribute 'packed' here}} + [[gnu::packed]] int x; // c23-note {{attribute 'gnu::packed' here}} int y; }; @@ -115,13 +115,13 @@ struct field_attr_test_2 { // c17-error {{redefinition of 'field_attr_test_2'}} }; struct field_attr_test_3 { // c17-note {{previous definition is here}} - [[gnu::packed]] int x; // c23-note {{attribute 'packed' here}} + [[gnu::packed]] int x; // c23-note {{attribute 'gnu::packed' here}} int y; }; struct field_attr_test_3 { // c17-error {{redefinition of 'field_attr_test_3'}} \ c23-error {{type 'struct field_attr_test_3' has a member with an attribute which currently causes the types to be treated as though they are incompatible}} - int x [[gnu::packed]]; // c23-note {{attribute 'packed' here}} + int x [[gnu::packed]]; // c23-note {{attribute 'gnu::packed' here}} int y; }; diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp index 84d84a61a8d26..fdb370f7685ff 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp @@ -6,7 +6,7 @@ void test_attributes() { auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-error{{non-void lambda does not return a value in all control paths}} // FIXME: GCC accepts the [[gnu::noreturn]] attribute here. - auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}} + auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'gnu::noreturn' ignored}} } template diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp index 7a570e07c2126..062d1b5f27342 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp @@ -3,7 +3,7 @@ template void test_attributes() { // FIXME: GCC accepts [[gnu::noreturn]] here. - auto nrl = []() [[gnu::noreturn]] {}; // expected-warning{{attribute 'noreturn' ignored}} + auto nrl = []() [[gnu::noreturn]] {}; // expected-warning{{attribute 'gnu::noreturn' ignored}} } template void test_attributes(); diff --git a/clang/test/CodeGen/RISCV/riscv-vector-callingconv.c b/clang/test/CodeGen/RISCV/riscv-vector-callingconv.c index 6a71d1a9db81f..997deec17ba08 100644 --- a/clang/test/CodeGen/RISCV/riscv-vector-callingconv.c +++ b/clang/test/CodeGen/RISCV/riscv-vector-callingconv.c @@ -11,7 +11,7 @@ void __attribute__((riscv_vector_cc)) test_no_attribute(int x) { } // expected-e [[riscv::vector_cc]] int var2; // expected-warning {{'vector_cc' only applies to function types; type here is 'int'}} [[riscv::vector_cc]] void func2(); -[[riscv::vector_cc(1)]] void func_invalid2(); // expected-error {{'vector_cc' attribute takes no arguments}} +[[riscv::vector_cc(1)]] void func_invalid2(); // expected-error {{'riscv::vector_cc' attribute takes no arguments}} void test_no_attribute2(int); // expected-note {{previous declaration is here}} [[riscv::vector_cc]] void test_no_attribute2(int x) { } // expected-error {{function declared 'riscv_vector_cc' here was previously declared without calling convention}} diff --git a/clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp b/clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp index f041b0d36529c..9386c64b5c23f 100644 --- a/clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp +++ b/clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp @@ -20,7 +20,7 @@ void test_lambda() { [[riscv::vector_cc]] int var2; // expected-warning {{'vector_cc' only applies to function types; type here is 'int'}} [[riscv::vector_cc]] void func2(); -[[riscv::vector_cc(1)]] void func_invalid2(); // expected-error {{'vector_cc' attribute takes no arguments}} +[[riscv::vector_cc(1)]] void func_invalid2(); // expected-error {{'riscv::vector_cc' attribute takes no arguments}} void test_no_attribute2(int); // expected-note {{previous declaration is here}} [[riscv::vector_cc]] void test_no_attribute2(int x) { } // expected-error {{function declared 'riscv_vector_cc' here was previously declared without calling convention}} diff --git a/clang/test/Frontend/noderef.c b/clang/test/Frontend/noderef.c index a376f2d68d91b..3f0d8269ca88d 100644 --- a/clang/test/Frontend/noderef.c +++ b/clang/test/Frontend/noderef.c @@ -227,18 +227,18 @@ int test(void) { // ignored. // For details see https://github.com/llvm/llvm-project/issues/55790 void test_standard_syntax() { - [[clang::noderef]] int i; // expected-warning {{'noderef' attribute ignored}} + [[clang::noderef]] int i; // expected-warning {{'clang::noderef' attribute ignored}} - [[clang::noderef]] int *p1; // expected-warning {{'noderef' attribute ignored}} + [[clang::noderef]] int *p1; // expected-warning {{'clang::noderef' attribute ignored}} *p1; - int *p2 [[clang::noderef]]; // expected-warning {{'noderef' attribute ignored}} + int *p2 [[clang::noderef]]; // expected-warning {{'clang::noderef' attribute ignored}} *p2; - int * [[clang::noderef]] p3; // expected-warning {{'noderef' attribute ignored}} + int * [[clang::noderef]] p3; // expected-warning {{'clang::noderef' attribute ignored}} *p3; typedef int* IntPtr; - [[clang::noderef]] IntPtr p4; // expected-warning {{'noderef' attribute ignored}} + [[clang::noderef]] IntPtr p4; // expected-warning {{'clang::noderef' attribute ignored}} *p4; } diff --git a/clang/test/OpenMP/attr-assume.cpp b/clang/test/OpenMP/attr-assume.cpp index 2d807d9a00b0d..9046ebd4bd45b 100644 --- a/clang/test/OpenMP/attr-assume.cpp +++ b/clang/test/OpenMP/attr-assume.cpp @@ -7,8 +7,8 @@ [[omp::assume("omp_noopenmp")]] void f6(); // expected-warning {{unknown assumption string 'omp_noopenmp' may be misspelled; attribute is potentially ignored, did you mean 'omp_no_openmp'?}} [[omp::assume("omp_no_openmp_routine")]] void f7(); // expected-warning {{unknown assumption string 'omp_no_openmp_routine' may be misspelled; attribute is potentially ignored, did you mean 'omp_no_openmp_routines'?}} [[omp::assume("omp_no_openmp1")]] void f8(); // expected-warning {{unknown assumption string 'omp_no_openmp1' may be misspelled; attribute is potentially ignored, did you mean 'omp_no_openmp'?}} -[[omp::assume("omp_no_openmp", "omp_no_openmp")]] void f9(); // expected-error {{'assume' attribute takes one argument}} +[[omp::assume("omp_no_openmp", "omp_no_openmp")]] void f9(); // expected-error {{'omp::assume' attribute takes one argument}} [[omp::assume("omp_no_openmp_construct")]] void f10(); // expected-warning {{unknown assumption string 'omp_no_openmp_construct' may be misspelled; attribute is potentially ignored, did you mean 'omp_no_openmp_constructs'?}} [[omp::assume(3)]] int g1; // expected-error {{expected string literal as argument of 'assume' attribute}} -[[omp::assume("omp_no_openmp")]] int g2; // expected-warning {{'assume' attribute only applies to functions and Objective-C methods}} +[[omp::assume("omp_no_openmp")]] int g2; // expected-warning {{'omp::assume' attribute only applies to functions and Objective-C methods}} diff --git a/clang/test/OpenMP/ompx_attributes_messages.cpp b/clang/test/OpenMP/ompx_attributes_messages.cpp index c59c19027d26f..3e3ade0eb6acf 100644 --- a/clang/test/OpenMP/ompx_attributes_messages.cpp +++ b/clang/test/OpenMP/ompx_attributes_messages.cpp @@ -20,9 +20,9 @@ void bad() { {} #pragma omp target ompx_attribute(__attribute__((amdgpu_flat_work_group_size(1, 2, 3,)))) // expected-error {{expected expression}} {} - #pragma omp target ompx_attribute([[clang::amdgpu_waves_per_eu(1, 2, 3)]]) // expected-error {{'amdgpu_waves_per_eu' attribute takes no more than 2 arguments}} + #pragma omp target ompx_attribute([[clang::amdgpu_waves_per_eu(1, 2, 3)]]) // expected-error {{'clang::amdgpu_waves_per_eu' attribute takes no more than 2 arguments}} {} - #pragma omp target ompx_attribute([[clang::unknown]]) // expected-warning {{'ompx_attribute' clause only allows 'amdgpu_flat_work_group_size', 'amdgpu_waves_per_eu', and 'launch_bounds'; 'unknown' is ignored}} + #pragma omp target ompx_attribute([[clang::unknown]]) // expected-warning {{'ompx_attribute' clause only allows 'amdgpu_flat_work_group_size', 'amdgpu_waves_per_eu', and 'launch_bounds'; 'clang::unknown' is ignored}} {} #pragma omp target ompx_attribute(baz) // expected-error {{expected ')'}} expected-note {{to match this '('}} {} diff --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c index ecc0ef95a25b8..0eb89ea72c1c9 100644 --- a/clang/test/Parser/asm.c +++ b/clang/test/Parser/asm.c @@ -14,7 +14,7 @@ void f2(void) { asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}} [[]] asm(""); - [[gnu::deprecated]] asm(""); // expected-warning {{'deprecated' attribute ignored}} + [[gnu::deprecated]] asm(""); // expected-warning {{'gnu::deprecated' attribute ignored}} } void a(void) __asm__(""); // expected-error {{cannot use an empty string literal in 'asm'}} diff --git a/clang/test/Parser/asm.cpp b/clang/test/Parser/asm.cpp index 4d590992f6b09..cf23b6f42a077 100644 --- a/clang/test/Parser/asm.cpp +++ b/clang/test/Parser/asm.cpp @@ -10,7 +10,7 @@ int foo6 asm ("" L"bar7"); // expected-error {{cannot use wide string literal in void f() { [[]] asm(""); - [[gnu::deprecated]] asm(""); // expected-warning {{'deprecated' attribute ignored}} + [[gnu::deprecated]] asm(""); // expected-warning {{'gnu::deprecated' attribute ignored}} } diff --git a/clang/test/Parser/atomic-options.hip b/clang/test/Parser/atomic-options.hip index 4deb9677766c6..f4928cd02a0c5 100644 --- a/clang/test/Parser/atomic-options.hip +++ b/clang/test/Parser/atomic-options.hip @@ -33,13 +33,13 @@ __device__ __host__ void test_invalid_format(float *a) { } } -[[clang::atomic(no_remote_memory)]] // expected-error {{'atomic' attribute cannot be applied to a declaration}} +[[clang::atomic(no_remote_memory)]] // expected-error {{'clang::atomic' attribute cannot be applied to a declaration}} __device__ __host__ void test_not_compound_stmt(float *a) { __scoped_atomic_fetch_add(a, 1, __ATOMIC_RELAXED, __MEMORY_SCOPE_SYSTEM); } __device__ __host__ void test_quoted(float *a) { - [[clang::atomic("no_remote_memory", "remote_memory")]] { // expected-error {{'atomic' attribute requires an identifier}} + [[clang::atomic("no_remote_memory", "remote_memory")]] { // expected-error {{'clang::atomic' attribute requires an identifier}} __scoped_atomic_fetch_add(a, 1, __ATOMIC_RELAXED, __MEMORY_SCOPE_SYSTEM); } } diff --git a/clang/test/Parser/cxx0x-attributes.cpp b/clang/test/Parser/cxx0x-attributes.cpp index 372a373a49ec5..417c103f60d97 100644 --- a/clang/test/Parser/cxx0x-attributes.cpp +++ b/clang/test/Parser/cxx0x-attributes.cpp @@ -292,7 +292,7 @@ template void variadic_nttp() { void bar [[noreturn...]] (); // expected-error {{attribute 'noreturn' cannot be used as an attribute pack}} void baz [[clang::no_sanitize(Is...)]] (); // expected-error {{expected string literal as argument of 'no_sanitize' attribute}} void bor [[clang::annotate("A", "V" ...)]] (); // expected-error {{pack expansion does not contain any unexpanded parameter packs}} - void bir [[clang::annotate("B", {1, 2, 3, 4})]] (); // expected-error {{'annotate' attribute requires parameter 1 to be a constant expression}} expected-note {{subexpression not valid in a constant expression}} + void bir [[clang::annotate("B", {1, 2, 3, 4})]] (); // expected-error {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} expected-note {{subexpression not valid in a constant expression}} void boo [[unknown::foo(Is...)]] (); // expected-warning {{unknown attribute 'unknown::foo' ignored}} void faz [[clang::annotate("C", (Is + ...))]] (); // expected-warning {{pack fold expression is a C++17 extension}} void far [[clang::annotate("D", Is...)]] (); @@ -306,8 +306,8 @@ void bar () { // FIXME: GCC accepts [[gnu::noreturn]] on a lambda, even though it appertains // to the operator()'s type, and GCC does not otherwise accept attributes // applied to types. Use that to test this. - [] () [[gnu::noreturn]] { return; } (); // expected-warning {{attribute 'noreturn' ignored}} FIXME-error {{should not return}} - [] () [[gnu::noreturn]] { throw; } (); // expected-warning {{attribute 'noreturn' ignored}} + [] () [[gnu::noreturn]] { return; } (); // expected-warning {{attribute 'gnu::noreturn' ignored}} FIXME-error {{should not return}} + [] () [[gnu::noreturn]] { throw; } (); // expected-warning {{attribute 'gnu::noreturn' ignored}} new int[42][[]][5][[]]{}; } @@ -350,16 +350,16 @@ namespace arguments { } // Forbid attributes on decl specifiers. -unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-error {{'unused' attribute cannot be applied to types}} \ +unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-error {{'gnu::unused' attribute cannot be applied to types}} \ expected-error {{an attribute list cannot appear here}} -typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-error {{'unused' attribute cannot be applied to types}} \ +typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-error {{'gnu::unused' attribute cannot be applied to types}} \ expected-error {{an attribute list cannot appear here}} int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-error 2{{'carries_dependency' attribute cannot be applied to types}} // Forbid [[gnu::...]] attributes on declarator chunks. -int *[[gnu::unused]] v3; // expected-warning {{attribute 'unused' ignored}} -int v4[2][[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}} -int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}} +int *[[gnu::unused]] v3; // expected-warning {{attribute 'gnu::unused' ignored}} +int v4[2][[gnu::unused]]; // expected-warning {{attribute 'gnu::unused' ignored}} +int v5()[[gnu::unused]]; // expected-warning {{attribute 'gnu::unused' ignored}} [[attribute_declaration]]; // expected-warning {{unknown attribute 'attribute_declaration' ignored}} [[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions}} diff --git a/clang/test/Parser/cxx0x-decl.cpp b/clang/test/Parser/cxx0x-decl.cpp index 6d4f16c6f533e..69a8d8a46557d 100644 --- a/clang/test/Parser/cxx0x-decl.cpp +++ b/clang/test/Parser/cxx0x-decl.cpp @@ -147,7 +147,7 @@ namespace UsingDeclAttrs { static_assert(alignof(T) == 1, ""); using [[gnu::aligned(1)]] T = int; // expected-error {{an attribute list cannot appear here}} - using T = int [[gnu::aligned(1)]]; // expected-error {{'aligned' attribute cannot be applied to types}} + using T = int [[gnu::aligned(1)]]; // expected-error {{'gnu::aligned' attribute cannot be applied to types}} } namespace DuplicateSpecifier { diff --git a/clang/test/Parser/pragma-attribute.cpp b/clang/test/Parser/pragma-attribute.cpp index d5b1f848abd06..eaf1a775c1c88 100644 --- a/clang/test/Parser/pragma-attribute.cpp +++ b/clang/test/Parser/pragma-attribute.cpp @@ -158,7 +158,7 @@ _Pragma("clang attribute pop"); #pragma clang attribute pop #pragma clang attribute push ([[fallthrough]], apply_to=function) // expected-error {{attribute 'fallthrough' is not supported by '#pragma clang attribute'}} -#pragma clang attribute push ([[clang::fallthrough]], apply_to=function) // expected-error {{attribute 'fallthrough' is not supported by '#pragma clang attribute'}} +#pragma clang attribute push ([[clang::fallthrough]], apply_to=function) // expected-error {{attribute 'clang::fallthrough' is not supported by '#pragma clang attribute'}} #pragma clang attribute push ([[]], apply_to = function) // A noop @@ -182,15 +182,15 @@ _Pragma("clang attribute pop"); #pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_local)) #pragma clang attribute pop -#pragma clang attribute push([[clang::uninitialized]], apply_to = function) // expected-error {{attribute 'uninitialized' cannot be applied to 'function'}} +#pragma clang attribute push([[clang::uninitialized]], apply_to = function) // expected-error {{attribute 'clang::uninitialized' cannot be applied to 'function'}} #pragma clang attribute pop -#pragma clang attribute push([[clang::uninitialized]], apply_to = variable) // expected-error {{attribute 'uninitialized' cannot be applied to 'variable'}} +#pragma clang attribute push([[clang::uninitialized]], apply_to = variable) // expected-error {{attribute 'clang::uninitialized' cannot be applied to 'variable'}} #pragma clang attribute pop -#pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_thread_local)) // expected-error {{attribute 'uninitialized' cannot be applied to 'variable(is_thread_local)'}} +#pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_thread_local)) // expected-error {{attribute 'clang::uninitialized' cannot be applied to 'variable(is_thread_local)'}} #pragma clang attribute pop -#pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_global)) // expected-error {{attribute 'uninitialized' cannot be applied to 'variable(is_global)'}} +#pragma clang attribute push([[clang::uninitialized]], apply_to = variable(is_global)) // expected-error {{attribute 'clang::uninitialized' cannot be applied to 'variable(is_global)'}} #pragma clang attribute pop -#pragma clang attribute push([[clang::uninitialized]], apply_to = any(variable(is_parameter), variable(unless(is_parameter)))) // expected-error {{attribute 'uninitialized' cannot be applied to 'variable(is_parameter)', and 'variable(unless(is_parameter))'}} +#pragma clang attribute push([[clang::uninitialized]], apply_to = any(variable(is_parameter), variable(unless(is_parameter)))) // expected-error {{attribute 'clang::uninitialized' cannot be applied to 'variable(is_parameter)', and 'variable(unless(is_parameter))'}} #pragma clang attribute pop // We're allowed to apply attributes to subsets of allowed subjects. #pragma clang attribute push([[clang::no_destroy]], apply_to = variable) diff --git a/clang/test/ParserHLSL/hlsl_contained_type_attr_error.hlsl b/clang/test/ParserHLSL/hlsl_contained_type_attr_error.hlsl index b2d492d95945c..5c8fe778e4abd 100644 --- a/clang/test/ParserHLSL/hlsl_contained_type_attr_error.hlsl +++ b/clang/test/ParserHLSL/hlsl_contained_type_attr_error.hlsl @@ -2,10 +2,10 @@ typedef vector float4; -// expected-error@+1{{'contained_type' attribute cannot be applied to a declaration}} +// expected-error@+1{{'hlsl::contained_type' attribute cannot be applied to a declaration}} [[hlsl::contained_type(float4)]] __hlsl_resource_t h1; -// expected-error@+1{{'contained_type' attribute takes one argument}} +// expected-error@+1{{'hlsl::contained_type' attribute takes one argument}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type()]] h3; // expected-error@+1{{expected a type}} @@ -17,12 +17,12 @@ __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(a)]] h5; // expected-error@+1{{expected a type}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type("b", c)]] h6; -// expected-warning@+1{{attribute 'contained_type' is already applied}} +// expected-warning@+1{{attribute 'hlsl::contained_type' is already applied}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] [[hlsl::contained_type(float)]] h7; -// expected-warning@+1{{attribute 'contained_type' is already applied with different arguments}} +// expected-warning@+1{{attribute 'hlsl::contained_type' is already applied with different arguments}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] [[hlsl::contained_type(int)]] h8; -// expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} -// expected-error@+1{{attribute 'contained_type' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+2{{attribute 'hlsl::resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+1{{attribute 'hlsl::contained_type' can be used only on HLSL intangible type '__hlsl_resource_t'}} float [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]] res5; diff --git a/clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl b/clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl index 9920b65561527..f0333a5c74157 100644 --- a/clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl +++ b/clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl @@ -1,20 +1,20 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify -// expected-error@+1{{'is_rov' attribute cannot be applied to a declaration}} +// expected-error@+1{{'hlsl::is_rov' attribute cannot be applied to a declaration}} [[hlsl::is_rov]] __hlsl_resource_t res0; // expected-error@+1{{HLSL resource needs to have [[hlsl::resource_class()]] attribute}} __hlsl_resource_t [[hlsl::is_rov]] res1; -// expected-error@+1{{'is_rov' attribute takes no arguments}} +// expected-error@+1{{'hlsl::is_rov' attribute takes no arguments}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(3)]] res2; // expected-error@+1{{use of undeclared identifier 'gibberish'}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov(gibberish)]] res3; -// expected-warning@+1{{attribute 'is_rov' is already applied}} +// expected-warning@+1{{attribute 'hlsl::is_rov' is already applied}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] [[hlsl::is_rov]] res4; -// expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} -// expected-error@+1{{attribute 'is_rov' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+2{{attribute 'hlsl::resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+1{{attribute 'hlsl::is_rov' can be used only on HLSL intangible type '__hlsl_resource_t'}} float [[hlsl::resource_class(UAV)]] [[hlsl::is_rov]] res5; diff --git a/clang/test/ParserHLSL/hlsl_raw_buffer_attr_error.hlsl b/clang/test/ParserHLSL/hlsl_raw_buffer_attr_error.hlsl index a638d1d3e156c..9f4dfbe8d2c71 100644 --- a/clang/test/ParserHLSL/hlsl_raw_buffer_attr_error.hlsl +++ b/clang/test/ParserHLSL/hlsl_raw_buffer_attr_error.hlsl @@ -1,17 +1,17 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify -// expected-error@+1{{'raw_buffer' attribute cannot be applied to a declaration}} +// expected-error@+1{{'hlsl::raw_buffer' attribute cannot be applied to a declaration}} [[hlsl::raw_buffer]] __hlsl_resource_t res0; -// expected-error@+1{{'raw_buffer' attribute takes no arguments}} +// expected-error@+1{{'hlsl::raw_buffer' attribute takes no arguments}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(3)]] res2; // expected-error@+1{{use of undeclared identifier 'gibberish'}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(gibberish)]] res3; -// expected-warning@+1{{attribute 'raw_buffer' is already applied}} +// expected-warning@+1{{attribute 'hlsl::raw_buffer' is already applied}} __hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] [[hlsl::raw_buffer]] res4; -// expected-error@+2{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} -// expected-error@+1{{attribute 'raw_buffer' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+2{{attribute 'hlsl::resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+1{{attribute 'hlsl::raw_buffer' can be used only on HLSL intangible type '__hlsl_resource_t'}} float [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] res5; diff --git a/clang/test/ParserHLSL/hlsl_resource_class_attr_error.hlsl b/clang/test/ParserHLSL/hlsl_resource_class_attr_error.hlsl index 63e39daff949b..e4a56586c3911 100644 --- a/clang/test/ParserHLSL/hlsl_resource_class_attr_error.hlsl +++ b/clang/test/ParserHLSL/hlsl_resource_class_attr_error.hlsl @@ -1,22 +1,22 @@ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify -// expected-error@+1{{'resource_class' attribute cannot be applied to a declaration}} +// expected-error@+1{{'hlsl::resource_class' attribute cannot be applied to a declaration}} [[hlsl::resource_class(UAV)]] __hlsl_resource_t e0; -// expected-error@+1{{'resource_class' attribute takes one argument}} +// expected-error@+1{{'hlsl::resource_class' attribute takes one argument}} __hlsl_resource_t [[hlsl::resource_class()]] e1; // expected-warning@+1{{ResourceClass attribute argument not supported: gibberish}} __hlsl_resource_t [[hlsl::resource_class(gibberish)]] e2; -// expected-warning@+1{{attribute 'resource_class' is already applied with different arguments}} +// expected-warning@+1{{attribute 'hlsl::resource_class' is already applied with different arguments}} __hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(UAV)]] e3; -// expected-warning@+1{{attribute 'resource_class' is already applied}} +// expected-warning@+1{{attribute 'hlsl::resource_class' is already applied}} __hlsl_resource_t [[hlsl::resource_class(SRV)]] [[hlsl::resource_class(SRV)]] e4; -// expected-error@+1{{'resource_class' attribute takes one argument}} +// expected-error@+1{{'hlsl::resource_class' attribute takes one argument}} __hlsl_resource_t [[hlsl::resource_class(SRV, "aa")]] e5; -// expected-error@+1{{attribute 'resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} +// expected-error@+1{{attribute 'hlsl::resource_class' can be used only on HLSL intangible type '__hlsl_resource_t'}} float [[hlsl::resource_class(UAV)]] e6; diff --git a/clang/test/Sema/annotate-type.c b/clang/test/Sema/annotate-type.c index bf1632d302e55..0a0a300785337 100644 --- a/clang/test/Sema/annotate-type.c +++ b/clang/test/Sema/annotate-type.c @@ -18,25 +18,25 @@ void foo(float *[[clang::annotate_type("foo")]] a) { int *__attribute__((annotate_type("bar"))) y2; // expected-warning {{unknown attribute 'annotate_type' ignored}} // Various error cases - [[clang::annotate_type("bar")]] int *z1; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - int *z2 [[clang::annotate_type("bar")]]; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - [[clang::annotate_type("bar")]]; // expected-error {{'annotate_type' attribute cannot be applied to a statement}} + [[clang::annotate_type("bar")]] int *z1; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + int *z2 [[clang::annotate_type("bar")]]; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + [[clang::annotate_type("bar")]]; // expected-error {{'clang::annotate_type' attribute cannot be applied to a statement}} int *[[clang::annotate_type(1)]] z3; // expected-error {{expected string literal as argument of 'annotate_type' attribute}} - int *[[clang::annotate_type()]] z4; // expected-error {{'annotate_type' attribute takes at least 1 argument}} - int *[[clang::annotate_type]] z5; // expected-error {{'annotate_type' attribute takes at least 1 argument}} + int *[[clang::annotate_type()]] z4; // expected-error {{'clang::annotate_type' attribute takes at least 1 argument}} + int *[[clang::annotate_type]] z5; // expected-error {{'clang::annotate_type' attribute takes at least 1 argument}} int *[[clang::annotate_type(some_function())]] z6; // expected-error {{expected string literal as argument of 'annotate_type' attribute}} - int *[[clang::annotate_type("bar", some_function())]] z7; // expected-error {{'annotate_type' attribute requires parameter 1 to be a constant expression}} expected-note{{subexpression not valid in a constant expression}} - int *[[clang::annotate_type("bar", z7)]] z8; // expected-error {{'annotate_type' attribute requires parameter 1 to be a constant expression}} expected-note{{subexpression not valid in a constant expression}} + int *[[clang::annotate_type("bar", some_function())]] z7; // expected-error {{'clang::annotate_type' attribute requires parameter 1 to be a constant expression}} expected-note{{subexpression not valid in a constant expression}} + int *[[clang::annotate_type("bar", z7)]] z8; // expected-error {{'clang::annotate_type' attribute requires parameter 1 to be a constant expression}} expected-note{{subexpression not valid in a constant expression}} int *[[clang::annotate_type("bar", int)]] z9; // expected-error {{expected expression}} } // More error cases: Prohibit adding the attribute to declarations. // Different declarations hit different code paths, so they need separate tests. -[[clang::annotate_type("bar")]] int *global; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -[[clang::annotate_type("bar")]] void annotated_function(); // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -void g([[clang::annotate_type("bar")]] int); // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -struct [[clang::annotate_type("foo")]] S; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -struct [[clang::annotate_type("foo")]] S{ // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - [[clang::annotate_type("foo")]] int member; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} +[[clang::annotate_type("bar")]] int *global; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +[[clang::annotate_type("bar")]] void annotated_function(); // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +void g([[clang::annotate_type("bar")]] int); // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +struct [[clang::annotate_type("foo")]] S; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +struct [[clang::annotate_type("foo")]] S{ // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + [[clang::annotate_type("foo")]] int member; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} [[clang::annotate_type("foo")]] union { // expected-error {{an attribute list cannot appear here}} int i; float f; diff --git a/clang/test/Sema/annotate.c b/clang/test/Sema/annotate.c index f2ef08d637897..1e31952b3e007 100644 --- a/clang/test/Sema/annotate.c +++ b/clang/test/Sema/annotate.c @@ -16,6 +16,6 @@ void __attribute__((annotate("foo"))) foo(float *a) { float b = __builtin_annotation(*a, "foo"); // expected-error {{first argument to __builtin_annotation must be an integer}} __attribute__((annotate())) int c; // expected-error {{'annotate' attribute takes at least 1 argument}} - [[clang::annotate()]] int c2; // expected-error {{'annotate' attribute takes at least 1 argument}} - [[clang::annotate()]] c2 += 1; // expected-error {{'annotate' attribute takes at least 1 argument}} + [[clang::annotate()]] int c2; // expected-error {{'clang::annotate' attribute takes at least 1 argument}} + [[clang::annotate()]] c2 += 1; // expected-error {{'clang::annotate' attribute takes at least 1 argument}} } diff --git a/clang/test/Sema/assume.c b/clang/test/Sema/assume.c index 07a5490addfaf..6b922975891d7 100644 --- a/clang/test/Sema/assume.c +++ b/clang/test/Sema/assume.c @@ -19,7 +19,7 @@ void test(int n) { __attribute__((assume(n++))); // expected-warning {{assumption is ignored because it contains (potential) side-effects}} [[clang::assume(n++)]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} - [[clang::assume(true)]] int x; // expected-error {{'assume' attribute cannot be applied to a declaration}} + [[clang::assume(true)]] int x; // expected-error {{'clang::assume' attribute cannot be applied to a declaration}} __attribute__((assume(true))) int y; // expected-error {{'assume' attribute cannot be applied to a declaration}} } diff --git a/clang/test/Sema/attr-alwaysinline.cpp b/clang/test/Sema/attr-alwaysinline.cpp index 6b71a0e86bf12..9d8188c5b9488 100644 --- a/clang/test/Sema/attr-alwaysinline.cpp +++ b/clang/test/Sema/attr-alwaysinline.cpp @@ -10,22 +10,22 @@ int bar(); void foo() { [[clang::always_inline]] bar(); - [[clang::always_inline(0)]] bar(); // expected-error {{'always_inline' attribute takes no arguments}} + [[clang::always_inline(0)]] bar(); // expected-error {{'clang::always_inline' attribute takes no arguments}} int x; - [[clang::always_inline]] int i = bar(); // expected-warning {{'always_inline' attribute only applies to functions and statements}} - [[clang::always_inline]] x = 0; // expected-warning {{'always_inline' attribute is ignored because there exists no call expression inside the statement}} - [[clang::always_inline]] { asm("nop"); } // expected-warning {{'always_inline' attribute is ignored because there exists no call expression inside the statement}} - [[clang::always_inline]] label : x = 1; // expected-warning {{'always_inline' attribute only applies to functions and statements}} + [[clang::always_inline]] int i = bar(); // expected-warning {{'clang::always_inline' attribute only applies to functions and statements}} + [[clang::always_inline]] x = 0; // expected-warning {{'clang::always_inline' attribute is ignored because there exists no call expression inside the statement}} + [[clang::always_inline]] { asm("nop"); } // expected-warning {{'clang::always_inline' attribute is ignored because there exists no call expression inside the statement}} + [[clang::always_inline]] label : x = 1; // expected-warning {{'clang::always_inline' attribute only applies to functions and statements}} [[clang::always_inline]] always_inline_fn(); - [[clang::always_inline]] noinline_fn(); // expected-warning {{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} - [[clang::always_inline]] flatten_fn(); // expected-warning {{statement attribute 'always_inline' has higher precedence than function attribute 'flatten'}} + [[clang::always_inline]] noinline_fn(); // expected-warning {{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} + [[clang::always_inline]] flatten_fn(); // expected-warning {{statement attribute 'clang::always_inline' has higher precedence than function attribute 'flatten'}} [[gnu::always_inline]] bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::always_inline]]' on statements}} __attribute__((always_inline)) bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::always_inline]]' on statements}} } -[[clang::always_inline]] static int i = bar(); // expected-warning {{'always_inline' attribute only applies to functions and statements}} +[[clang::always_inline]] static int i = bar(); // expected-warning {{'clang::always_inline' attribute only applies to functions and statements}} // This used to crash the compiler. template @@ -41,13 +41,13 @@ int non_dependent(int x){return x;} // #NO_DEP template [[gnu::noinline]] int baz(int x) { // #BAZ - // expected-warning@+2{{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} + // expected-warning@+2{{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} [[clang::always_inline]] non_dependent(x); if constexpr (D>0) { - // expected-warning@+6{{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} + // expected-warning@+6{{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} - // expected-warning@+4 3{{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} + // expected-warning@+4 3{{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} // expected-note@#BAZ 3{{conflicting attribute is here}} // expected-note@#BAZ_INST 3{{in instantiation}} // expected-note@+1 3{{in instantiation}} @@ -61,9 +61,9 @@ template int variadic_baz(int x) { // Diagnoses NO_DEP 2x, once during phase 1, the second during instantiation. // Dianoses DEP 3x, once per variadic expansion. - // expected-warning@+5 2{{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} + // expected-warning@+5 2{{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} // expected-note@#NO_DEP 2{{conflicting attribute is here}} - // expected-warning@+3 3{{statement attribute 'always_inline' has higher precedence than function attribute 'noinline'}} + // expected-warning@+3 3{{statement attribute 'clang::always_inline' has higher precedence than function attribute 'noinline'}} // expected-note@#DEP 3{{conflicting attribute is here}} // expected-note@#VARIADIC_INST{{in instantiation}} [[clang::always_inline]] return non_dependent(x) + (dependent(x) + ...); diff --git a/clang/test/Sema/attr-enforce-tcb-errors.cpp b/clang/test/Sema/attr-enforce-tcb-errors.cpp index b5effe2fe5180..732636eddc44d 100644 --- a/clang/test/Sema/attr-enforce-tcb-errors.cpp +++ b/clang/test/Sema/attr-enforce-tcb-errors.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -[[clang::enforce_tcb("oops")]] int wrong_subject_type; // expected-warning{{'enforce_tcb' attribute only applies to functions}} +[[clang::enforce_tcb("oops")]] int wrong_subject_type; // expected-warning{{'clang::enforce_tcb' attribute only applies to functions}} void no_arguments() __attribute__((enforce_tcb)); // expected-error{{'enforce_tcb' attribute takes one argument}} @@ -8,7 +8,7 @@ void too_many_arguments() __attribute__((enforce_tcb("test", 12))); // expected- void wrong_argument_type() __attribute__((enforce_tcb(12))); // expected-error{{expected string literal as argument of 'enforce_tcb' attribute}} -[[clang::enforce_tcb_leaf("oops")]] int wrong_subject_type_leaf; // expected-warning{{'enforce_tcb_leaf' attribute only applies to functions}} +[[clang::enforce_tcb_leaf("oops")]] int wrong_subject_type_leaf; // expected-warning{{'clang::enforce_tcb_leaf' attribute only applies to functions}} void no_arguments_leaf() __attribute__((enforce_tcb_leaf)); // expected-error{{'enforce_tcb_leaf' attribute takes one argument}} diff --git a/clang/test/Sema/attr-external-source-symbol.c b/clang/test/Sema/attr-external-source-symbol.c index 8ecd790f33c8f..03c79eb10cc3a 100644 --- a/clang/test/Sema/attr-external-source-symbol.c +++ b/clang/test/Sema/attr-external-source-symbol.c @@ -29,5 +29,5 @@ void fiveClauses2(void); [[clang::external_source_symbol(generated_declaration)]] void oneClause2(void); -[[clang::external_source_symbol]] // expected-error {{'external_source_symbol' attribute takes at least 1 argument}} +[[clang::external_source_symbol]] // expected-error {{'clang::external_source_symbol' attribute takes at least 1 argument}} void noArguments2(void); diff --git a/clang/test/Sema/attr-handles.cpp b/clang/test/Sema/attr-handles.cpp index ff1c1f68dfec8..a82dae9f6e130 100644 --- a/clang/test/Sema/attr-handles.cpp +++ b/clang/test/Sema/attr-handles.cpp @@ -17,7 +17,7 @@ int (* __attribute__((acquire_handle("Fuchsia"))) fpt)(char *); // expected-warn auto lambdat = [](int handle __attribute__((use_handle("Fuchsia")))) __attribute__((acquire_handle("Fuchsia"))) -> int { return 0; }; int __attribute((acquire_handle("Fuchsia"))) ta; // expected-warning {{'acquire_handle' attribute only applies to functions, typedefs, and parameters}} -int open(const char *path, int flags, ...) [[clang::acquire_handle]]; // expected-error {{'acquire_handle' attribute takes one argument}} +int open(const char *path, int flags, ...) [[clang::acquire_handle]]; // expected-error {{'clang::acquire_handle' attribute takes one argument}} // Typedefs. typedef int callback(char *) __attribute__((acquire_handle("Fuchsia"))); diff --git a/clang/test/Sema/attr-likelihood.c b/clang/test/Sema/attr-likelihood.c index 955216f8fd215..6222b80b65e78 100644 --- a/clang/test/Sema/attr-likelihood.c +++ b/clang/test/Sema/attr-likelihood.c @@ -5,7 +5,7 @@ void g(void) { [[clang::likely]] {} } void m(void) { - [[clang::likely]] int x = 42; // expected-error {{'likely' attribute cannot be applied to a declaration}} + [[clang::likely]] int x = 42; // expected-error {{'clang::likely' attribute cannot be applied to a declaration}} if (x) [[clang::unlikely]] {} @@ -44,7 +44,7 @@ void m(void) { goto lbl; // FIXME: allow the attribute on the label - [[clang::unlikely]] lbl : // expected-error {{'unlikely' attribute cannot be applied to a declaration}} + [[clang::unlikely]] lbl : // expected-error {{'clang::unlikely' attribute cannot be applied to a declaration}} [[clang::likely]] x = x + 1; [[clang::likely]]++ x; diff --git a/clang/test/Sema/attr-mig.cpp b/clang/test/Sema/attr-mig.cpp index 5dfc43bc1ec88..b5aa87a060155 100644 --- a/clang/test/Sema/attr-mig.cpp +++ b/clang/test/Sema/attr-mig.cpp @@ -11,7 +11,7 @@ class MyServer { virtual __attribute__((mig_server_routine)) void anotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} virtual __attribute__((mig_server_routine)) int yetAnotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} [[clang::mig_server_routine]] virtual IOReturn cppAnnotatedMethod(); - [[clang::mig_server_routine("arg")]] virtual IOReturn cppAnnotatedMethodWithInvalidArgs(); // expected-error{{'mig_server_routine' attribute takes no arguments}} + [[clang::mig_server_routine("arg")]] virtual IOReturn cppAnnotatedMethodWithInvalidArgs(); // expected-error{{'clang::mig_server_routine' attribute takes no arguments}} [[clang::mig_server_routine]] virtual int cppInvalidAnnotatedMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}} }; diff --git a/clang/test/Sema/attr-nocf_check.cpp b/clang/test/Sema/attr-nocf_check.cpp index e306c8ef79cd5..c5586b85dbef0 100644 --- a/clang/test/Sema/attr-nocf_check.cpp +++ b/clang/test/Sema/attr-nocf_check.cpp @@ -9,8 +9,8 @@ typedef void (*FuncPointer)(void); void testNoCfCheck(){}; // expected-error {{conflicting types for 'testNoCfCheck'}} // No variable or parameter declaration -int [[gnu::nocf_check]] i; // expected-error {{'nocf_check' attribute cannot be applied to types}} -void testNoCfCheckImpl(double i [[gnu::nocf_check]]) {} // expected-warning {{'nocf_check' attribute only applies to functions and function pointers}} +int [[gnu::nocf_check]] i; // expected-error {{'gnu::nocf_check' attribute cannot be applied to types}} +void testNoCfCheckImpl(double i [[gnu::nocf_check]]) {} // expected-warning {{'gnu::nocf_check' attribute only applies to functions and function pointers}} // Allow attributed function pointers as well as casting between attributed // and non-attributed function pointers. @@ -20,4 +20,4 @@ void testNoCfCheckMismatch(FuncPointer f) { } // 'nocf_check' Attribute has no parameters. -[[gnu::nocf_check(1)]] int testNoCfCheckParams(); // expected-error {{'nocf_check' attribute takes no arguments}} +[[gnu::nocf_check(1)]] int testNoCfCheckParams(); // expected-error {{'gnu::nocf_check' attribute takes no arguments}} diff --git a/clang/test/Sema/attr-noinline.cpp b/clang/test/Sema/attr-noinline.cpp index 6da0e873af1b6..d6d48321d6604 100644 --- a/clang/test/Sema/attr-noinline.cpp +++ b/clang/test/Sema/attr-noinline.cpp @@ -10,15 +10,15 @@ int bar(); void foo() { [[clang::noinline]] bar(); - [[clang::noinline(0)]] bar(); // expected-error {{'noinline' attribute takes no arguments}} + [[clang::noinline(0)]] bar(); // expected-error {{'clang::noinline' attribute takes no arguments}} int x; - [[clang::noinline]] x = 0; // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} - [[clang::noinline]] { asm("nop"); } // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} - [[clang::noinline]] label: x = 1; // expected-warning {{'noinline' attribute only applies to functions and statements}} + [[clang::noinline]] x = 0; // expected-warning {{'clang::noinline' attribute is ignored because there exists no call expression inside the statement}} + [[clang::noinline]] { asm("nop"); } // expected-warning {{'clang::noinline' attribute is ignored because there exists no call expression inside the statement}} + [[clang::noinline]] label: x = 1; // expected-warning {{'clang::noinline' attribute only applies to functions and statements}} - [[clang::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} - [[clang::noinline]] flatten_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'flatten'}} + [[clang::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} + [[clang::noinline]] flatten_fn(); // expected-warning {{statement attribute 'clang::noinline' has higher precedence than function attribute 'flatten'}} [[clang::noinline]] noinline_fn(); [[gnu::noinline]] bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::noinline]]' on statements}} @@ -27,19 +27,19 @@ void foo() { void ms_noi_check() { [[msvc::noinline]] bar(); - [[msvc::noinline(0)]] bar(); // expected-error {{'noinline' attribute takes no arguments}} + [[msvc::noinline(0)]] bar(); // expected-error {{'msvc::noinline' attribute takes no arguments}} int x; - [[msvc::noinline]] x = 0; // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} - [[msvc::noinline]] { asm("nop"); } // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} - [[msvc::noinline]] label: x = 1; // expected-warning {{'noinline' attribute only applies to functions and statements}} + [[msvc::noinline]] x = 0; // expected-warning {{'msvc::noinline' attribute is ignored because there exists no call expression inside the statement}} + [[msvc::noinline]] { asm("nop"); } // expected-warning {{'msvc::noinline' attribute is ignored because there exists no call expression inside the statement}} + [[msvc::noinline]] label: x = 1; // expected-warning {{'msvc::noinline' attribute only applies to functions and statements}} - [[msvc::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} - [[msvc::noinline]] flatten_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'flatten'}} + [[msvc::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} + [[msvc::noinline]] flatten_fn(); // expected-warning {{statement attribute 'msvc::noinline' has higher precedence than function attribute 'flatten'}} [[msvc::noinline]] noinline_fn(); } -[[clang::noinline]] static int i = bar(); // expected-warning {{'noinline' attribute only applies to functions and statements}} -[[msvc::noinline]] static int j = bar(); // expected-warning {{'noinline' attribute only applies to functions and statements}} +[[clang::noinline]] static int i = bar(); // expected-warning {{'clang::noinline' attribute only applies to functions and statements}} +[[msvc::noinline]] static int j = bar(); // expected-warning {{'msvc::noinline' attribute only applies to functions and statements}} // This used to crash the compiler. template @@ -55,13 +55,13 @@ int non_dependent(int x){return x;} // #NO_DEP template [[clang::always_inline]] int baz(int x) { // #BAZ - // expected-warning@+2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+2{{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} [[clang::noinline]] non_dependent(x); if constexpr (D>0) { - // expected-warning@+6{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+6{{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} - // expected-warning@+4 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+4 3{{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#BAZ 3{{conflicting attribute is here}} // expected-note@#BAZ_INST 3{{in instantiation}} // expected-note@+1 3{{in instantiation}} @@ -75,9 +75,9 @@ template int variadic_baz(int x) { // Diagnoses NO_DEP 2x, once during phase 1, the second during instantiation. // Dianoses DEP 3x, once per variadic expansion. - // expected-warning@+5 2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+5 2{{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP 2{{conflicting attribute is here}} - // expected-warning@+3 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+3 3{{statement attribute 'clang::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#DEP 3{{conflicting attribute is here}} // expected-note@#VARIADIC_INST{{in instantiation}} [[clang::noinline]] return non_dependent(x) + (dependent(x) + ...); @@ -85,13 +85,13 @@ int variadic_baz(int x) { template [[clang::always_inline]] int qux(int x) { // #QUX - // expected-warning@+2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+2{{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} [[msvc::noinline]] non_dependent(x); if constexpr (D>0) { - // expected-warning@+6{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+6{{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP{{conflicting attribute is here}} - // expected-warning@+4 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+4 3{{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#QUX 3{{conflicting attribute is here}} // expected-note@#QUX_INST 3{{in instantiation}} // expected-note@+1 3{{in instantiation}} @@ -105,9 +105,9 @@ template int variadic_qux(int x) { // Diagnoses NO_DEP 2x, once during phase 1, the second during instantiation. // Dianoses DEP 3x, once per variadic expansion. - // expected-warning@+5 2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+5 2{{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#NO_DEP 2{{conflicting attribute is here}} - // expected-warning@+3 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-warning@+3 3{{statement attribute 'msvc::noinline' has higher precedence than function attribute 'always_inline'}} // expected-note@#DEP 3{{conflicting attribute is here}} // expected-note@#QUX_VARIADIC_INST{{in instantiation}} [[msvc::noinline]] return non_dependent(x) + (dependent(x) + ...); diff --git a/clang/test/Sema/attr-nomerge.cpp b/clang/test/Sema/attr-nomerge.cpp index 69a535bde76e2..010f8d26310ae 100644 --- a/clang/test/Sema/attr-nomerge.cpp +++ b/clang/test/Sema/attr-nomerge.cpp @@ -4,18 +4,18 @@ void bar(); void foo() { [[clang::nomerge]] bar(); - [[clang::nomerge(1, 2)]] bar(); // expected-error {{'nomerge' attribute takes no arguments}} + [[clang::nomerge(1, 2)]] bar(); // expected-error {{'clang::nomerge' attribute takes no arguments}} int x; - [[clang::nomerge]] x = 10; // expected-warning {{'nomerge' attribute is ignored because there exists no call expression inside the statement}} + [[clang::nomerge]] x = 10; // expected-warning {{'clang::nomerge' attribute is ignored because there exists no call expression inside the statement}} - [[clang::nomerge]] label: bar(); // expected-error {{'nomerge' attribute only applies to functions, statements and variables}} + [[clang::nomerge]] label: bar(); // expected-error {{'clang::nomerge' attribute only applies to functions, statements and variables}} } [[clang::nomerge]] int f(); -[[clang::nomerge]] static int i = f(); // expected-warning {{'nomerge' attribute is ignored because 'i' is not a function pointer}} +[[clang::nomerge]] static int i = f(); // expected-warning {{'clang::nomerge' attribute is ignored because 'i' is not a function pointer}} [[clang::nomerge]] void (*j)(void); -struct [[clang::nomerge]] buz {}; // expected-error {{'nomerge' attribute only applies to functions, statements and variables}} +struct [[clang::nomerge]] buz {}; // expected-error {{'clang::nomerge' attribute only applies to functions, statements and variables}} diff --git a/clang/test/Sema/attr-nonblocking-sema.cpp b/clang/test/Sema/attr-nonblocking-sema.cpp index 9056f81f5296b..f13cc783dfc33 100644 --- a/clang/test/Sema/attr-nonblocking-sema.cpp +++ b/clang/test/Sema/attr-nonblocking-sema.cpp @@ -8,8 +8,8 @@ // --- ATTRIBUTE SYNTAX: SUBJECTS --- int nl_var [[clang::nonblocking]]; // expected-warning {{'nonblocking' only applies to function types; type here is 'int'}} -struct nl_struct {} [[clang::nonblocking]]; // expected-warning {{attribute 'nonblocking' is ignored, place it after "struct" to apply attribute to type declaration}} -struct [[clang::nonblocking]] nl_struct2 {}; // expected-error {{'nonblocking' attribute cannot be applied to a declaration}} +struct nl_struct {} [[clang::nonblocking]]; // expected-warning {{attribute 'clang::nonblocking' is ignored, place it after "struct" to apply attribute to type declaration}} +struct [[clang::nonblocking]] nl_struct2 {}; // expected-error {{'clang::nonblocking' attribute cannot be applied to a declaration}} // Positive case typedef void (*fo)() [[clang::nonblocking]]; @@ -19,10 +19,10 @@ void (*read_me_and_weep( [[clang::nonblocking]]; // --- ATTRIBUTE SYNTAX: ARGUMENT COUNT --- -void nargs_1() [[clang::nonblocking(1, 2)]]; // expected-error {{'nonblocking' attribute takes no more than 1 argument}} -void nargs_2() [[clang::nonallocating(1, 2)]]; // expected-error {{'nonallocating' attribute takes no more than 1 argument}} -void nargs_3() [[clang::blocking(1)]]; // expected-error {{'blocking' attribute takes no arguments}} -void nargs_4() [[clang::allocating(1)]]; // expected-error {{'allocating' attribute takes no arguments}} +void nargs_1() [[clang::nonblocking(1, 2)]]; // expected-error {{'clang::nonblocking' attribute takes no more than 1 argument}} +void nargs_2() [[clang::nonallocating(1, 2)]]; // expected-error {{'clang::nonallocating' attribute takes no more than 1 argument}} +void nargs_3() [[clang::blocking(1)]]; // expected-error {{'clang::blocking' attribute takes no arguments}} +void nargs_4() [[clang::allocating(1)]]; // expected-error {{'clang::allocating' attribute takes no arguments}} // --- ATTRIBUTE SYNTAX: COMBINATIONS --- // Check invalid combinations of nonblocking/nonallocating attributes diff --git a/clang/test/Sema/attr-only-in-default-eval.cpp b/clang/test/Sema/attr-only-in-default-eval.cpp index 510863cf2580a..35e690fdf3efa 100644 --- a/clang/test/Sema/attr-only-in-default-eval.cpp +++ b/clang/test/Sema/attr-only-in-default-eval.cpp @@ -6,20 +6,20 @@ using double_t __attribute__((available_only_in_default_eval_method)) = double; // expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} class __attribute__((available_only_in_default_eval_method)) C1 { }; -// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} +// expected-error@+1{{'clang::available_only_in_default_eval_method' attribute only applies to typedefs}} class [[clang::available_only_in_default_eval_method]] C2 { }; -// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} +// expected-error@+1{{'clang::available_only_in_default_eval_method' attribute only applies to typedefs}} struct [[clang::available_only_in_default_eval_method]] S1; // expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} struct __attribute__((available_only_in_default_eval_method)) S2; // expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} void __attribute__((available_only_in_default_eval_method)) foo(); -// expected-error@+1{{'available_only_in_default_eval_method' attribute cannot be applied to types}} +// expected-error@+1{{'clang::available_only_in_default_eval_method' attribute cannot be applied to types}} void [[clang::available_only_in_default_eval_method]] goo(); -// expected-error@+1{{'available_only_in_default_eval_method' attribute cannot be applied to types}} +// expected-error@+1{{'clang::available_only_in_default_eval_method' attribute cannot be applied to types}} void bar() [[clang::available_only_in_default_eval_method]]; // expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}} void barz() __attribute__((available_only_in_default_eval_method)); diff --git a/clang/test/Sema/attr-preferred-type.cpp b/clang/test/Sema/attr-preferred-type.cpp index dfa7e636c21e9..cd5b5cd6e928a 100644 --- a/clang/test/Sema/attr-preferred-type.cpp +++ b/clang/test/Sema/attr-preferred-type.cpp @@ -9,9 +9,9 @@ struct A { [[clang::preferred_type(bool)]] unsigned b4 : 1; [[clang::preferred_type(bool)]] unsigned b5 : 2; [[clang::preferred_type()]] unsigned b6 : 2; - // expected-error@-1 {{'preferred_type' attribute takes one argument}} + // expected-error@-1 {{'clang::preferred_type' attribute takes one argument}} [[clang::preferred_type]] unsigned b7 : 2; - // expected-error@-1 {{'preferred_type' attribute takes one argument}} + // expected-error@-1 {{'clang::preferred_type' attribute takes one argument}} [[clang::preferred_type(E, int)]] unsigned b8 : 2; // expected-error@-1 {{expected ')'}} // expected-error@-2 {{expected ','}} diff --git a/clang/test/Sema/attr-regparm.c b/clang/test/Sema/attr-regparm.c index 1fd54a5b6656e..3f641c98ac43d 100644 --- a/clang/test/Sema/attr-regparm.c +++ b/clang/test/Sema/attr-regparm.c @@ -14,4 +14,4 @@ void __attribute__((regparm(2))) x5(int); // expected-error{{function declared w [[gnu::regparm(2)]] void x6(int); // expected-error{{function declared with regparm(2) attribute was previously declared with the regparm(3) attribute}} void x6 [[gnu::regparm(3)]] (int); void [[gnu::regparm(3)]] x6(int); // expected-warning{{'regparm' only applies to function types; type here is 'void'}} -void x6(int) [[gnu::regparm(3)]]; // expected-warning{{GCC does not allow the 'regparm' attribute to be written on a type}} +void x6(int) [[gnu::regparm(3)]]; // expected-warning{{GCC does not allow the 'gnu::regparm' attribute to be written on a type}} diff --git a/clang/test/Sema/attr-type-safety.c b/clang/test/Sema/attr-type-safety.c index f1027738f6083..cd528d2eaac56 100644 --- a/clang/test/Sema/attr-type-safety.c +++ b/clang/test/Sema/attr-type-safety.c @@ -4,7 +4,7 @@ struct A {}; typedef struct A *MPI_Datatype; -extern struct A datatype_wrong1 [[clang::type_tag_for_datatype]]; // expected-error {{'type_tag_for_datatype' attribute requires parameter 1 to be an identifier}} +extern struct A datatype_wrong1 [[clang::type_tag_for_datatype]]; // expected-error {{'clang::type_tag_for_datatype' attribute requires parameter 1 to be an identifier}} extern struct A datatype_wrong2 [[clang::type_tag_for_datatype(mpi,1,2)]]; // expected-error {{expected a type}} @@ -22,7 +22,7 @@ extern struct A B_tag [[clang::type_tag_for_datatype(b,int)]]; static const int C_tag [[clang::type_tag_for_datatype(c,int)]] = 10; static const int D_tag [[clang::type_tag_for_datatype(d,int)]] = 20; -[[clang::pointer_with_type_tag]] // expected-error {{'pointer_with_type_tag' attribute requires exactly 3 arguments}} +[[clang::pointer_with_type_tag]] // expected-error {{'clang::pointer_with_type_tag' attribute requires exactly 3 arguments}} int wrong1(void *buf, MPI_Datatype datatype); [[clang::pointer_with_type_tag(mpi,0,7)]] // expected-error {{attribute parameter 2 is out of bounds}} diff --git a/clang/test/Sema/code_align.c b/clang/test/Sema/code_align.c index 083757b578d0b..52c5879d3a390 100644 --- a/clang/test/Sema/code_align.c +++ b/clang/test/Sema/code_align.c @@ -9,14 +9,14 @@ void foo() { for (i = 0; i < 10; ++i) { // this is OK a[i] = b[i] = 0; } - // expected-error@+1{{'code_align' attribute only applies to 'for', 'while', and 'do' statements}} + // expected-error@+1{{'clang::code_align' attribute only applies to 'for', 'while', and 'do' statements}} [[clang::code_align(4)]] i = 7; for (i = 0; i < 10; ++i) { a[i] = b[i] = 0; } - // expected-error@+1{{'code_align' attribute cannot be applied to a declaration}} + // expected-error@+1{{'clang::code_align' attribute cannot be applied to a declaration}} [[clang::code_align(12)]] int n[10]; } @@ -24,11 +24,11 @@ void bar(int); // cpp-local-note@+1{{declared here}} void foo1(int A) { - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 0}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 0}} [[clang::code_align(0)]] for(int I=0; I<128; ++I) { bar(I); } - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -4}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -4}} [[clang::code_align(-4)]] for(int I=0; I<128; ++I) { bar(I); } @@ -37,11 +37,11 @@ void foo1(int A) [[clang::code_align(64.0)]] for(int I=0; I<128; ++I) { bar(I); } - // expected-error@+1{{'code_align' attribute takes one argument}} + // expected-error@+1{{'clang::code_align' attribute takes one argument}} [[clang::code_align()]] for(int I=0; I<128; ++I) { bar(I); } - // expected-error@+1{{'code_align' attribute takes one argument}} + // expected-error@+1{{'clang::code_align' attribute takes one argument}} [[clang::code_align(4,8)]] for(int I=0; I<128; ++I) { bar(I); } @@ -59,47 +59,47 @@ void foo1(int A) for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(8)]] // expected-note{{previous attribute is here}} - [[clang::code_align(64)]] // expected-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(64)]] // expected-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(4)]] // expected-note{{previous attribute is here}} [[clang::code_align(4)]] // OK - [[clang::code_align(8)]] // expected-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(8)]] // expected-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(4)]] // expected-note 2{{previous attribute is here}} [[clang::code_align(4)]] // OK - [[clang::code_align(8)]] // expected-error{{conflicting loop attribute 'code_align'}} - [[clang::code_align(64)]] // expected-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(8)]] // expected-error{{conflicting loop attribute 'clang::code_align'}} + [[clang::code_align(64)]] // expected-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 7}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 7}} [[clang::code_align(7)]] for(int I=0; I<128; ++I) { bar(I); } - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 5000}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 5000}} [[clang::code_align(5000)]] for(int I=0; I<128; ++I) { bar(I); } // expected-warning@+2{{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}} - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -9223372036854775808}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -9223372036854775808}} [[clang::code_align(9223372036854775808)]] for(int I=0; I<256; ++I) { bar(I); } #ifdef __SIZEOF_INT128__ - // expected-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '(__int128_t)1311768467294899680ULL << 64'}} + // expected-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '(__int128_t)1311768467294899680ULL << 64'}} [[clang::code_align((__int128_t)0x1234567890abcde0ULL << 64)]] for(int I=0; I<256; ++I) { bar(I); } #endif - // expected-error@+1 {{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -922337203685477}} + // expected-error@+1 {{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -922337203685477}} [[clang::code_align(-922337203685477)]] for(int I=0; I<256; ++I) { bar(I); } #ifdef __SIZEOF_INT128__ // cpp-local-error@+3{{expression is not an integral constant expression}} // cpp-local-note@+2{{left shift of negative value -1311768467294899680}} - // c-local-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '-(__int128_t)1311768467294899680ULL << 64'}} + // c-local-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was '-(__int128_t)1311768467294899680ULL << 64'}} [[clang::code_align(-(__int128_t)0x1234567890abcde0ULL << 64)]] for(int I=0; I<256; ++I) { bar(I); } #endif @@ -143,25 +143,25 @@ void code_align_dependent() { for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(A)]] // cpp-local-note{{previous attribute is here}} - [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(A)]] // cpp-local-note{{previous attribute is here}} [[clang::code_align(A)]] // OK - [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } [[clang::code_align(A)]] // cpp-local-note 2{{previous attribute is here}} [[clang::code_align(A)]] // OK - [[clang::code_align(C)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} - [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} + [[clang::code_align(C)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} + [[clang::code_align(E)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} for(int I=0; I<128; ++I) { bar(I); } - // cpp-local-error@+1{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 23}} + // cpp-local-error@+1{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was 23}} [[clang::code_align(B)]] for(int I=0; I<128; ++I) { bar(I); } - // cpp-local-error@+2{{'code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -10}} + // cpp-local-error@+2{{'clang::code_align' attribute requires an integer argument which is a constant power of two between 1 and 4096 inclusive; provided argument was -10}} // cpp-local-note@#neg-instantiation{{in instantiation of function template specialization 'code_align_dependent<8, 23, 32, -10, 64>' requested here}} [[clang::code_align(D)]] for(int I=0; I<128; ++I) { bar(I); } @@ -170,7 +170,7 @@ void code_align_dependent() { template void bar3() { [[clang::code_align(8)]] // cpp-local-note{{previous attribute is here}} - [[clang::code_align(ITMPL)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} \ + [[clang::code_align(ITMPL)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} \ // cpp-local-note@#temp-instantiation{{in instantiation of function template specialization 'bar3<4>' requested here}} for(int I=0; I<128; ++I) { bar(I); } } @@ -178,7 +178,7 @@ void bar3() { template void bar4() { [[clang::code_align(ITMPL1)]] // cpp-local-note{{previous attribute is here}} - [[clang::code_align(32)]] // cpp-local-error{{conflicting loop attribute 'code_align'}} \ + [[clang::code_align(32)]] // cpp-local-error{{conflicting loop attribute 'clang::code_align'}} \ // cpp-local-note@#temp-instantiation1{{in instantiation of function template specialization 'bar4<64>' requested here}} for(int I=0; I<128; ++I) { bar(I); } } diff --git a/clang/test/Sema/internal_linkage.c b/clang/test/Sema/internal_linkage.c index a0c421527e801..a1bff73fb6620 100644 --- a/clang/test/Sema/internal_linkage.c +++ b/clang/test/Sema/internal_linkage.c @@ -20,7 +20,7 @@ struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_link __attribute__((internal_linkage("foo"))) int g(void) {} // 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}} \ +int var7 [[clang::internal_linkage]] __attribute__((common)); // expected-error{{'clang::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}} \ +__attribute__((common)) int var8 [[clang::internal_linkage]]; // expected-error{{'clang::internal_linkage' and 'common' attributes are not compatible}} \ // expected-note{{conflicting attribute is here}} diff --git a/clang/test/Sema/matrix-type-builtins.c b/clang/test/Sema/matrix-type-builtins.c index b5548831002e3..b92f3ce6a3e8c 100644 --- a/clang/test/Sema/matrix-type-builtins.c +++ b/clang/test/Sema/matrix-type-builtins.c @@ -11,15 +11,15 @@ typedef unsigned ix3x3 __attribute__((matrix_type(3, 3))); typedef float [[clang::matrix_type(5, 10)]] sx5x10_t; // expected-warning {{[[]] attributes are a C23 extension}} typedef int [[clang::matrix_type(3, 2)]] ix3x2_t; // expected-warning {{[[]] attributes are a C23 extension}} [[clang::matrix_type(5, 10)]] typedef float sx5x10_t; // expected-warning {{[[]] attributes are a C23 extension}} -// expected-warning@-1 {{applying attribute 'matrix_type' to a declaration is deprecated; apply it to the type instead}} +// expected-warning@-1 {{applying attribute 'clang::matrix_type' to a declaration is deprecated; apply it to the type instead}} [[clang::matrix_type(3, 2)]] typedef int ix3x2_t; // expected-warning {{[[]] attributes are a C23 extension}} -// expected-warning@-1 {{applying attribute 'matrix_type' to a declaration is deprecated; apply it to the type instead}} +// expected-warning@-1 {{applying attribute 'clang::matrix_type' to a declaration is deprecated; apply it to the type instead}} // Attribute may not be used outside typedefs. [[clang::matrix_type(3, 2)]] int ix3x2_var; // expected-warning {{[[]] attributes are a C23 extension}} -// expected-error@-1 {{'matrix_type' attribute only applies to typedefs}} +// expected-error@-1 {{'clang::matrix_type' attribute only applies to typedefs}} int [[clang::matrix_type(3, 2)]] ix3x2_var; // expected-warning {{[[]] attributes are a C23 extension}} -// expected-error@-1 {{'matrix_type' attribute only applies to typedefs}} +// expected-error@-1 {{'clang::matrix_type' attribute only applies to typedefs}} void transpose(sx5x10_t a, ix3x2_t b, dx3x3 c, int *d, int e) { a = __builtin_matrix_transpose(b); diff --git a/clang/test/Sema/overloadable.c b/clang/test/Sema/overloadable.c index 4c6fd0102c59a..f236ee7ad104d 100644 --- a/clang/test/Sema/overloadable.c +++ b/clang/test/Sema/overloadable.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wincompatible-pointer-types -Wno-strict-prototypes int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute only applies to functions}} -void bad_attr_target(int) [[clang::overloadable]]; // expected-error{{'overloadable' attribute cannot be applied to types}} +void bad_attr_target(int) [[clang::overloadable]]; // expected-error{{'clang::overloadable' attribute cannot be applied to types}} void params(void) __attribute__((overloadable(12))); // expected-error {{'overloadable' attribute takes no arguments}} int *f(int) __attribute__((overloadable)); // expected-note{{previous overload of function is here}} @@ -268,4 +268,4 @@ void can_overload_2(...) __attribute__((overloadable)); // ok [[clang::overloadable]] void can_overload_3(...); // ok, was previously rejected void can_overload_4 [[clang::overloadable]] (...); // ok void cannot_overload(...) [[clang::overloadable]]; // expected-error {{ISO C requires a named parameter before '...'}} \ - // expected-error {{'overloadable' attribute cannot be applied to types}} + // expected-error {{'clang::overloadable' attribute cannot be applied to types}} diff --git a/clang/test/Sema/patchable-function-entry-attr.cpp b/clang/test/Sema/patchable-function-entry-attr.cpp index efc9fe0e41130..7498e67de302d 100644 --- a/clang/test/Sema/patchable-function-entry-attr.cpp +++ b/clang/test/Sema/patchable-function-entry-attr.cpp @@ -14,6 +14,6 @@ // silence-no-diagnostics -// AIX-error@+2 {{'patchable_function_entry' attribute is not yet supported on AIX}} +// AIX-error@+2 {{'gnu::patchable_function_entry' attribute is not yet supported on AIX}} // expected-warning@+1 {{unknown attribute 'gnu::patchable_function_entry' ignored}} [[gnu::patchable_function_entry(0)]] void f(); diff --git a/clang/test/Sema/vector-gcc-compat.c b/clang/test/Sema/vector-gcc-compat.c index 7764b3bf686ad..6bb2c5168457c 100644 --- a/clang/test/Sema/vector-gcc-compat.c +++ b/clang/test/Sema/vector-gcc-compat.c @@ -26,7 +26,7 @@ typedef int v2i32 [[gnu::vector_size(8)]]; // expected-warning{{[[]] attributes // Check various positions where the [[]] spelling can or cannot be used. [[gnu::vector_size(16)]] typedef long long v2i64; // expected-warning{{[[]] attributes are a C23 extension}} typedef long long [[gnu::vector_size(16)]] v2i64_ignored; - // expected-warning@-1{{'vector_size' attribute ignored}} + // expected-warning@-1{{'gnu::vector_size' attribute ignored}} // expected-warning@-2{{[[]] attributes are a C23 extension}} // FIXME: Contrary to the error message that we emit, GCC does actually allow // the attribute in the following position. Somewhat surprisingly, the attribute @@ -34,7 +34,7 @@ typedef long long [[gnu::vector_size(16)]] v2i64_ignored; // the same effect in GCC as the other declarations for `v2i64`. typedef long long *[[gnu::vector_size(16)]] v2i64_doesnt_work; // expected-error@-1{{invalid vector element type 'long long *'}} - // expected-warning@-2{{GCC does not allow the 'vector_size' attribute to be written on a type}} + // expected-warning@-2{{GCC does not allow the 'gnu::vector_size' attribute to be written on a type}} // expected-warning@-3{{[[]] attributes are a C23 extension}} // Verify that we can use the attribute outside of a typedef. diff --git a/clang/test/Sema/xray-always-instrument-attr.cpp b/clang/test/Sema/xray-always-instrument-attr.cpp index d6a33955cd746..06a93f479f238 100644 --- a/clang/test/Sema/xray-always-instrument-attr.cpp +++ b/clang/test/Sema/xray-always-instrument-attr.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++ void foo [[clang::xray_always_instrument]] (); -struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and Objective-C methods}} +struct [[clang::xray_always_instrument]] a { int x; }; // expected-warning {{'clang::xray_always_instrument' attribute only applies to functions and Objective-C methods}} class b { void c [[clang::xray_always_instrument]] (); }; -void baz [[clang::xray_always_instrument("not-supported")]] (); // expected-error {{'xray_always_instrument' attribute takes no arguments}} +void baz [[clang::xray_always_instrument("not-supported")]] (); // expected-error {{'clang::xray_always_instrument' attribute takes no arguments}} diff --git a/clang/test/Sema/xray-log-args-class.cpp b/clang/test/Sema/xray-log-args-class.cpp index 10da93f614fea..cad9d10de7d96 100644 --- a/clang/test/Sema/xray-log-args-class.cpp +++ b/clang/test/Sema/xray-log-args-class.cpp @@ -2,6 +2,6 @@ class Class { [[clang::xray_always_instrument, clang::xray_log_args(1)]] void Method(); - [[clang::xray_log_args(-1)]] void Invalid(); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}} - [[clang::xray_log_args("invalid")]] void InvalidStringArg(); // expected-error {{'xray_log_args'}} + [[clang::xray_log_args(-1)]] void Invalid(); // expected-error {{'clang::xray_log_args' attribute parameter 1 is out of bounds}} + [[clang::xray_log_args("invalid")]] void InvalidStringArg(); // expected-error {{'clang::xray_log_args'}} }; diff --git a/clang/test/Sema/xray-log-args-oob.cpp b/clang/test/Sema/xray-log-args-oob.cpp index 82f3be30c6deb..6a106f21ef050 100644 --- a/clang/test/Sema/xray-log-args-oob.cpp +++ b/clang/test/Sema/xray-log-args-oob.cpp @@ -1,9 +1,9 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -std=c++11 -x c++ void foo [[clang::xray_log_args(1)]] (int); -struct [[clang::xray_log_args(1)]] a { int x; }; // expected-warning {{'xray_log_args' attribute only applies to functions and Objective-C methods}} +struct [[clang::xray_log_args(1)]] a { int x; }; // expected-warning {{'clang::xray_log_args' attribute only applies to functions and Objective-C methods}} -void fop [[clang::xray_log_args(1)]] (); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}} +void fop [[clang::xray_log_args(1)]] (); // expected-error {{'clang::xray_log_args' attribute parameter 1 is out of bounds}} -void foq [[clang::xray_log_args(-1)]] (); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}} +void foq [[clang::xray_log_args(-1)]] (); // expected-error {{'clang::xray_log_args' attribute parameter 1 is out of bounds}} -void fos [[clang::xray_log_args(0)]] (); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}} +void fos [[clang::xray_log_args(0)]] (); // expected-error {{'clang::xray_log_args' attribute parameter 1 is out of bounds}} diff --git a/clang/test/SemaCUDA/attr-noconvergent.cu b/clang/test/SemaCUDA/attr-noconvergent.cu index 0c051fdde4379..bddf40fd2544c 100644 --- a/clang/test/SemaCUDA/attr-noconvergent.cu +++ b/clang/test/SemaCUDA/attr-noconvergent.cu @@ -7,10 +7,10 @@ __device__ __attribute__((noconvergent)) float f1(float); [[clang::noconvergent]] __device__ float f2(float); __device__ [[clang::noconvergent(1)]] float f3(float); -// expected-error@-1 {{'noconvergent' attribute takes no arguments}} +// expected-error@-1 {{'clang::noconvergent' attribute takes no arguments}} __device__ [[clang::noconvergent]] float g0; -// expected-warning@-1 {{'noconvergent' attribute only applies to functions and statements}} +// expected-warning@-1 {{'clang::noconvergent' attribute only applies to functions and statements}} __device__ __attribute__((convergent)) __attribute__((noconvergent)) float f4(float); // expected-error@-1 {{'noconvergent' and 'convergent' attributes are not compatible}} @@ -18,17 +18,17 @@ __device__ __attribute__((convergent)) __attribute__((noconvergent)) float f4(fl __device__ [[clang::noconvergent]] float f5(float); __device__ [[clang::convergent]] float f5(float); -// expected-error@-1 {{'convergent' and 'noconvergent' attributes are not compatible}} +// expected-error@-1 {{'clang::convergent' and 'clang::noconvergent' attributes are not compatible}} // expected-note@-3 {{conflicting attribute is here}} __device__ float f5(float x) { [[clang::noconvergent]] float y; -// expected-warning@-1 {{'noconvergent' attribute only applies to functions and statements}} +// expected-warning@-1 {{'clang::noconvergent' attribute only applies to functions and statements}} float z; [[clang::noconvergent]] z = 1; -// expected-warning@-1 {{'noconvergent' attribute is ignored because there exists no call expression inside the statement}} +// expected-warning@-1 {{'clang::noconvergent' attribute is ignored because there exists no call expression inside the statement}} [[clang::noconvergent]] z = f0(x); } diff --git a/clang/test/SemaCXX/PR76631.cpp b/clang/test/SemaCXX/PR76631.cpp index 947fa3fc2635e..0348b9a1bcab5 100644 --- a/clang/test/SemaCXX/PR76631.cpp +++ b/clang/test/SemaCXX/PR76631.cpp @@ -5,5 +5,5 @@ } void throw_int_wrapper() { - [[clang::musttail]] return throw_int(); // expected-error {{'musttail' attribute may not be used with no-return-attribute functions}} + [[clang::musttail]] return throw_int(); // expected-error {{'clang::musttail' attribute may not be used with no-return-attribute functions}} } diff --git a/clang/test/SemaCXX/address-space-placement.cpp b/clang/test/SemaCXX/address-space-placement.cpp index 2d8b94041259c..90a81ac1d5569 100644 --- a/clang/test/SemaCXX/address-space-placement.cpp +++ b/clang/test/SemaCXX/address-space-placement.cpp @@ -4,18 +4,18 @@ // spelling of the `address_space` attribute is applied to a declaration instead // of a type. Also check that the attribute can instead be applied to the type. -void f([[clang::address_space(1)]] int* param) { // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} - [[clang::address_space(1)]] int* local1; // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} - int* local2 [[clang::address_space(1)]]; // expected-error {{automatic variable qualified with an address space}} expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +void f([[clang::address_space(1)]] int* param) { // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} + [[clang::address_space(1)]] int* local1; // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} + int* local2 [[clang::address_space(1)]]; // expected-error {{automatic variable qualified with an address space}} expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} int [[clang::address_space(1)]] * local3; int* [[clang::address_space(1)]] local4; // expected-error {{automatic variable qualified with an address space}} - for ([[clang::address_space(1)]] int* p = nullptr; p; ++p) {} // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} - for (; [[clang::address_space(1)]] int* p = nullptr; ) {} // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} - while([[clang::address_space(1)]] int* p = nullptr) {} // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} - if ([[clang::address_space(1)]] int* p = nullptr) {} // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} + for ([[clang::address_space(1)]] int* p = nullptr; p; ++p) {} // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} + for (; [[clang::address_space(1)]] int* p = nullptr; ) {} // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} + while([[clang::address_space(1)]] int* p = nullptr) {} // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} + if ([[clang::address_space(1)]] int* p = nullptr) {} // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} try { - } catch([[clang::address_space(1)]] int& i) { // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} + } catch([[clang::address_space(1)]] int& i) { // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} } for (int [[clang::address_space(1)]] * p = nullptr; p; ++p) {} @@ -27,28 +27,28 @@ void f([[clang::address_space(1)]] int* param) { // expected-warning {{applying } } -[[clang::address_space(1)]] int* return_value(); // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +[[clang::address_space(1)]] int* return_value(); // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} int [[clang::address_space(1)]] * return_value(); -[[clang::address_space(1)]] int global1; // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} -int global2 [[clang::address_space(1)]]; // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +[[clang::address_space(1)]] int global1; // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} +int global2 [[clang::address_space(1)]]; // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} int [[clang::address_space(1)]] global3; int [[clang::address_space(1)]] global4; -struct [[clang::address_space(1)]] S { // expected-error {{'address_space' attribute cannot be applied to a declaration}} - [[clang::address_space(1)]] int* member_function_1(); // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +struct [[clang::address_space(1)]] S { // expected-error {{'clang::address_space' attribute cannot be applied to a declaration}} + [[clang::address_space(1)]] int* member_function_1(); // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} int [[clang::address_space(1)]] * member_function_2(); }; template -[[clang::address_space(1)]] T var_template_1; // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +[[clang::address_space(1)]] T var_template_1; // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} template T [[clang::address_space(1)]] var_template_2; -using void_ptr [[clang::address_space(1)]] = void *; // expected-warning {{applying attribute 'address_space' to a declaration is deprecated; apply it to the type instead}} +using void_ptr [[clang::address_space(1)]] = void *; // expected-warning {{applying attribute 'clang::address_space' to a declaration is deprecated; apply it to the type instead}} // Intentionally using the same alias name to check that the aliases define the // same type. using void_ptr = void [[clang::address_space(1)]] *; namespace N {} -[[clang::address_space(1)]] using namespace N; // expected-error {{'address_space' attribute cannot be applied to a declaration}} +[[clang::address_space(1)]] using namespace N; // expected-error {{'clang::address_space' attribute cannot be applied to a declaration}} diff --git a/clang/test/SemaCXX/annotate-type.cpp b/clang/test/SemaCXX/annotate-type.cpp index 545b3ccfdef8e..462ca8df580c0 100644 --- a/clang/test/SemaCXX/annotate-type.cpp +++ b/clang/test/SemaCXX/annotate-type.cpp @@ -2,7 +2,7 @@ struct S1 { void f() [[clang::annotate_type("foo")]]; - [[clang::annotate_type("foo")]] void g(); // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} + [[clang::annotate_type("foo")]] void g(); // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} }; template struct is_same { @@ -40,26 +40,26 @@ int f2() { variadic_func_template<1, 2, 3>(); } // [[clang::annotate_type]] inside a template argument. template void func_template(); void f3() { - func_template(); // expected-error {{'annotate_type' attribute takes at least 1 argument}} + func_template(); // expected-error {{'clang::annotate_type' attribute takes at least 1 argument}} } // More error cases: Prohibit adding the attribute to declarations. // Different declarations hit different code paths, so they need separate tests. -namespace [[clang::annotate_type("foo")]] my_namespace {} // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -struct [[clang::annotate_type("foo")]] S3; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} -struct [[clang::annotate_type("foo")]] S3{ // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - [[clang::annotate_type("foo")]] int member; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} +namespace [[clang::annotate_type("foo")]] my_namespace {} // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +struct [[clang::annotate_type("foo")]] S3; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} +struct [[clang::annotate_type("foo")]] S3{ // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + [[clang::annotate_type("foo")]] int member; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} }; void f4() { - for ([[clang::annotate_type("foo")]] int i = 0; i < 42; ++i) {} // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - for (; [[clang::annotate_type("foo")]] bool b = false;) {} // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - while ([[clang::annotate_type("foo")]] bool b = false) {} // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} - if ([[clang::annotate_type("foo")]] bool b = false) {} // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} + for ([[clang::annotate_type("foo")]] int i = 0; i < 42; ++i) {} // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + for (; [[clang::annotate_type("foo")]] bool b = false;) {} // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + while ([[clang::annotate_type("foo")]] bool b = false) {} // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} + if ([[clang::annotate_type("foo")]] bool b = false) {} // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} try { - } catch ([[clang::annotate_type("foo")]] int i) { // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} + } catch ([[clang::annotate_type("foo")]] int i) { // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} } } template -[[clang::annotate_type("foo")]] T var_template; // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} +[[clang::annotate_type("foo")]] T var_template; // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} [[clang::annotate_type("foo")]] extern "C" int extern_c_func(); // expected-error {{an attribute list cannot appear here}} -extern "C" [[clang::annotate_type("foo")]] int extern_c_func(); // expected-error {{'annotate_type' attribute cannot be applied to a declaration}} +extern "C" [[clang::annotate_type("foo")]] int extern_c_func(); // expected-error {{'clang::annotate_type' attribute cannot be applied to a declaration}} diff --git a/clang/test/SemaCXX/attr-annotate.cpp b/clang/test/SemaCXX/attr-annotate.cpp index ff538fee9cb3c..6f5ba7919927f 100644 --- a/clang/test/SemaCXX/attr-annotate.cpp +++ b/clang/test/SemaCXX/attr-annotate.cpp @@ -68,10 +68,10 @@ struct B { // expected-note@-2 {{is not allowed in a constant expression}} [[clang::annotate("qdwqwd", cf, cb)]] void t() {} [[clang::annotate("qdwqwd", f, cb)]] void t1() {} - // expected-error@-1 {{'annotate' attribute requires parameter 1 to be a constant expression}} + // expected-error@-1 {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} // expected-note@-2 {{is not allowed in a constant expression}} [[clang::annotate("jui", b, cf)]] void t2() {} - // expected-error@-1 {{'annotate' attribute requires parameter 1 to be a constant expression}} + // expected-error@-1 {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} // expected-note@-2 {{is not allowed in a constant expression}} [[clang::annotate("jui", ((void)b, 0), cf)]] [[clang::annotate("jui", &b, cf, &foo::t2, str())]] void t3() {} }; @@ -88,7 +88,7 @@ template int f() { [[clang::annotate("test", I)]] int v = 0; // expected-note {{declared here}} [[clang::annotate("test", v)]] int v2 = 0; - // expected-error@-1 {{'annotate' attribute requires parameter 1 to be a constant expression}} + // expected-error@-1 {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} // expected-note@-2 {{is not allowed in a constant expression}} [[clang::annotate("test", rtyui)]] int v3 = 0; // expected-error@-1 {{use of undeclared identifier 'rtyui'}} @@ -104,7 +104,7 @@ void f() { int vla[n]; [[clang::annotate("vlas are awful", sizeof(vla))]] int i = 0; // reject, the sizeof is not unevaluated - // expected-error@-1 {{'annotate' attribute requires parameter 1 to be a constant expression}} + // expected-error@-1 {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} // expected-note@-2 {{subexpression not valid in a constant expression}} [[clang::annotate("_Generic selection expression should be fine", _Generic(n, int : 0, default : 1))]] int j = 0; // second arg should resolve to 0 fine @@ -126,13 +126,13 @@ constexpr int foldable_but_invalid() { } [[clang::annotate("", foldable_but_invalid())]] void f1() {} -// expected-error@-1 {{'annotate' attribute requires parameter 1 to be a constant expression}} +// expected-error@-1 {{'clang::annotate' attribute requires parameter 1 to be a constant expression}} [[clang::annotate()]] void f2() {} -// expected-error@-1 {{'annotate' attribute takes at least 1 argument}} +// expected-error@-1 {{'clang::annotate' attribute takes at least 1 argument}} template [[clang::annotate()]] void f2() {} -// expected-error@-1 {{'annotate' attribute takes at least 1 argument}} +// expected-error@-1 {{'clang::annotate' attribute takes at least 1 argument}} } namespace test5 { diff --git a/clang/test/SemaCXX/attr-cxx0x.cpp b/clang/test/SemaCXX/attr-cxx0x.cpp index 58180a21ca8e9..5b087be908a1f 100644 --- a/clang/test/SemaCXX/attr-cxx0x.cpp +++ b/clang/test/SemaCXX/attr-cxx0x.cpp @@ -61,8 +61,8 @@ void b([[deprecated, maybe_unused]] void) {} // expected-warning {{attribute // expected-warning {{attribute 'maybe_unused' cannot be applied to a 'void' parameter}} \ // expected-warning {{use of the 'deprecated' attribute is a C++14 extension}} \ // expected-warning {{use of the 'maybe_unused' attribute is a C++17 extension}} -void c([[clang::lifetimebound]] void) {} // expected-warning {{attribute 'lifetimebound' cannot be applied to a 'void' parameter}} -void d([[clang::annotate("a", "b", 1)]] void) {} // expected-warning {{attribute 'annotate' cannot be applied to a 'void' parameter}} +void c([[clang::lifetimebound]] void) {} // expected-warning {{attribute 'clang::lifetimebound' cannot be applied to a 'void' parameter}} +void d([[clang::annotate("a", "b", 1)]] void) {} // expected-warning {{attribute 'clang::annotate' cannot be applied to a 'void' parameter}} struct S { void e([[maybe_unused]] void) {} // expected-warning {{attribute 'maybe_unused' cannot be applied to a 'void' parameter}} \ diff --git a/clang/test/SemaCXX/attr-declspec-ignored.cpp b/clang/test/SemaCXX/attr-declspec-ignored.cpp index 98e0ffd1a1afd..85f92b89b9621 100644 --- a/clang/test/SemaCXX/attr-declspec-ignored.cpp +++ b/clang/test/SemaCXX/attr-declspec-ignored.cpp @@ -33,18 +33,18 @@ namespace test1 { // Also test [[]] attribute syntax. (On a non-nested declaration, these // generate a hard "misplaced attributes" error, which we test for // elsewhere.) - [[gnu::visibility("hidden")]] [[gnu::aligned]] class E; // expected-warning{{attribute 'visibility' is ignored, place it after "class" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "class" to apply attribute to type declaration}} - [[gnu::visibility("hidden")]] [[gnu::aligned]] struct F; // expected-warning{{attribute 'visibility' is ignored, place it after "struct" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "struct" to apply attribute to type declaration}} - [[gnu::visibility("hidden")]] [[gnu::aligned]] union G; // expected-warning{{attribute 'visibility' is ignored, place it after "union" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "union" to apply attribute to type declaration}} - [[gnu::visibility("hidden")]] [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "enum" to apply attribute to type declaration}} - [[gnu::visibility("hidden")]] [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "enum class" to apply attribute to type declaration}} - [[gnu::visibility("hidden")]] [[gnu::aligned]] enum struct J {}; // expected-warning{{attribute 'visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \ - // expected-warning{{attribute 'aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] class E; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "class" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "class" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] struct F; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "struct" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "struct" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] union G; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "union" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "union" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] enum H {H}; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "enum" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "enum" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] enum class I {}; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "enum class" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "enum class" to apply attribute to type declaration}} + [[gnu::visibility("hidden")]] [[gnu::aligned]] enum struct J {}; // expected-warning{{attribute 'gnu::visibility' is ignored, place it after "enum struct" to apply attribute to type declaration}} \ + // expected-warning{{attribute 'gnu::aligned' is ignored, place it after "enum struct" to apply attribute to type declaration}} }; } diff --git a/clang/test/SemaCXX/attr-deprecated-replacement-error.cpp b/clang/test/SemaCXX/attr-deprecated-replacement-error.cpp index 8c9d9b29c5535..48886ae4c80ac 100644 --- a/clang/test/SemaCXX/attr-deprecated-replacement-error.cpp +++ b/clang/test/SemaCXX/attr-deprecated-replacement-error.cpp @@ -7,7 +7,7 @@ int a1 [[deprecated("warning", "fixit")]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}} int a2 [[deprecated("warning", 1)]]; // expected-error{{expected string literal as argument of 'deprecated' attribute}} -int b1 [[gnu::deprecated("warning", "fixit")]]; // expected-error{{'deprecated' attribute takes no more than 1 argument}} +int b1 [[gnu::deprecated("warning", "fixit")]]; // expected-error{{'gnu::deprecated' attribute takes no more than 1 argument}} int b2 [[gnu::deprecated("warning", 1)]]; // expected-error{{expected string literal as argument of 'deprecated' attribute}} __declspec(deprecated("warning", "fixit")) int c1; // expected-error{{'deprecated' attribute takes no more than 1 argument}} diff --git a/clang/test/SemaCXX/attr-flatten.cpp b/clang/test/SemaCXX/attr-flatten.cpp index afcba72b6429e..6dce8fdd154f8 100644 --- a/clang/test/SemaCXX/attr-flatten.cpp +++ b/clang/test/SemaCXX/attr-flatten.cpp @@ -16,19 +16,19 @@ struct A { static void mf2() __attribute__((flatten)); }; -int ci [[gnu::flatten]]; // expected-error {{'flatten' attribute only applies to functions}} +int ci [[gnu::flatten]]; // expected-error {{'gnu::flatten' attribute only applies to functions}} [[gnu::flatten]] void cf1(); -[[gnu::flatten(1)]] void cf2(); // expected-error {{'flatten' attribute takes no arguments}} +[[gnu::flatten(1)]] void cf2(); // expected-error {{'gnu::flatten' attribute takes no arguments}} template [[gnu::flatten]] void ctf1(); -int cf3(int c[[gnu::flatten]], int); // expected-error{{'flatten' attribute only applies to functions}} +int cf3(int c[[gnu::flatten]], int); // expected-error{{'gnu::flatten' attribute only applies to functions}} struct CA { - int f [[gnu::flatten]]; // expected-error{{'flatten' attribute only applies to functions}} + int f [[gnu::flatten]]; // expected-error{{'gnu::flatten' attribute only applies to functions}} [[gnu::flatten]] void mf1(); [[gnu::flatten]] static void mf2(); }; diff --git a/clang/test/SemaCXX/attr-gsl-owner-pointer.cpp b/clang/test/SemaCXX/attr-gsl-owner-pointer.cpp index 6c1bfe405e869..4c33d5c0f5a9d 100644 --- a/clang/test/SemaCXX/attr-gsl-owner-pointer.cpp +++ b/clang/test/SemaCXX/attr-gsl-owner-pointer.cpp @@ -2,21 +2,21 @@ // RUN: FileCheck --implicit-check-not OwnerAttr --implicit-check-not PointerAttr %s int [[gsl::Owner]] i; -// expected-error@-1 {{'Owner' attribute cannot be applied to types}} +// expected-error@-1 {{'gsl::Owner' attribute cannot be applied to types}} void [[gsl::Owner]] f(); -// expected-error@-1 {{'Owner' attribute cannot be applied to types}} +// expected-error@-1 {{'gsl::Owner' attribute cannot be applied to types}} [[gsl::Owner]] void f(); -// expected-warning@-1 {{'Owner' attribute only applies to structs}} +// expected-warning@-1 {{'gsl::Owner' attribute only applies to structs}} union [[gsl::Owner(int)]] Union{}; -// expected-warning@-1 {{'Owner' attribute only applies to structs}} +// expected-warning@-1 {{'gsl::Owner' attribute only applies to structs}} struct S { }; S [[gsl::Owner]] Instance; -// expected-error@-1 {{'Owner' attribute cannot be applied to types}} +// expected-error@-1 {{'gsl::Owner' attribute cannot be applied to types}} class [[gsl::Owner(7)]] OwnerDerefNoType{}; // expected-error@-1 {{expected a type}} @@ -25,7 +25,7 @@ class [[gsl::Pointer("int")]] PointerDerefNoType{}; // expected-error@-1 {{expected a type}} class [[gsl::Owner(int)]] [[gsl::Pointer(int)]] BothOwnerPointer{}; -// expected-error@-1 {{'Pointer' and 'Owner' attributes are not compatible}} +// expected-error@-1 {{'gsl::Pointer' and 'gsl::Owner' attributes are not compatible}} // expected-note@-2 {{conflicting attribute is here}} // CHECK: CXXRecordDecl {{.*}} BothOwnerPointer // CHECK: OwnerAttr {{.*}} int @@ -41,7 +41,7 @@ class [[gsl::Pointer(int)]] AddConflictLater{}; // CHECK: CXXRecordDecl {{.*}} AddConflictLater // CHECK: PointerAttr {{.*}} int class [[gsl::Owner(int)]] AddConflictLater; -// expected-error@-1 {{'Owner' and 'Pointer' attributes are not compatible}} +// expected-error@-1 {{'gsl::Owner' and 'gsl::Pointer' attributes are not compatible}} // expected-note@-5 {{conflicting attribute is here}} // CHECK: CXXRecordDecl {{.*}} AddConflictLater // CHECK: PointerAttr {{.*}} Inherited int @@ -50,22 +50,22 @@ class [[gsl::Owner(int)]] AddConflictLater2{}; // CHECK: CXXRecordDecl {{.*}} AddConflictLater2 // CHECK: OwnerAttr {{.*}} int class [[gsl::Owner(float)]] AddConflictLater2; -// expected-error@-1 {{'Owner' and 'Owner' attributes are not compatible}} +// expected-error@-1 {{'gsl::Owner' and 'gsl::Owner' attributes are not compatible}} // expected-note@-5 {{conflicting attribute is here}} // CHECK: CXXRecordDecl {{.*}} AddConflictLater // CHECK: OwnerAttr {{.*}} Inherited int class [[gsl::Owner()]] [[gsl::Owner(int)]] WithAndWithoutParameter{}; -// expected-error@-1 {{'Owner' and 'Owner' attributes are not compatible}} +// expected-error@-1 {{'gsl::Owner' and 'gsl::Owner' attributes are not compatible}} // expected-note@-2 {{conflicting attribute is here}} // CHECK: CXXRecordDecl {{.*}} WithAndWithoutParameter // CHECK: OwnerAttr class [[gsl::Owner(int &)]] ReferenceType{}; -// expected-error@-1 {{a reference type is an invalid argument to attribute 'Owner'}} +// expected-error@-1 {{a reference type is an invalid argument to attribute 'gsl::Owner'}} class [[gsl::Pointer(int[])]] ArrayType{}; -// expected-error@-1 {{an array type is an invalid argument to attribute 'Pointer'}} +// expected-error@-1 {{an array type is an invalid argument to attribute 'gsl::Pointer'}} class [[gsl::Owner]] OwnerMissingParameter{}; // CHECK: CXXRecordDecl {{.*}} OwnerMissingParameter diff --git a/clang/test/SemaCXX/attr-lifetime-capture-by.cpp b/clang/test/SemaCXX/attr-lifetime-capture-by.cpp index 03ab425331720..70a5fe5a45376 100644 --- a/clang/test/SemaCXX/attr-lifetime-capture-by.cpp +++ b/clang/test/SemaCXX/attr-lifetime-capture-by.cpp @@ -8,7 +8,7 @@ struct S { /////////////////////////// // Test for valid usages. /////////////////////////// -[[clang::lifetime_capture_by(unknown)]] // expected-error {{'lifetime_capture_by' attribute only applies to parameters and implicit object parameters}} +[[clang::lifetime_capture_by(unknown)]] // expected-error {{'clang::lifetime_capture_by' attribute only applies to parameters and implicit object parameters}} void nonMember( const int &x1 [[clang::lifetime_capture_by(s, t)]], S &s, diff --git a/clang/test/SemaCXX/attr-lifetimebound.cpp b/clang/test/SemaCXX/attr-lifetimebound.cpp index 2bb88171bdfe4..06532550d312e 100644 --- a/clang/test/SemaCXX/attr-lifetimebound.cpp +++ b/clang/test/SemaCXX/attr-lifetimebound.cpp @@ -10,24 +10,24 @@ namespace usage_invalid { static int *static_class_member() [[clang::lifetimebound]]; // expected-error {{static member function has no implicit object parameter}} int *explicit_object(this A&) [[clang::lifetimebound]]; // expected-error {{explicit object member function has no implicit object parameter}} int attr_on_var [[clang::lifetimebound]]; // expected-error {{only applies to parameters and implicit object parameters}} - int [[clang::lifetimebound]] attr_on_int; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - int * [[clang::lifetimebound]] attr_on_int_ptr; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - int * [[clang::lifetimebound]] * attr_on_int_ptr_ptr; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - int (* [[clang::lifetimebound]] attr_on_func_ptr)(); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} + int [[clang::lifetimebound]] attr_on_int; // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + int * [[clang::lifetimebound]] attr_on_int_ptr; // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + int * [[clang::lifetimebound]] * attr_on_int_ptr_ptr; // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + int (* [[clang::lifetimebound]] attr_on_func_ptr)(); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} void void_return_member() [[clang::lifetimebound]]; // expected-error {{'lifetimebound' attribute cannot be applied to an implicit object parameter of a function that returns void; did you mean 'lifetime_capture_by(X)'}} }; int *attr_with_param(int ¶m [[clang::lifetimebound(42)]]); // expected-error {{takes no arguments}} - void attr_on_ptr_arg(int * [[clang::lifetimebound]] ptr); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - static_assert((int [[clang::lifetimebound]]) 12); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - int* attr_on_unnamed_arg(const int& [[clang::lifetimebound]]); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} + void attr_on_ptr_arg(int * [[clang::lifetimebound]] ptr); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + static_assert((int [[clang::lifetimebound]]) 12); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + int* attr_on_unnamed_arg(const int& [[clang::lifetimebound]]); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} template - int* attr_on_template_ptr_arg(T * [[clang::lifetimebound]] ptr); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} + int* attr_on_template_ptr_arg(T * [[clang::lifetimebound]] ptr); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} - int (*func_ptr)(int) [[clang::lifetimebound]]; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} - int (*(*func_ptr_ptr)(int) [[clang::lifetimebound]])(int); // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} + int (*func_ptr)(int) [[clang::lifetimebound]]; // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} + int (*(*func_ptr_ptr)(int) [[clang::lifetimebound]])(int); // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} struct X {}; - int (X::*member_func_ptr)(int) [[clang::lifetimebound]]; // expected-error {{'lifetimebound' attribute only applies to parameters and implicit object parameters}} + int (X::*member_func_ptr)(int) [[clang::lifetimebound]]; // expected-error {{'clang::lifetimebound' attribute only applies to parameters and implicit object parameters}} } namespace usage_ok { diff --git a/clang/test/SemaCXX/attr-lto-visibility-public.cpp b/clang/test/SemaCXX/attr-lto-visibility-public.cpp index 42e0f79279d9b..9f1f2f4d9c367 100644 --- a/clang/test/SemaCXX/attr-lto-visibility-public.cpp +++ b/clang/test/SemaCXX/attr-lto-visibility-public.cpp @@ -1,14 +1,14 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s -int i [[clang::lto_visibility_public]]; // expected-warning {{'lto_visibility_public' attribute only applies to structs, unions, and classes}} -typedef int t [[clang::lto_visibility_public]]; // expected-warning {{'lto_visibility_public' attribute only applies to}} -[[clang::lto_visibility_public]] void f(); // expected-warning {{'lto_visibility_public' attribute only applies to}} -void f() [[clang::lto_visibility_public]]; // expected-error {{'lto_visibility_public' attribute cannot be applied to types}} +int i [[clang::lto_visibility_public]]; // expected-warning {{'clang::lto_visibility_public' attribute only applies to structs, unions, and classes}} +typedef int t [[clang::lto_visibility_public]]; // expected-warning {{'clang::lto_visibility_public' attribute only applies to}} +[[clang::lto_visibility_public]] void f(); // expected-warning {{'clang::lto_visibility_public' attribute only applies to}} +void f() [[clang::lto_visibility_public]]; // expected-error {{'clang::lto_visibility_public' attribute cannot be applied to types}} struct [[clang::lto_visibility_public]] s1 { - int i [[clang::lto_visibility_public]]; // expected-warning {{'lto_visibility_public' attribute only applies to}} - [[clang::lto_visibility_public]] void f(); // expected-warning {{'lto_visibility_public' attribute only applies to}} + int i [[clang::lto_visibility_public]]; // expected-warning {{'clang::lto_visibility_public' attribute only applies to}} + [[clang::lto_visibility_public]] void f(); // expected-warning {{'clang::lto_visibility_public' attribute only applies to}} }; -struct [[clang::lto_visibility_public(1)]] s2 { // expected-error {{'lto_visibility_public' attribute takes no arguments}} +struct [[clang::lto_visibility_public(1)]] s2 { // expected-error {{'clang::lto_visibility_public' attribute takes no arguments}} }; diff --git a/clang/test/SemaCXX/attr-musttail.cpp b/clang/test/SemaCXX/attr-musttail.cpp index 12cfd89c64a6f..b88f031c64574 100644 --- a/clang/test/SemaCXX/attr-musttail.cpp +++ b/clang/test/SemaCXX/attr-musttail.cpp @@ -2,33 +2,33 @@ int ReturnsInt1(); int Func1() { - [[clang::musttail]] ReturnsInt1(); // expected-error {{'musttail' attribute only applies to return statements}} - [[clang::musttail(1, 2)]] return ReturnsInt1(); // expected-error {{'musttail' attribute takes no arguments}} - [[clang::musttail]] return 5; // expected-error {{'musttail' attribute requires that the return value is the result of a function call}} + [[clang::musttail]] ReturnsInt1(); // expected-error {{'clang::musttail' attribute only applies to return statements}} + [[clang::musttail(1, 2)]] return ReturnsInt1(); // expected-error {{'clang::musttail' attribute takes no arguments}} + [[clang::musttail]] return 5; // expected-error {{'clang::musttail' attribute requires that the return value is the result of a function call}} [[clang::musttail]] return ReturnsInt1(); } void NoFunctionCall() { - [[clang::musttail]] return; // expected-error {{'musttail' attribute requires that the return value is the result of a function call}} + [[clang::musttail]] return; // expected-error {{'clang::musttail' attribute requires that the return value is the result of a function call}} } -[[clang::musttail]] static int int_val = ReturnsInt1(); // expected-error {{'musttail' attribute cannot be applied to a declaration}} +[[clang::musttail]] static int int_val = ReturnsInt1(); // expected-error {{'clang::musttail' attribute cannot be applied to a declaration}} void NoParams(); // expected-note {{target function has different number of parameters (expected 1 but has 0)}} void TestParamArityMismatch(int x) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return NoParams(); // expected-error {{cannot perform a tail call to function 'NoParams' because its signature is incompatible with the calling function}} } void LongParam(long x); // expected-note {{target function has type mismatch at 1st parameter (expected 'long' but has 'int')}} void TestParamTypeMismatch(int x) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return LongParam(x); // expected-error {{cannot perform a tail call to function 'LongParam' because its signature is incompatible with the calling function}} } long ReturnsLong(); // expected-note {{target function has different return type ('int' expected but has 'long')}} int TestReturnTypeMismatch() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return ReturnsLong(); // expected-error {{cannot perform a tail call to function 'ReturnsLong' because its signature is incompatible with the calling function}} } @@ -37,14 +37,14 @@ struct Struct1 { }; void TestNonMemberToMember() { Struct1 st; - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return st.MemberFunction(); // expected-error {{non-member function cannot perform a tail call to non-static member function 'MemberFunction'}} } void ReturnsVoid(); // expected-note {{'ReturnsVoid' declared here}} struct Struct2 { void TestMemberToNonMember() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return ReturnsVoid(); // expected-error{{non-static member function cannot perform a tail call to non-member function 'ReturnsVoid'}} } }; @@ -75,7 +75,7 @@ HasNonTrivialDestructor TestReturnsNonTrivialValue() { } HasNonTrivialDestructor TestReturnsNonTrivialNonFunctionCall() { - [[clang::musttail]] return HasNonTrivialDestructor(); // expected-error {{'musttail' attribute requires that the return value is the result of a function call}} + [[clang::musttail]] return HasNonTrivialDestructor(); // expected-error {{'clang::musttail' attribute requires that the return value is the result of a function call}} } struct UsesPointerToMember { @@ -83,7 +83,7 @@ struct UsesPointerToMember { }; void TestUsesPointerToMember(UsesPointerToMember *foo) { // "this" pointer cannot double as first parameter. - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return (foo->*(foo->p_mem))(); // expected-error {{non-member function cannot perform a tail call to pointer-to-member function 'p_mem'}} } @@ -107,7 +107,7 @@ int OkTemplateFunc(int x) { } template T BadTemplateFunc(T x) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return TemplateFunc(x); // expected-error {{cannot perform a tail call to function 'TemplateFunc' because its signature is incompatible with the calling function}} } long TestBadTemplateFunc(long x) { @@ -126,17 +126,17 @@ void TestNonTrivialDestructorSubArg(int x) { void VariadicFunction(int x, ...); void TestVariadicFunction(int x, ...) { - [[clang::musttail]] return VariadicFunction(x); // expected-error {{'musttail' attribute may not be used with variadic functions}} + [[clang::musttail]] return VariadicFunction(x); // expected-error {{'clang::musttail' attribute may not be used with variadic functions}} } int TakesIntParam(int x); // expected-note {{target function has type mismatch at 1st parameter (expected 'int' but has 'short')}} int TakesShortParam(short x); // expected-note {{target function has type mismatch at 1st parameter (expected 'short' but has 'int')}} int TestIntParamMismatch(int x) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return TakesShortParam(x); // expected-error {{cannot perform a tail call to function 'TakesShortParam' because its signature is incompatible with the calling function}} } int TestIntParamMismatch2(short x) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return TakesIntParam(x); // expected-error {{cannot perform a tail call to function 'TakesIntParam' because its signature is incompatible with the calling function}} } @@ -146,20 +146,20 @@ struct TestClassMismatch1 { TestClassMismatch1 *tcm1; struct TestClassMismatch2 { void FromFunction() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return tcm1->ToFunction(); // expected-error {{cannot perform a tail call to function 'ToFunction' because its signature is incompatible with the calling function}} } }; __regcall int RegCallReturnsInt(); // expected-note {{target function has calling convention regcall (expected cdecl)}} int TestMismatchCallingConvention() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return RegCallReturnsInt(); // expected-error {{cannot perform a tail call to function 'RegCallReturnsInt' because it uses an incompatible calling convention}} } int TestNonCapturingLambda() { auto lambda = []() { return 12; }; // expected-note {{'operator()' declared here}} - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return lambda(); // expected-error {{non-member function cannot perform a tail call to non-static member function 'operator()'}} // This works. @@ -171,7 +171,7 @@ int TestNonCapturingLambda() { int TestCapturingLambda() { int x; auto lambda = [x]() { return 12; }; // expected-note {{'operator()' declared here}} - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return lambda(); // expected-error {{non-member function cannot perform a tail call to non-static member function 'operator()'}} } @@ -182,14 +182,14 @@ int TestNonTrivialTemporary(int) { void ReturnsVoid(); struct TestDestructor { ~TestDestructor() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return ReturnsVoid(); // expected-error {{destructor '~TestDestructor' must not return void expression}} // expected-error {{cannot perform a tail call from a destructor}} } }; struct ClassWithDestructor { // expected-note {{target destructor is declared here}} void TestExplicitDestructorCall() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return this->~ClassWithDestructor(); // expected-error {{cannot perform a tail call to a destructor}} } }; @@ -201,14 +201,14 @@ HasNonTrivialCopyConstructor ReturnsClassByValue(); HasNonTrivialCopyConstructor TestNonElidableCopyConstructor() { // This is an elidable constructor, but when it is written explicitly // we decline to elide it. - [[clang::musttail]] return HasNonTrivialCopyConstructor(ReturnsClassByValue()); // expected-error{{'musttail' attribute requires that the return value is the result of a function call}} + [[clang::musttail]] return HasNonTrivialCopyConstructor(ReturnsClassByValue()); // expected-error{{'clang::musttail' attribute requires that the return value is the result of a function call}} } struct ClassWithConstructor { ClassWithConstructor() = default; // expected-note {{target constructor is declared here}} }; void TestExplicitConstructorCall(ClassWithConstructor a) { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return a.ClassWithConstructor::ClassWithConstructor(); // expected-error{{cannot perform a tail call to a constructor}} expected-warning{{explicit constructor calls are a Microsoft extension}} } @@ -230,14 +230,14 @@ void TestTryBlock() { using IntFunctionType = int(); IntFunctionType *ReturnsIntFunction(); long TestRValueFunctionPointer() { - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return ReturnsIntFunction()(); // expected-error{{cannot perform a tail call to function because its signature is incompatible with the calling function}} // expected-note{{target function has different return type ('long' expected but has 'int')}} } void TestPseudoDestructor() { int n; using T = int; - [[clang::musttail]] // expected-note {{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note {{tail call required by 'clang::musttail' attribute here}} return n.~T(); // expected-error{{cannot perform a tail call to a destructor}} } @@ -249,7 +249,7 @@ struct StructPMF { StructPMF *St; StructPMF::PMF ReturnsPMF(); void StructPMF::TestReturnsPMF() { - [[clang::musttail]] // expected-note{{tail call required by 'musttail' attribute here}} + [[clang::musttail]] // expected-note{{tail call required by 'clang::musttail' attribute here}} return (St->*ReturnsPMF())(); // expected-error{{static member function cannot perform a tail call to pointer-to-member function}} } diff --git a/clang/test/SemaCXX/attr-no-specializations.cpp b/clang/test/SemaCXX/attr-no-specializations.cpp index 64f6a76416605..1fb57db14a446 100644 --- a/clang/test/SemaCXX/attr-no-specializations.cpp +++ b/clang/test/SemaCXX/attr-no-specializations.cpp @@ -4,15 +4,15 @@ # error #endif -struct [[clang::no_specializations]] S {}; // expected-warning {{'no_specializations' attribute only applies to class templates, function templates, and variable templates}} +struct [[clang::no_specializations]] S {}; // expected-warning {{'clang::no_specializations' attribute only applies to class templates, function templates, and variable templates}} template -struct [[clang::no_specializations]] is_same { // expected-note 2 {{marked 'no_specializations' here}} +struct [[clang::no_specializations]] is_same { // expected-note 2 {{marked 'clang::no_specializations' here}} static constexpr bool value = __is_same(T, U); }; template -using alias [[clang::no_specializations]] = T; // expected-warning {{'no_specializations' attribute only applies to class templates, function templates, and variable templates}} +using alias [[clang::no_specializations]] = T; // expected-warning {{'clang::no_specializations' attribute only applies to class templates, function templates, and variable templates}} template <> struct is_same {}; // expected-error {{'is_same' cannot be specialized}} @@ -26,7 +26,7 @@ struct is_same, Template > {}; // expected-error {{'is_same' cann bool test_instantiation1 = is_same::value; template -[[clang::no_specializations]] inline constexpr bool is_same_v = __is_same(T, U); // expected-note 2 {{marked 'no_specializations' here}} +[[clang::no_specializations]] inline constexpr bool is_same_v = __is_same(T, U); // expected-note 2 {{marked 'clang::no_specializations' here}} template <> inline constexpr bool is_same_v = false; // expected-error {{'is_same_v' cannot be specialized}} @@ -37,7 +37,7 @@ inline constexpr bool is_same_v