Skip to content

clang-format 14 wrongly indents while [[unlikely]] #55853

@vogelsgesang

Description

@vogelsgesang

clang-format 14 wrongly indents bodies of while loops which are annotated with [[unlikely]]

Here is a diff of how clang-format would reformat one of my functions:

 static inline void trimTrailingZeros(const char* begin, const char*& limit) {
    while ((begin != limit) && (limit[-1] == '0')) [[unlikely]] {
-      --limit;
-   }
+         --limit;
+      }
 }

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorclang-format

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions