diff options
author | mydeveloperday <mydeveloperday@gmail.com> | 2020-05-20 07:42:07 +0100 |
---|---|---|
committer | mydeveloperday <mydeveloperday@gmail.com> | 2020-05-20 07:42:58 +0100 |
commit | b99bf0e08be4faa4527709541dfdc29240e0c75c (patch) | |
tree | 2823a1b3c28648beb4d88cbe784179f15f44daac /llvm/lib/IR/BasicBlock.cpp | |
parent | 6ca54e01146d91ca3ae3d72bf1cd988fca704630 (diff) | |
download | llvm-b99bf0e08be4faa4527709541dfdc29240e0c75c.zip llvm-b99bf0e08be4faa4527709541dfdc29240e0c75c.tar.gz llvm-b99bf0e08be4faa4527709541dfdc29240e0c75c.tar.bz2 |
[clang-format][PR45816] Add AlignConsecutiveBitFields
Summary:
The following revision follows D80115 since @MyDeveloperDay and I apparently both had the same idea at the same time, for https://bugs.llvm.org/show_bug.cgi?id=45816 and my efforts on tooling support for AMDVLK, respectively.
This option aligns adjacent bitfield separators across lines, in a manner similar to AlignConsecutiveAssignments and friends.
Example:
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```
would become
```
struct RawFloat {
uint32_t sign : 1;
uint32_t exponent : 8;
uint32_t mantissa : 23;
};
```
This also handles c++2a style bitfield-initializers with AlignConsecutiveAssignments.
```
struct RawFloat {
uint32_t sign : 1 = 0;
uint32_t exponent : 8 = 127;
uint32_t mantissa : 23 = 0;
}; // defaults to 1.0f
```
Things this change does not do:
- Align multiple comma-chained bitfield variables. None of the other
AlignConsecutive* options seem to implement that either.
- Detect bitfields that have a width specified with something other
than a numeric literal (ie, `int a : SOME_MACRO;`). That'd be fairly
difficult to parse and is rare.
Patch By: JakeMerdichAMD
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits, MyDeveloperDay
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D80176
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions