https://github.com/kimgr created
https://github.com/llvm/llvm-project/pull/175397
It suggested it would be better to print attributes before the decl kind, to be
consistent with value declarations.
But attributes are not accepted by the language before the decl kind:
[[deprecated]] class A;
__attribute__((deprecated)) class A;
__declspec(deprecated) class A;
are all invalid or ignored. The only way to put an attribute before the decl
kind is with something like:
[[deprecated]] struct A {} a;
But that declares a variable, not a record tyoe, and will be correctly handled
by the variable decl printer.
From bbca6220f8be654b8016fe59c3ed6b2042357780 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kim=20Gr=C3=A4sman?= <[email protected]>
Date: Sat, 10 Jan 2026 16:00:31 +0100
Subject: [PATCH] Remove CXXRecordDecl printer FIXME
It suggested it would be better to print attributes before the decl
kind, to be consistent with value declarations.
But attributes are not accepted by the language before the decl kind:
[[deprecated]] class A;
__attribute__((deprecated)) class A;
__declspec(deprecated) class A;
are all invalid or ignored. The only way to put an attribute before the
decl kind is with something like:
[[deprecated]] struct A {} a;
But that declares a variable, not a record tyoe, and will be correctly
handled by the variable decl printer.
---
clang/lib/AST/DeclPrinter.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 47ae613b643b6..f32ccd1fafcfe 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -1083,8 +1083,6 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
Out << D->getKindName() << ' ';
- // FIXME: Move before printing the decl kind to match the behavior of the
- // attribute printing for variables and function where they are printed
first.
if (prettyPrintAttributes(D, AttrPosAsWritten::Left))
Out << ' ';
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits