https://bugs.llvm.org/show_bug.cgi?id=46623
Bug ID: 46623
Summary: Format options for attributes, ability to specify
custom attributes.
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: alliepipe...@gmail.com
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
Clang-format currently does not have options to control attribute formatting.
Some projects prefer to put prefix attributes on a separate line, eg:
[[nodiscard]]
int foo();
instead of:
[[nodiscard]] int foo();
Additionally, it would be useful to be able to provide a list of regexes that
identify custom attributes. Maintaining an exhaustive list of attributes in
clang-format proper would be daunting, as many projects hide them behind macros
for backward compatibility, or rely on platform-specific attributes. Allowing
projects to extend the list of recognized attributes would be quite useful.
My personal interest in this stems from using clang-format on CUDA projects,
where `__host__ __device__` annotations are frequently used and commonly placed
on the line above a function definition. Being able to achieve this common
formatting style would ease adoption of clang-format by CUDA projects.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs