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

>From 27b3da6c890f5f1cd600f652e45f654779b2de18 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/8] [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 0ae3a463e55f706031a61e7db406793b637bf9f9 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/8] 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 39192587a0910d590c336597bfb80d0cf462851d 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/8] 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 d1ef91b7e7c14..66eb48750b7c7 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 49144551834d25ae303c22898ce4f4e4fafb8515 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/8] 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 66eb48750b7c7..1290ef52f96db 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 d947092c38f62cad1fa2ac87533efd2ea13de60a 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/8] 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 1290ef52f96db..89fbe071b57e5 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
 ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -351,6 +349,8 @@ Bug Fixes to C++ Support
   authentication enabled. (#GH152601)
 - Fix the check for narrowing int-to-float conversions, so that they are 
detected in
   cases where converting the float back to an integer is undefined behaviour 
(#GH157067).
+- 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;
   }
 

>From d8d743f13f436e91c2c78565cd7b3e0f2fd622da Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Mon, 8 Sep 2025 23:33:31 +0100
Subject: [PATCH 6/8] Update clang/lib/Parse/ParseDecl.cpp

Co-authored-by: Shafik Yaghmour <shafik.yaghm...@intel.com>
---
 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 bb0a9441303ab..417f5eee9d942 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 (isCXX11AttributeSpecifier(/*Disambiguate*/ false,
+  if (isCXX11AttributeSpecifier(/*Disambiguate=*/false,
                                 /*OuterMightBeMessageSend*/ true) !=
       CXX11AttributeKind::NotAttributeSpecifier) {
     return true;

>From e3d1153593ee1a7bd8ed1945576ba58aeeee678c Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Mon, 8 Sep 2025 22:35:53 +0000
Subject: [PATCH 7/8] fix other comment

---
 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 417f5eee9d942..e45517c8447c5 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -6008,7 +6008,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 (isCXX11AttributeSpecifier(/*Disambiguate=*/false,
-                                /*OuterMightBeMessageSend*/ true) !=
+                                /*OuterMightBeMessageSend=*/ true) !=
       CXX11AttributeKind::NotAttributeSpecifier) {
     return true;
   }

>From 111e938e41d69800242eb073ac70896580194824 Mon Sep 17 00:00:00 2001
From: camc <69519329+c...@users.noreply.github.com>
Date: Mon, 8 Sep 2025 22:48:05 +0000
Subject: [PATCH 8/8] formatting - remove space...

---
 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 e45517c8447c5..bbeee2e3e373f 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -6008,7 +6008,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 (isCXX11AttributeSpecifier(/*Disambiguate=*/false,
-                                /*OuterMightBeMessageSend=*/ true) !=
+                                /*OuterMightBeMessageSend=*/true) !=
       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