-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[clang-format] Properly indent lines inside Verilog case structure #65861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` New: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in `getNewLineColumn` to add a level of indentation to the part following the case label. However, in case the line had to be broken again, the code at the end of the function would see that the line was already broken with the continuation part indented, so it would not indent it more. Now `State.FirstIndent` is changed as well for the part following the case label, so the logic for determining when to add a continuation indentation works.
@llvm/pr-subscribers-clang ChangesWhen a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: case (data)
16'd0:
result = // break here
10'b0111111111;
endcase New: case (data)
16'd0:
result = // break here
10'b0111111111;
endcase Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in
|
@llvm/pr-subscribers-clang-format ChangesWhen a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: case (data)
16'd0:
result = // break here
10'b0111111111;
endcase New: case (data)
16'd0:
result = // break here
10'b0111111111;
endcase Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in
|
// Verilog case labels are are on the same unwrapped lines as the statements | ||
// that follow. TokenAnnotator identifies them and sets MustBreakBefore. | ||
// Indentation is taken care of here. A case label can only have 1 statement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: are are
. Also, use single space after .
.
…lvm#65861) When a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` New: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in `getNewLineColumn` to add a level of indentation to the part following the case label. However, in case the line had to be broken again, the code at the end of the function would see that the line was already broken with the continuation part indented, so it would not indent it more. Now `State.FirstIndent` is changed as well for the part following the case label, so the logic for determining when to add a continuation indentation works.
…lvm#65861) When a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` New: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in `getNewLineColumn` to add a level of indentation to the part following the case label. However, in case the line had to be broken again, the code at the end of the function would see that the line was already broken with the continuation part indented, so it would not indent it more. Now `State.FirstIndent` is changed as well for the part following the case label, so the logic for determining when to add a continuation indentation works.
…lvm#65861) When a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly. Old: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` New: ```Verilog case (data) 16'd0: result = // break here 10'b0111111111; endcase ``` Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in `getNewLineColumn` to add a level of indentation to the part following the case label. However, in case the line had to be broken again, the code at the end of the function would see that the line was already broken with the continuation part indented, so it would not indent it more. Now `State.FirstIndent` is changed as well for the part following the case label, so the logic for determining when to add a continuation indentation works.
When a statement following a case label had to be broken into multiple lines, the continuation parts were not indented correctly.
Old:
New:
Verilog case labels and the following statements are on the same unwrapped line due to the difficulty of identifying them. So there was a rule in
getNewLineColumn
to add a level of indentation to the part following the case label. However, in case the line had to be broken again, the code at the end of the function would see that the line was already broken with the continuation part indented, so it would not indent it more. NowState.FirstIndent
is changed as well for the part following the case label, so the logic for determining when to add a continuation indentation works.