[llvm-bugs] [Bug 46623] New: Format options for attributes, ability to specify custom attributes.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 7 10:16:32 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: alliepiper16 at gmail.com
CC: djasper at google.com, klimek at google.com,
llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200707/16104058/attachment.html>
More information about the llvm-bugs
mailing list