[clang] [clang-tools-extra] [clang] Retain unrecognized C++ [[attributes]] in the AST (PR #209224)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 02:18:53 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/test/AST/ast-dump-unknown-attr-negative.cpp clang/test/AST/ast-dump-unknown-attr-stmt.cpp clang/test/AST/ast-dump-unknown-attr-template.cpp clang/test/AST/ast-dump-unknown-attr-type.cpp clang/test/AST/ast-dump-unknown-attr.cpp clang/test/AST/ast-print-unknown-attr.cpp clang/test/Frontend/plugin-attribute-instantiation.cpp clang/test/Frontend/plugin-unknown-attr.cpp clang/test/PCH/unknown-attr.cpp clang/test/SemaCXX/unknown-attr-retain.cpp clang-tools-extra/clangd/unittests/SelectionTests.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp clang/examples/Attribute/Attribute.cpp clang/examples/PrintFunctionNames/PrintFunctionNames.cpp clang/include/clang/AST/Attr.h clang/include/clang/Parse/Parser.h clang/include/clang/Sema/ParsedAttr.h clang/include/clang/Sema/Sema.h clang/lib/AST/AttrImpl.cpp clang/lib/AST/DeclPrinter.cpp clang/lib/AST/StmtPrinter.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaStmtAttr.cpp clang/lib/Sema/SemaType.cpp clang/unittests/AST/ASTImporterTest.cpp clang/unittests/AST/AttrTest.cpp clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/examples/Attribute/Attribute.cpp b/clang/examples/Attribute/Attribute.cpp
index da81dcdeb..953462081 100644
--- a/clang/examples/Attribute/Attribute.cpp
+++ b/clang/examples/Attribute/Attribute.cpp
@@ -13,7 +13,8 @@
 // arguments as expressions in context, and this plugin lowers them onto an
 // Expr-carrying attribute (AnnotateAttr). A dependent argument therefore
 // participates in template instantiation through the normal machinery, with no
-// special support -- see clang/test/Frontend/plugin-attribute-instantiation.cpp.
+// special support -- see
+// clang/test/Frontend/plugin-attribute-instantiation.cpp.
 //
 // This plugin is used by clang/test/Frontend/plugin-attribute tests.
 //
diff --git a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
index 955beb570..c6354acda 100644
--- a/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
+++ b/clang/examples/PrintFunctionNames/PrintFunctionNames.cpp
@@ -51,8 +51,9 @@ public:
       // scope::name, and getArgsText() the verbatim argument clause (or empty).
       for (const Attr *A : ND->attrs())
         if (const auto *UA = dyn_cast<UnknownAttr>(A))
-          llvm::errs() << "  unknown-attribute: \"" << UA->getNormalizedFullName()
-                       << UA->getArgsText() << "\"\n";
+          llvm::errs() << "  unknown-attribute: \""
+                       << UA->getNormalizedFullName() << UA->getArgsText()
+                       << "\"\n";
     }
 
     return true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/209224


More information about the cfe-commits mailing list