diff options
author | jackh <jackhuang1205@gmail.com> | 2022-08-13 11:12:10 +0800 |
---|---|---|
committer | Tobias Hieta <tobias@hieta.se> | 2022-09-08 08:49:27 +0200 |
commit | 0595790461e188d61ee35c81db7789c52c88190c (patch) | |
tree | 0086cad2e35f9bec5a73d008c15c052915fbb6b3 /clang/unittests | |
parent | 4c6350f4e393c1782fd479798485b55063aa90fc (diff) | |
download | llvm-0595790461e188d61ee35c81db7789c52c88190c.zip llvm-0595790461e188d61ee35c81db7789c52c88190c.tar.gz llvm-0595790461e188d61ee35c81db7789c52c88190c.tar.bz2 |
[clang-format] Distinguish logical and after bracket from reference
Fix commit `b646f0955574` and remove redundant code.
Differential Revision: https://reviews.llvm.org/D131750
(cherry picked from commit ef71383b0cfbacdbebf495015f6ead5294bf7759)
Diffstat (limited to 'clang/unittests')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/Format/TokenAnnotatorTest.cpp | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index e26cfb0..fdc7c4a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10474,6 +10474,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("class {\n" "}&& ptr = {};", Style); + verifyFormat("bool b = 3 == int{3} && true;"); Style.PointerAlignment = FormatStyle::PAS_Middle; verifyFormat("struct {\n" diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index 4b26225..ad8ba76 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -86,6 +86,10 @@ TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) { EXPECT_EQ(Tokens.size(), 5u) << Tokens; EXPECT_TOKEN(Tokens[1], tok::amp, TT_UnaryOperator); + Tokens = annotate("bool b = 3 == int{3} && true;\n"); + EXPECT_EQ(Tokens.size(), 13u) << Tokens; + EXPECT_TOKEN(Tokens[9], tok::ampamp, TT_BinaryOperator); + Tokens = annotate("struct {\n" "} *ptr;"); EXPECT_EQ(Tokens.size(), 7u) << Tokens; |