llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Corentin Jabot (cor3ntin)

<details>
<summary>Changes</summary>

Implement https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3475r2.pdf 
by rebasing https://reviews.llvm.org/D143670

That initial PR was rejected - however since then, ``[[carries_dependency]]` 
was removed from the C++ standard.
And while that paper was not a DR, it seems reasonable to no longer support 
this attribute at all.
We never did anything with it.

Code search  on github found very few uses, except for an old fork of EASTL.

Note that neither GCC, MSVC, or EDG recognize the attribute.

---

Patch is 33.28 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/219912.diff


20 Files Affected:

- (modified) clang/docs/ReleaseNotes.md (+8) 
- (modified) clang/include/clang/Basic/Attr.td (-7) 
- (modified) clang/include/clang/Basic/AttrDocs.td (-17) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (-8) 
- (modified) clang/lib/Parse/ParseDeclCXX.cpp (-1) 
- (modified) clang/lib/Sema/SemaDecl.cpp (-30) 
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+3-22) 
- (removed) clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp (-32) 
- (removed) clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp (-14) 
- (modified) clang/test/CodeCompletion/attr.cpp (+3-9) 
- (modified) clang/test/Misc/pragma-attribute-supported-attributes-list.test 
(-1) 
- (modified) clang/test/Parser/cxx0x-attributes.cpp (+3-2) 
- (modified) clang/test/Parser/cxx11-stmt-attributes.cpp (+15-15) 
- (modified) clang/test/Parser/cxx1z-decomposition.cpp (-1) 
- (modified) clang/test/Parser/stmt-attributes.c (+14-14) 
- (modified) clang/test/Preprocessor/has_attribute.cpp (+2-1) 
- (modified) clang/test/Preprocessor/macro-reserved-attrs-cxx11.cpp (+5-4) 
- (modified) clang/test/SemaCXX/attr-cxx0x.cpp (+2-1) 
- (modified) clang/test/SemaCXX/cxx2c-attributes.cpp (+2-1) 
- (modified) clang/www/cxx_status.html (+3-3) 


``````````diff
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 83a2b10d96046..1cd83263459e8 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -53,6 +53,10 @@ in a future version of Clang.
 
 ### C++ Specific Potentially Breaking Changes
 
+- The `[[carries_dependency]]` attribute is no longer recognized, in any 
language
+  mode, as it was removed from the standard by
+  [P3475R2](https://wg21.link/P3475R2).
+
 ### ABI Changes in This Version
 
 - Except on PlayStation, Clang now derives the x86-64 System V AVX ABI level
@@ -95,6 +99,10 @@ features cannot lower the translation-unit ABI level;
 
 - Clang now supports 
[P3533R2](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3533r2.html)
 (constexpr virtual inheritance).
 
+- Implemented the language part of [P3475R2](https://wg21.link/P3475R2) (Defang
+  and deprecate `memory_order::consume`) by removing support for the
+  `[[carries_dependency]]` attribute.
+
 #### C++23 Feature Support
 
 #### C++20 Feature Support
diff --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 39c672322d515..295cb00f59e35 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1299,13 +1299,6 @@ def Bounded : IgnoredAttr {
   let Spellings = [GNU<"bounded">];
 }
 
-def CarriesDependency : InheritableParamAttr {
-  let Spellings = [GNU<"carries_dependency">,
-                   CXX11<"","carries_dependency", 200809>];
-  let Subjects = SubjectList<[ParmVar, ObjCMethod, Function], ErrorDiag>;
-  let Documentation = [CarriesDependencyDocs];
-}
-
 def CDecl : DeclOrTypeAttr {
   let Spellings = [GCC<"cdecl">, CustomKeyword<"__cdecl">, 
CustomKeyword<"_cdecl">];
 //  let Subjects = [Function, ObjCMethod];
diff --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 05e4cb0870652..d5d1a35ea27f2 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -444,23 +444,6 @@ Sample usage:
   }];
 }
 
-def CarriesDependencyDocs : Documentation {
-  let Category = DocCatFunction;
-  let Content = [{
-The ``carries_dependency`` attribute specifies dependency propagation into and
-out of functions.
-
-When specified on a function or Objective-C method, the ``carries_dependency``
-attribute means that the return value carries a dependency out of the function,
-so that the implementation need not constrain ordering upon return from that
-function. Implementations of the function and its caller may choose to preserve
-dependencies instead of emitting memory ordering instructions such as fences.
-
-Note, this attribute does not change the meaning of the program, but may result
-in generation of more efficient code.
-  }];
-}
-
 def CPUSpecificCPUDispatchDocs : Documentation {
   let Category = DocCatFunction;
   let Content = [{
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index cce6f70a58893..ccdf807e1cfcd 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -11442,14 +11442,6 @@ def err_noreturn_has_return_expr : Error<
 def warn_noreturn_coroutine : Warning<
   "coroutine %0 cannot be declared 'noreturn' as it always returns a coroutine 
handle">,
   InGroup<InvalidNoreturn>;
-def err_carries_dependency_missing_on_first_decl : Error<
-  "%select{function|parameter}0 declared '[[carries_dependency]]' "
-  "after its first declaration">;
-def note_carries_dependency_missing_first_decl : Note<
-  "declaration missing '[[carries_dependency]]' attribute is here">;
-def err_carries_dependency_param_not_function_decl : Error<
-  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
-  "declaration or lambda">;
 def err_block_not_allowed_on : Error<
   "'__block' is not allowed on %enum_select<NotAllowedBlockVarReason>{"
   "%NonlocalVariable{a nonlocal variable}|"
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 150987dae332d..f123e76bb307c 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/lib/Parse/ParseDeclCXX.cpp
@@ -4378,7 +4378,6 @@ static bool 
IsBuiltInOrStandardCXX11Attribute(IdentifierInfo *AttrName,
                                               IdentifierInfo *ScopeName) {
   switch (
       ParsedAttr::getParsedKind(AttrName, ScopeName, ParsedAttr::AS_CXX11)) {
-  case ParsedAttr::AT_CarriesDependency:
   case ParsedAttr::AT_Deprecated:
   case ParsedAttr::AT_FallThrough:
   case ParsedAttr::AT_CXX11NoReturn:
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7de5542e72559..0131728fdf740 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3452,24 +3452,6 @@ static void propagateAttributes(ParmVarDecl *To, const 
ParmVarDecl *From,
 static void mergeParamDeclAttributes(ParmVarDecl *newDecl,
                                      const ParmVarDecl *oldDecl,
                                      Sema &S) {
-  // C++11 [dcl.attr.depend]p2:
-  //   The first declaration of a function shall specify the
-  //   carries_dependency attribute for its declarator-id if any declaration
-  //   of the function specifies the carries_dependency attribute.
-  const CarriesDependencyAttr *CDA = newDecl->getAttr<CarriesDependencyAttr>();
-  if (CDA && !oldDecl->hasAttr<CarriesDependencyAttr>()) {
-    S.Diag(CDA->getLocation(),
-           diag::err_carries_dependency_missing_on_first_decl) << 1/*Param*/;
-    // Find the first declaration of the parameter.
-    // FIXME: Should we build redeclaration chains for function parameters?
-    const FunctionDecl *FirstFD =
-      cast<FunctionDecl>(oldDecl->getDeclContext())->getFirstDecl();
-    const ParmVarDecl *FirstVD =
-      FirstFD->getParamDecl(oldDecl->getFunctionScopeIndex());
-    S.Diag(FirstVD->getLocation(),
-           diag::note_carries_dependency_missing_first_decl) << 1/*Param*/;
-  }
-
   propagateAttributes(
       newDecl, oldDecl, [&S](ParmVarDecl *To, const ParmVarDecl *From) {
         unsigned found = 0;
@@ -4225,18 +4207,6 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, 
NamedDecl *&OldD, Scope *S,
         Diag(Old->getLocation(), diag::note_previous_declaration);
       }
 
-    // C++11 [dcl.attr.depend]p2:
-    //   The first declaration of a function shall specify the
-    //   carries_dependency attribute for its declarator-id if any declaration
-    //   of the function specifies the carries_dependency attribute.
-    const CarriesDependencyAttr *CDA = New->getAttr<CarriesDependencyAttr>();
-    if (CDA && !Old->hasAttr<CarriesDependencyAttr>()) {
-      Diag(CDA->getLocation(),
-           diag::err_carries_dependency_missing_on_first_decl) << 
0/*Function*/;
-      Diag(Old->getFirstDecl()->getLocation(),
-           diag::note_carries_dependency_missing_first_decl) << 0/*Function*/;
-    }
-
     // SYCL 2020 section 5.10.1, "SYCL functions and member functions linkage":
     //   When a function is declared with SYCL_EXTERNAL, that macro must be
     //   used on the first declaration of that function in the translation 
unit.
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 1b272b5416860..6811d83bd670d 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2293,21 +2293,6 @@ static void handleVecReturnAttr(Sema &S, Decl *D, const 
ParsedAttr &AL) {
   D->addAttr(::new (S.Context) VecReturnAttr(S.Context, AL));
 }
 
-static void handleDependencyAttr(Sema &S, Scope *Scope, Decl *D,
-                                 const ParsedAttr &AL) {
-  if (isa<ParmVarDecl>(D)) {
-    // [[carries_dependency]] can only be applied to a parameter if it is a
-    // parameter of a function declaration or lambda.
-    if (!(Scope->getFlags() & clang::Scope::FunctionDeclarationScope)) {
-      S.Diag(AL.getLoc(),
-             diag::err_carries_dependency_param_not_function_decl);
-      return;
-    }
-  }
-
-  D->addAttr(::new (S.Context) CarriesDependencyAttr(S.Context, AL));
-}
-
 static void handleUnusedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   bool IsCXX17Attr = AL.isCXX11Attribute() && !AL.getScopeName();
 
@@ -7554,7 +7539,7 @@ static void handlePersonalityAttr(Sema &S, Decl *D, const 
ParsedAttr &AL) {
 /// the attribute applies to decls.  If the attribute is a type attribute, just
 /// silently ignore it if a GNU attribute.
 static void
-ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
+ProcessDeclAttribute(Sema &S, Decl *D, const ParsedAttr &AL,
                      const Sema::ProcessDeclAttributeOptions &Options) {
   if (AL.isInvalid() || AL.getKind() == ParsedAttr::IgnoredAttribute)
     return;
@@ -7777,9 +7762,6 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, 
const ParsedAttr &AL,
   case ParsedAttr::AT_Availability:
     handleAvailabilityAttr(S, D, AL);
     break;
-  case ParsedAttr::AT_CarriesDependency:
-    handleDependencyAttr(S, scope, D, AL);
-    break;
   case ParsedAttr::AT_CPUDispatch:
   case ParsedAttr::AT_CPUSpecific:
     handleCPUSpecificAttr(S, D, AL);
@@ -8553,7 +8535,7 @@ void Sema::ProcessDeclAttributeList(
     return;
 
   for (const ParsedAttr &AL : AttrList)
-    ProcessDeclAttribute(*this, S, D, AL, Options);
+    ProcessDeclAttribute(*this, D, AL, Options);
 
   // FIXME: We should be able to handle these cases in TableGen.
   // GCC accepts
@@ -8674,8 +8656,7 @@ bool Sema::ProcessAccessDeclAttributeList(
     AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList) {
   for (const ParsedAttr &AL : AttrList) {
     if (AL.getKind() == ParsedAttr::AT_Annotate) {
-      ProcessDeclAttribute(*this, nullptr, ASDecl, AL,
-                           ProcessDeclAttributeOptions());
+      ProcessDeclAttribute(*this, ASDecl, AL, ProcessDeclAttributeOptions());
     } else {
       Diag(AL.getLoc(), diag::err_only_annotate_after_access_spec);
       return true;
diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp 
b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
deleted file mode 100644
index 424b159667c3b..0000000000000
--- a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// RUN: %clang_cc1 -verify -std=c++11 %s
-
-[[carries_dependency, carries_dependency]] int m1(); // ok
-[[carries_dependency]] [[carries_dependency]] int m2(); // ok
-[[carries_dependency()]] int m3(); // expected-error {{attribute 
'carries_dependency' cannot have an argument list}}
-
-[[carries_dependency]] void f1(); // FIXME: warn here
-[[carries_dependency]] int f2(); // ok
-int f3(int param [[carries_dependency]]); // ok
-[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' 
attribute only applies to parameters, Objective-C methods, and functions}}
-int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' 
attribute only applies to}}
-int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' 
attribute cannot be applied to types}}
-int (*f7)(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-int (((f8)))(int n [[carries_dependency]]); // ok
-int (*f9(int n))(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-int typedef f10(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-using T = int(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-struct S {
-  [[carries_dependency]] int f(int n [[carries_dependency]]); // ok
-  int (*p)(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-};
-void f() {
-  [[carries_dependency]] int f(int n [[carries_dependency]]); // ok
-  [[carries_dependency]] // expected-error {{'carries_dependency' attribute 
only applies to}}
-      int (*p)(int n [[carries_dependency]]); // expected-error 
{{'[[carries_dependency]]' attribute only allowed on parameter in a function 
declaration}}
-}
-
-auto l1 = [](int n [[carries_dependency]]) {};
-// There's no way to write a lambda such that the return value carries
-// a dependency, because an attribute applied to the lambda appertains to
-// the *type* of the operator() function, not to the function itself.
-auto l2 = []() [[carries_dependency]] {}; // expected-error 
{{'carries_dependency' attribute cannot be applied to types}}
diff --git a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp 
b/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp
deleted file mode 100644
index d5b0ebf459f88..0000000000000
--- a/clang/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang_cc1 -verify -std=c++11 %s
-
-int f(int); // expected-note 2{{declaration missing '[[carries_dependency]]' 
attribute is here}}
-[[carries_dependency]] int f(int); // expected-error {{function declared 
'[[carries_dependency]]' after its first declaration}}
-int f(int n [[carries_dependency]]); // expected-error {{parameter declared 
'[[carries_dependency]]' after its first declaration}}
-
-int g([[carries_dependency]] int n); // expected-note {{declaration missing 
'[[carries_dependency]]' attribute is here}}
-int g(int);
-[[carries_dependency]] int g(int); // expected-error {{function declared 
'[[carries_dependency]]' after its first declaration}}
-int g(int n [[carries_dependency]]);
-
-int h [[carries_dependency]]();
-int h();
-[[carries_dependency]] int h();
diff --git a/clang/test/CodeCompletion/attr.cpp 
b/clang/test/CodeCompletion/attr.cpp
index cff0fa7224b6c..cf7298e742e83 100644
--- a/clang/test/CodeCompletion/attr.cpp
+++ b/clang/test/CodeCompletion/attr.cpp
@@ -1,12 +1,10 @@
 int a [[gnu::used]];
 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):9 %s | FileCheck 
--check-prefix=STD %s
-// STD:     COMPLETION: Pattern : __carries_dependency__
 // STD-NOT: COMPLETION: Pattern : __convergent__
 // STD:     COMPLETION: Pattern : __gnu__::__used__
 // STD-NOT: COMPLETION: Pattern : __gnu__::used
 // STD-NOT: COMPLETION: Pattern : __used__
 // STD:     COMPLETION: Pattern : _Clang::__convergent__
-// STD:     COMPLETION: Pattern : carries_dependency
 // STD-NOT: COMPLETION: Pattern : clang::called_once
 // STD:     COMPLETION: Pattern : clang::convergent
 // STD-NOT: COMPLETION: Pattern : convergent
@@ -15,11 +13,10 @@ int a [[gnu::used]];
 // STD:     COMPLETION: Pattern : gnu::alias(<#Aliasee#>)
 // STD:     COMPLETION: Pattern : gnu::used
 // STD-NOT: COMPLETION: Pattern : used
-// RUN: %clang_cc1 -code-completion-at=%s:%(line-17):9 -xobjective-c++ %s | 
FileCheck --check-prefix=STD-OBJC %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-15):9 -xobjective-c++ %s | 
FileCheck --check-prefix=STD-OBJC %s
 // STD-OBJC: COMPLETION: Pattern : clang::called_once
-// RUN: %clang_cc1 -code-completion-at=%s:%(line-19):14 %s | FileCheck 
--check-prefix=STD-NS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-17):14 %s | FileCheck 
--check-prefix=STD-NS %s
 // STD-NS-NOT: COMPLETION: Pattern : __used__
-// STD-NS-NOT: COMPLETION: Pattern : carries_dependency
 // STD-NS-NOT: COMPLETION: Pattern : clang::convergent
 // STD-NS-NOT: COMPLETION: Pattern : convergent
 // STD-NS-NOT: COMPLETION: Pattern : gnu::used
@@ -33,21 +30,18 @@ int c [[using gnu: used]];
 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):15 %s | FileCheck 
--check-prefix=STD-USING %s
 // STD-USING:     COMPLETION: __gnu__
 // STD-USING:     COMPLETION: _Clang
-// STD-USING-NOT: COMPLETION: Pattern : carries_dependency
 // STD-USING:     COMPLETION: clang
 // STD-USING-NOT: COMPLETION: Pattern : clang::
 // STD-USING-NOT: COMPLETION: Pattern : gnu::
 // STD-USING:     COMPLETION: gnu
-// RUN: %clang_cc1 -code-completion-at=%s:%(line-9):20 %s | FileCheck 
--check-prefix=STD-NS %s
+// RUN: %clang_cc1 -code-completion-at=%s:%(line-8):20 %s | FileCheck 
--check-prefix=STD-NS %s
 
 int d __attribute__((used));
 // RUN: %clang_cc1 -code-completion-at=%s:%(line-1):22 %s | FileCheck 
--check-prefix=GNU %s
-// GNU:     COMPLETION: Pattern : __carries_dependency__
 // GNU:     COMPLETION: Pattern : __convergent__
 // GNU-NOT: COMPLETION: Pattern : __gnu__::__used__
 // GNU:     COMPLETION: Pattern : __used__
 // GNU-NOT: COMPLETION: Pattern : _Clang::__convergent__
-// GNU:     COMPLETION: Pattern : carries_dependency
 // GNU-NOT: COMPLETION: Pattern : clang::convergent
 // GNU:     COMPLETION: Pattern : convergent
 // GNU-NOT: COMPLETION: Pattern : gnu::used
diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test 
b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
index 8bca68e2119e7..ed2022e3b40d9 100644
--- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -51,7 +51,6 @@
 // CHECK-NEXT: Callback (SubjectMatchRule_function)
 // CHECK-NEXT: CalledOnce (SubjectMatchRule_variable_is_parameter)
 // CHECK-NEXT: Capability (SubjectMatchRule_record, 
SubjectMatchRule_type_alias)
-// CHECK-NEXT: CarriesDependency (SubjectMatchRule_variable_is_parameter, 
SubjectMatchRule_objc_method, SubjectMatchRule_function)
 // CHECK-NEXT: Cleanup (SubjectMatchRule_variable_is_local)
 // CHECK-NEXT: ClspvLibclcBuiltin (SubjectMatchRule_function)
 // CHECK-NEXT: CmseNSEntry (SubjectMatchRule_function)
diff --git a/clang/test/Parser/cxx0x-attributes.cpp 
b/clang/test/Parser/cxx0x-attributes.cpp
index 220fddb98127a..a587f40aadd98 100644
--- a/clang/test/Parser/cxx0x-attributes.cpp
+++ b/clang/test/Parser/cxx0x-attributes.cpp
@@ -355,7 +355,7 @@ unsigned [[gnu::used]] static int [[gnu::unused]] v1; // 
expected-error {{'gnu::
            expected-error {{an attribute list cannot appear here}}
 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}}
+int [[deprecated]] foo(int [[deprecated]] x); // expected-error 
2{{'deprecated' attribute cannot be applied to types}}
 
 // Forbid [[gnu::...]] attributes on declarator chunks.
 int *[[gnu::unused]] v3; // expected-warning {{attribute 'gnu::unused' 
ignored}}
@@ -364,7 +364,8 @@ 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}}
-[[carries_dependency]]; // expected-error {{'carries_dependency' attribute 
only applies to parameters, Objective-C methods, and functions}}
+// carries_dependency was removed from the standard by P3475R2.
+[[carries_dependency]]; // expected-warning {{unknown attribute 
'carries_dependency' ignored}}
 
 class A {
   A([[gnu::unused]] int a);
diff --git a/clang/test/Parser/cxx11-stmt-attributes.cpp 
b/clang/test/Parser/cxx11-stmt-attributes.cpp
index 75fb37ea9fb44..09e1fe892daf4 100644
--- a/clang/test/Parser/cxx11-stmt-attributes.cpp
+++ b/clang/test/Parser/cxx11-stmt-attributes.cpp
@@ -42,7 +42,7 @@ void foo(int i) {
   [[unused]] switch (i) { // expected-warning {{unknown attribute 'unused' 
ignored}}
     [[uuid]] case 0: // expected-warning {{unknown attribute 'uuid' ignored}}
     [[visibility]] default: // expected-warning {{unknown attribute 
'visibility' ignored}}
-      [[carries_dependency]] break; // expected-error {{'carries_dependency' 
attribute cannot be applied to a statement}}
+      [[gnu::nonnull]] break; // expected-error {{'gnu::nonnull' attribute 
cannot be applied to a statement}}
   }
 
   [[fastcall]] goto there; // expected-warning {{unknown attribute 'fastcall' 
ignored}}
@@ -54,28 +54,28 @@ void foo(int i) {
 
   [[weakref]] return; // expected-warning {{unknown attribute 'weakref' 
ignored}}
 
-  [[carries_dependency]] ; // expected-error {{'carries_dependency' attribute 
cannot be applied to a statement}}
-  [[carries_dependency]] { } // expected-error {{'carries_dependency' 
attribute cannot be applied ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/219912
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to