llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-hlsl @llvm/pr-subscribers-backend-risc-v Author: Oleksandr T. (a-tarasyuk) <details> <summary>Changes</summary> This patch updates diagnostics to print fully qualified attribute names, including scope when present. --- Patch is 198.35 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/144619.diff 96 Files Affected: - (modified) clang/include/clang/Basic/AttributeCommonInfo.h (+17) - (modified) clang/include/clang/Basic/Diagnostic.h (+3) - (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+8-7) - (modified) clang/include/clang/Sema/ParsedAttr.h (-39) - (modified) clang/lib/AST/ASTDiagnostic.cpp (+23-1) - (modified) clang/lib/Basic/Diagnostic.cpp (+1) - (modified) clang/lib/Sema/SemaDeclAttr.cpp (+7-9) - (modified) clang/lib/Sema/SemaHLSL.cpp (+13-4) - (modified) clang/test/AST/ByteCode/functions.cpp (+1-1) - (modified) clang/test/C/C23/n3037.c (+8-8) - (modified) clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp (+1-1) - (modified) clang/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp (+1-1) - (modified) clang/test/CodeGen/RISCV/riscv-vector-callingconv.c (+1-1) - (modified) clang/test/CodeGen/RISCV/riscv-vector-callingconv.cpp (+1-1) - (modified) clang/test/Frontend/noderef.c (+5-5) - (modified) clang/test/OpenMP/attr-assume.cpp (+2-2) - (modified) clang/test/OpenMP/ompx_attributes_messages.cpp (+2-2) - (modified) clang/test/Parser/asm.c (+1-1) - (modified) clang/test/Parser/asm.cpp (+1-1) - (modified) clang/test/Parser/atomic-options.hip (+2-2) - (modified) clang/test/Parser/cxx0x-attributes.cpp (+8-8) - (modified) clang/test/Parser/cxx0x-decl.cpp (+1-1) - (modified) clang/test/Parser/pragma-attribute.cpp (+6-6) - (modified) clang/test/ParserHLSL/hlsl_contained_type_attr_error.hlsl (+6-6) - (modified) clang/test/ParserHLSL/hlsl_is_rov_attr_error.hlsl (+5-5) - (modified) clang/test/ParserHLSL/hlsl_raw_buffer_attr_error.hlsl (+5-5) - (modified) clang/test/ParserHLSL/hlsl_resource_class_attr_error.hlsl (+6-6) - (modified) clang/test/Sema/annotate-type.c (+13-13) - (modified) clang/test/Sema/annotate.c (+2-2) - (modified) clang/test/Sema/assume.c (+1-1) - (modified) clang/test/Sema/attr-alwaysinline.cpp (+13-13) - (modified) clang/test/Sema/attr-enforce-tcb-errors.cpp (+2-2) - (modified) clang/test/Sema/attr-external-source-symbol.c (+1-1) - (modified) clang/test/Sema/attr-handles.cpp (+1-1) - (modified) clang/test/Sema/attr-likelihood.c (+2-2) - (modified) clang/test/Sema/attr-mig.cpp (+1-1) - (modified) clang/test/Sema/attr-nocf_check.cpp (+3-3) - (modified) clang/test/Sema/attr-noinline.cpp (+24-24) - (modified) clang/test/Sema/attr-nomerge.cpp (+5-5) - (modified) clang/test/Sema/attr-nonblocking-sema.cpp (+6-6) - (modified) clang/test/Sema/attr-only-in-default-eval.cpp (+4-4) - (modified) clang/test/Sema/attr-preferred-type.cpp (+2-2) - (modified) clang/test/Sema/attr-regparm.c (+1-1) - (modified) clang/test/Sema/attr-type-safety.c (+2-2) - (modified) clang/test/Sema/code_align.c (+24-24) - (modified) clang/test/Sema/internal_linkage.c (+2-2) - (modified) clang/test/Sema/matrix-type-builtins.c (+4-4) - (modified) clang/test/Sema/overloadable.c (+2-2) - (modified) clang/test/Sema/patchable-function-entry-attr.cpp (+1-1) - (modified) clang/test/Sema/vector-gcc-compat.c (+2-2) - (modified) clang/test/Sema/xray-always-instrument-attr.cpp (+2-2) - (modified) clang/test/Sema/xray-log-args-class.cpp (+2-2) - (modified) clang/test/Sema/xray-log-args-oob.cpp (+4-4) - (modified) clang/test/SemaCUDA/attr-noconvergent.cu (+5-5) - (modified) clang/test/SemaCXX/PR76631.cpp (+1-1) - (modified) clang/test/SemaCXX/address-space-placement.cpp (+16-16) - (modified) clang/test/SemaCXX/annotate-type.cpp (+13-13) - (modified) clang/test/SemaCXX/attr-annotate.cpp (+7-7) - (modified) clang/test/SemaCXX/attr-cxx0x.cpp (+2-2) - (modified) clang/test/SemaCXX/attr-declspec-ignored.cpp (+12-12) - (modified) clang/test/SemaCXX/attr-deprecated-replacement-error.cpp (+1-1) - (modified) clang/test/SemaCXX/attr-flatten.cpp (+4-4) - (modified) clang/test/SemaCXX/attr-gsl-owner-pointer.cpp (+11-11) - (modified) clang/test/SemaCXX/attr-lifetime-capture-by.cpp (+1-1) - (modified) clang/test/SemaCXX/attr-lifetimebound.cpp (+11-11) - (modified) clang/test/SemaCXX/attr-lto-visibility-public.cpp (+7-7) - (modified) clang/test/SemaCXX/attr-musttail.cpp (+27-27) - (modified) clang/test/SemaCXX/attr-no-specializations.cpp (+8-8) - (modified) clang/test/SemaCXX/attr-no-speculative-load-hardening.cpp (+4-4) - (modified) clang/test/SemaCXX/attr-no-split-stack.cpp (+4-4) - (modified) clang/test/SemaCXX/attr-optnone.cpp (+3-3) - (modified) clang/test/SemaCXX/attr-reinitializes.cpp (+2-2) - (modified) clang/test/SemaCXX/attr-speculative-load-hardening.cpp (+5-5) - (modified) clang/test/SemaCXX/attr-suppress.cpp (+5-5) - (modified) clang/test/SemaCXX/attr-unsafe-buffer-usage.cpp (+1-1) - (modified) clang/test/SemaCXX/cxx11-attributes-on-using-declaration.cpp (+1-1) - (modified) clang/test/SemaCXX/cxx11-gnu-attrs.cpp (+9-9) - (modified) clang/test/SemaCXX/internal_linkage.cpp (+1-1) - (modified) clang/test/SemaCXX/ms-constexpr-invalid.cpp (+3-3) - (modified) clang/test/SemaCXX/ms-constexpr-new.cpp (+3-3) - (modified) clang/test/SemaCXX/no_destroy.cpp (+6-6) - (modified) clang/test/SemaCXX/switch-implicit-fallthrough.cpp (+3-3) - (modified) clang/test/SemaCXX/type-attrs.cpp (+3-3) - (modified) clang/test/SemaCXX/uninitialized.cpp (+2-2) - (modified) clang/test/SemaCXX/vtable_pointer_authentication_attribute.cpp (+2-2) - (modified) clang/test/SemaCXX/warn-unused-result.cpp (+21-21) - (modified) clang/test/SemaHLSL/vk-ext-input-builtin.hlsl (+5-5) - (modified) clang/test/SemaHLSL/vk.spec-constant.error.hlsl (+3-3) - (modified) clang/test/SemaObjC/attr-objc-gc.m (+2-2) - (modified) clang/test/SemaSYCL/kernel-attribute-on-non-sycl.cpp (+1-1) - (modified) clang/test/SemaSYCL/kernel-attribute.cpp (+3-3) - (modified) clang/test/SemaSYCL/special-class-attribute.cpp (+3-3) - (modified) clang/test/SemaSYCL/sycl-kernel-entry-point-attr-appertainment.cpp (+15-15) - (modified) clang/test/SemaSYCL/sycl-kernel-entry-point-attr-grammar.cpp (+2-2) - (modified) clang/test/SemaSYCL/sycl-kernel-entry-point-attr-ignored.cpp (+2-2) - (modified) clang/test/SemaTemplate/attributes.cpp (+4-4) ``````````diff 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<uint64_t>(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<DiagnosticsEngine> { /// 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 fac63a500c98f..922dac2870fca 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< @@ -4709,9 +4710,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<uint64_t>(At.getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ParsedAttr *At) { - DB.AddTaggedVal(reinterpret_cast<uint64_t>(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<std::is_same<ACI, AttributeCommonInfo>::value, int> = 0> -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI &CI) { - DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI.getAttrName()), - DiagnosticsEngine::ak_identifierinfo); - return DB; -} - -template < - typename ACI, - std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value, int> = 0> -inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB, - const ACI *CI) { - DB.AddTaggedVal(reinterpret_cast<uint64_t>(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<Attr *>(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<AttributeCommonInfo *>(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<TypedefType>()) 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<StringRef> 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 bad357b50929b..ee813b371d832 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -1641,6 +1641,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)) { @@ -1660,16 +1669,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: { @@ -1684,7 +1693,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<typename T> 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<typename T> 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<int>(); 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... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/144619 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits