https://github.com/owenca created https://github.com/llvm/llvm-project/pull/104669
Fixes #104655. >From d7c7c0da69864067999ecd9b1621fdbb85d4d365 Mon Sep 17 00:00:00 2001 From: Owen Pan <owenpi...@gmail.com> Date: Sat, 17 Aug 2024 02:32:19 -0700 Subject: [PATCH] [clang-format] Change GNU style language standard to LS_Latest Fixes #104655. --- clang/lib/Format/Format.cpp | 1 - clang/unittests/Format/TokenAnnotatorTest.cpp | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 5358b35c19de25..e8fe17ecee1837 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1904,7 +1904,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..c40df0794ab9ae 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -3360,6 +3360,14 @@ 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); + 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