[clang] Add SuppressKeywordAttrs printing policy (PR #175398)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 10 15:39:52 PST 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 cpp,h -- clang/include/clang/AST/PrettyPrinter.h clang/lib/AST/DeclPrinter.cpp clang/unittests/AST/DeclPrinterTest.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/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index 82d1b89ad..b983a14fd 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -1575,8 +1575,8 @@ TEST(DeclPrinter, TestTemplateFinalWithPolishForDecl) {
 
 TEST(DeclPrinter, TestClassSuppressKeywordAttrs) {
   ASSERT_TRUE(PrintedDeclCXX11Matches(
-      "class alignas(32) A final {};",
-      cxxRecordDecl(hasName("A")).bind("id"), "class A {}",
+      "class alignas(32) A final {};", cxxRecordDecl(hasName("A")).bind("id"),
+      "class A {}",
       [](PrintingPolicy &Policy) { Policy.SuppressKeywordAttrs = true; }));
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list