[all-commits] [llvm/llvm-project] 6bf66d: [clang-format] Indent Verilog struct literal on ne...
sstwcw via All-commits
all-commits at lists.llvm.org
Thu Jun 29 08:39:21 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6bf66d839f1386c06e19a3621c02c8fc6a14f94f
https://github.com/llvm/llvm-project/commit/6bf66d839f1386c06e19a3621c02c8fc6a14f94f
Author: sstwcw <su3e8a96kzlver at posteo.net>
Date: 2023-06-29 (Thu, 29 Jun 2023)
Changed paths:
M clang/lib/Format/ContinuationIndenter.cpp
M clang/unittests/Format/FormatTestVerilog.cpp
Log Message:
-----------
[clang-format] Indent Verilog struct literal on new line
Before:
```
c = //
'{default: 0};
```
After:
```
c = //
'{default: 0};
```
If the line has to be broken, the continuation part should be
indented. Before this fix, it was not the case if the continuation
part was a struct literal. The rule that caused the problem was added
in 783bac6b. It was intended for aligning the field labels in
ProtoBuf. The type `TT_DictLiteral` was only for colons back then, so
the program didn't have to check whether the token was a colon when it
was already type `TT_DictLiteral`. Now the type applies to more
things including the braces enclosing a dictionary literal. In
Verilog, struct literals start with a quote. The quote is regarded as
an identifier by the program. So the rule for aligning the fields in
ProtoBuf applied to this situation by mistake.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D152623
More information about the All-commits
mailing list