Author: Owen Pan Date: 2024-08-18T12:02:15-07:00 New Revision: 3496245ed3d0b4d24444260da77dcdb93512fb5a
URL: https://github.com/llvm/llvm-project/commit/3496245ed3d0b4d24444260da77dcdb93512fb5a DIFF: https://github.com/llvm/llvm-project/commit/3496245ed3d0b4d24444260da77dcdb93512fb5a.diff LOG: [clang-format] Change GNU style language standard to LS_Latest (#104669) Fixes #104655. Added: Modified: clang/lib/Format/Format.cpp clang/unittests/Format/TokenAnnotatorTest.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index a795d869a3cb66..97fac41cdd3008 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1905,7 +1905,6 @@ FormatStyle getGNUStyle() { Style.Cpp11BracedListStyle = false; Style.FixNamespaceComments = false; Style.SpaceBeforeParens = FormatStyle::SBPO_Always; - Style.Standard = FormatStyle::LS_Cpp03; return Style; } diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index 256bbd49c424fa..99798de43e70ff 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -3360,6 +3360,15 @@ TEST_F(TokenAnnotatorTest, TypenameMacro) { EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_Unknown); } +TEST_F(TokenAnnotatorTest, GNULanguageStandard) { + auto Style = getGNUStyle(); + EXPECT_EQ(Style.Standard, FormatStyle::LS_Latest); + + auto Tokens = annotate("return 1 <=> 2;", Style); + ASSERT_EQ(Tokens.size(), 6u); + EXPECT_TOKEN(Tokens[2], tok::spaceship, TT_BinaryOperator); +} + } // namespace } // namespace format } // namespace clang _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits