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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 07:02:48 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.
----------------
erichkeane wrote:

```suggestion
      // Don't print out the keyword attributes, they aren't regular attributes.
```
??

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


More information about the cfe-commits mailing list