llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kim Gräsman (kimgr)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/175397.diff


1 Files Affected:

- (modified) clang/lib/AST/DeclPrinter.cpp (-2) 


``````````diff
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 << ' ';
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/175397
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to