[clang] Fix the double space and double attribute printing of the final keyword. (PR #88600)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 07:07:06 PDT 2024


================
@@ -252,16 +252,19 @@ static DeclPrinter::AttrPosAsWritten getPosAsWritten(const Attr *A,
   return DeclPrinter::AttrPosAsWritten::Right;
 }
 
-void DeclPrinter::prettyPrintAttributes(const Decl *D,
+// returns true if an attribute was printed.
+bool DeclPrinter::prettyPrintAttributes(const Decl *D,
                                         AttrPosAsWritten Pos /*=Default*/) {
-  if (Policy.PolishForDeclaration)
-    return;
+  bool hasPrinted = false;
 
   if (D->hasAttrs()) {
     const AttrVec &Attrs = D->getAttrs();
     for (auto *A : Attrs) {
       if (A->isInherited() || A->isImplicit())
         continue;
+      // Don't strip out the keyword attributes, they aren't regular attributes.
----------------
vgvassilev wrote:

We should word it as `Print out the keyword attributes, they aren't regular attributes.`, I think.

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


More information about the cfe-commits mailing list