Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,7 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
switch (Style.Language) {
case FormatStyle::LK_C:
LangOpts.C11 = 1;
LangOpts.C23 = 1;
break;
case FormatStyle::LK_Cpp:
case FormatStyle::LK_ObjC:
Expand Down
7 changes: 7 additions & 0 deletions clang/unittests/Format/TokenAnnotatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4097,6 +4097,13 @@ TEST_F(TokenAnnotatorTest, UTF8StringLiteral) {
EXPECT_TOKEN(Tokens[1], tok::utf8_string_literal, TT_Unknown);
}

TEST_F(TokenAnnotatorTest, C23DigitSeparator) {
auto Tokens = annotate("return 1'000;", getLLVMStyle(FormatStyle::LK_C));
ASSERT_EQ(Tokens.size(), 4u) << Tokens;
EXPECT_EQ(Tokens[1]->TokenText, "1'000");
EXPECT_TOKEN(Tokens[2], tok::semi, TT_Unknown);
}

TEST_F(TokenAnnotatorTest, IdentifierPackage) {
auto Tokens = annotate("auto package;");
ASSERT_EQ(Tokens.size(), 4u) << Tokens;
Expand Down
Loading