https://github.com/camc updated https://github.com/llvm/llvm-project/pull/157300

>From f4380abad3d19c7234cf632afca5413ec1a9c97e Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Sat, 6 Sep 2025 18:44:57 +0000
Subject: [PATCH 1/5] [clang] Allow attributes in constructor argument list in
 pre-C++11

---
 clang/lib/Parse/ParseDecl.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 10355bb874762..62ea148701dee 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -6007,7 +6007,7 @@ bool Parser::isConstructorDeclarator(bool IsUnqualified, 
bool DeductionGuide,
 
   // A C++11 attribute here signals that we have a constructor, and is an
   // attribute on the first constructor parameter.
-  if (getLangOpts().CPlusPlus11 &&
+  if (getLangOpts().CPlusPlus &&
       isCXX11AttributeSpecifier(/*Disambiguate*/ false,
                                 /*OuterMightBeMessageSend*/ true) !=
           CXX11AttributeKind::NotAttributeSpecifier) {

>From 9f4ceb2255b0e6f30d6b9549ac7bf74d8aafdcab Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Sat, 6 Sep 2025 18:59:24 +0000
Subject: [PATCH 2/5] add test

---
 clang/test/Parser/cxx03-attributes.cpp | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 clang/test/Parser/cxx03-attributes.cpp

diff --git a/clang/test/Parser/cxx03-attributes.cpp 
b/clang/test/Parser/cxx03-attributes.cpp
new file mode 100644
index 0000000000000..565c03fae824b
--- /dev/null
+++ b/clang/test/Parser/cxx03-attributes.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 %s
+
+struct S {
+    S([[clang::lifetimebound]] int&) {}
+};
\ No newline at end of file

>From abdd4470fad919c569a82e0b2c1f98e3fe97e4cc Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Sat, 6 Sep 2025 21:37:27 +0000
Subject: [PATCH 3/5] Add release note

---
 clang/docs/ReleaseNotes.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index f36addc7857e0..7e9524cef0def 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -308,6 +308,8 @@ Bug Fixes in This Version
 - Builtin elementwise operators now accept vector arguments that have different
   qualifiers on their elements. For example, vector of 4 ``const float`` values
   and vector of 4 ``float`` values. (#GH155405)
+- Stop rejecting C++11-style attributes on the first argument of constructors 
in older
+  standards. (#GH156809).
 
 Bug Fixes to Compiler Builtins
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>From 0e20858346440faa8ffc11d0997ba756a91a278c Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Sun, 7 Sep 2025 11:05:08 +0000
Subject: [PATCH 4/5] fix test

---
 clang/docs/ReleaseNotes.rst            | 4 ++--
 clang/test/Parser/cxx03-attributes.cpp | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7e9524cef0def..21225308b6394 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -308,8 +308,6 @@ Bug Fixes in This Version
 - Builtin elementwise operators now accept vector arguments that have different
   qualifiers on their elements. For example, vector of 4 ``const float`` values
   and vector of 4 ``float`` values. (#GH155405)
-- Stop rejecting C++11-style attributes on the first argument of constructors 
in older
-  standards. (#GH156809).
 
 Bug Fixes to Compiler Builtins
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -326,6 +324,8 @@ Bug Fixes to Attribute Support
   is skipped, such as error recovery and code completion. (#GH153551)
 - Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with
   ``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520)
+- Stop rejecting C++11-style attributes on the first argument of constructors 
in older
+  standards. (#GH156809).
 
 Bug Fixes to C++ Support
 ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/test/Parser/cxx03-attributes.cpp 
b/clang/test/Parser/cxx03-attributes.cpp
index 565c03fae824b..d3afef76366a3 100644
--- a/clang/test/Parser/cxx03-attributes.cpp
+++ b/clang/test/Parser/cxx03-attributes.cpp
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 %s
+// expected-no-diagnostics
 
 struct S {
     S([[clang::lifetimebound]] int&) {}
-};
\ No newline at end of file
+};

>From 5ea56de99ac76dc206eacd7a9df1dafecee58d20 Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Sun, 7 Sep 2025 16:54:58 +0000
Subject: [PATCH 5/5] Address comments

---
 clang/docs/ReleaseNotes.rst   | 4 ++--
 clang/lib/Parse/ParseDecl.cpp | 5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 21225308b6394..9ee7943392e18 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -324,8 +324,6 @@ Bug Fixes to Attribute Support
   is skipped, such as error recovery and code completion. (#GH153551)
 - Using ``[[gnu::cleanup(some_func)]]`` where some_func is annotated with
   ``[[gnu::error("some error")]]`` now correctly triggers an error. (#GH146520)
-- Stop rejecting C++11-style attributes on the first argument of constructors 
in older
-  standards. (#GH156809).
 
 Bug Fixes to C++ Support
 ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -347,6 +345,8 @@ Bug Fixes to C++ Support
 - Fixed a bug where our ``member-like constrained friend`` checking caused an 
incorrect analysis of lambda captures. (#GH156225)
 - Fixed a crash when implicit conversions from initialize list to arrays of
   unknown bound during constant evaluation. (#GH151716)
+- Stop rejecting C++11-style attributes on the first argument of constructors 
in older
+  standards. (#GH156809).
 
 Bug Fixes to AST Handling
 ^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 62ea148701dee..bb0a9441303ab 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -6007,10 +6007,9 @@ bool Parser::isConstructorDeclarator(bool IsUnqualified, 
bool DeductionGuide,
 
   // A C++11 attribute here signals that we have a constructor, and is an
   // attribute on the first constructor parameter.
-  if (getLangOpts().CPlusPlus &&
-      isCXX11AttributeSpecifier(/*Disambiguate*/ false,
+  if (isCXX11AttributeSpecifier(/*Disambiguate*/ false,
                                 /*OuterMightBeMessageSend*/ true) !=
-          CXX11AttributeKind::NotAttributeSpecifier) {
+      CXX11AttributeKind::NotAttributeSpecifier) {
     return true;
   }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to