[clang] [clang-format] Improve attribute (macro) handling for enums (PR #227461)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 10 23:50:41 PDT 2026


=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/227461 at github.com>


================
@@ -3931,9 +3922,15 @@ bool UnwrappedLineParser::parseEnum() {
     // Eat up enum class ...
     if (FormatTok->isOneOf(tok::kw_class, tok::kw_struct))
       nextToken();
-    while (FormatTok->is(tok::l_square))
-      if (!handleCppAttributes())
-        return false;
+    while (FormatTok->isOneOf(tok::l_square, TT_AttributeMacro)) {
----------------
owenca wrote:

This would only handle `AttributeA [[nodiscard]] AttributeB`, but not `AttributeA __attribute__((foo)) AttributeB`, etc. (Nor did the loop below.)

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


More information about the cfe-commits mailing list