Author: owenca Date: 2026-03-07T12:47:12-08:00 New Revision: ff11354911024ff443145e2a502e83f42066418a
URL: https://github.com/llvm/llvm-project/commit/ff11354911024ff443145e2a502e83f42066418a DIFF: https://github.com/llvm/llvm-project/commit/ff11354911024ff443145e2a502e83f42066418a.diff LOG: [clang-format][NFC] Use the newly added AllowLiteralDigitSeparator (#185165) Use LangOptions::AllowLiteralDigitSeparator added in #184235 for the IntegerLiteralSeparator option. Added: Modified: clang/lib/Format/IntegerLiteralSeparatorFixer.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp index 5f40100c2b968..eea9fcc56af63 100644 --- a/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp +++ b/clang/lib/Format/IntegerLiteralSeparatorFixer.cpp @@ -44,6 +44,8 @@ static Base getBase(StringRef IntegerLiteral) { std::pair<tooling::Replacements, unsigned> IntegerLiteralSeparatorFixer::process(const Environment &Env, const FormatStyle &Style) { + const auto LangOpts = getFormattingLangOpts(Style); + switch (Style.Language) { case FormatStyle::LK_CSharp: case FormatStyle::LK_Java: @@ -53,11 +55,10 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env, case FormatStyle::LK_C: case FormatStyle::LK_Cpp: case FormatStyle::LK_ObjC: - if (Style.Standard >= FormatStyle::LS_Cpp14) { - Separator = '\''; - break; - } - [[fallthrough]]; + if (!LangOpts.AllowLiteralDigitSeparator) + return {}; + Separator = '\''; + break; default: return {}; } @@ -94,7 +95,6 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env, AffectedRangeManager AffectedRangeMgr(SourceMgr, Env.getCharRanges()); const auto ID = Env.getFileID(); - const auto LangOpts = getFormattingLangOpts(Style); Lexer Lex(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts); Lex.SetCommentRetentionState(true); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
