diff options
author | sstwcw <su3e8a96kzlver@posteo.net> | 2023-11-29 15:17:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 15:17:59 +0000 |
commit | 3af82b3962c443d43edba1abb50a82fb3048999a (patch) | |
tree | f6096f8bce9bdae021df85e5651cfa184d9b04cd /clang/lib/Format/FormatTokenLexer.cpp | |
parent | 0468867c982c9438cf1e9adb71709cb9c7d66391 (diff) | |
download | llvm-3af82b3962c443d43edba1abb50a82fb3048999a.zip llvm-3af82b3962c443d43edba1abb50a82fb3048999a.tar.gz llvm-3af82b3962c443d43edba1abb50a82fb3048999a.tar.bz2 |
[clang-format] Add spaces around the Verilog implication operator (#71352)
The Verilog implication operator `->` is a binary operator meaning
either the left hand side is false or the right hand side is true.
Previously it was treated as the C++ struct member operator.
I didn't even know it existed when I added the operator formatting part.
And I didn't check all the tests for all the operators I added. That is
how the bad test got in.
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a90ba4a..db52add 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -253,7 +253,8 @@ void FormatTokenLexer::tryMergePreviousTokens() { TT_BinaryOperator)) { return; } - // Module paths in specify blocks and implications in properties. + // Module paths in specify blocks and the implication and boolean equality + // operators. if (tryMergeTokensAny({{tok::plusequal, tok::greater}, {tok::plus, tok::star, tok::greater}, {tok::minusequal, tok::greater}, @@ -265,7 +266,8 @@ void FormatTokenLexer::tryMergePreviousTokens() { {tok::pipe, tok::arrow}, {tok::hash, tok::minus, tok::hash}, {tok::hash, tok::equal, tok::hash}}, - TT_BinaryOperator)) { + TT_BinaryOperator) || + Tokens.back()->is(tok::arrow)) { Tokens.back()->ForcedPrecedence = prec::Comma; return; } |