[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


================
@@ -275,13 +278,15 @@ void DeclPrinter::prettyPrintAttributes(const Decl *D,
           if (Pos != AttrPosAsWritten::Left)
             Out << ' ';
           A->printPretty(Out, Policy);
+          hasPrinted = true;
           if (Pos == AttrPosAsWritten::Left)
             Out << ' ';
         }
         break;
       }
     }
   }
+  return hasPrinted;
----------------
erichkeane wrote:

see `Out->tell()` here, it is perhaps less error-prone here (that is, store the `uint64_t` value above, and see if it changed). 

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


More information about the cfe-commits mailing list