[clang] Add C language support for clang-format IntegerLiteralSeparator (PR #182296)

John Mitchell via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 20 06:18:36 PST 2026


================
@@ -50,6 +50,9 @@ IntegerLiteralSeparatorFixer::process(const Environment &Env,
   case FormatStyle::LK_JavaScript:
     Separator = '_';
     break;
+  case FormatStyle::LK_C:
+      Separator = '\'';
+      break;
----------------
fauxprogrammer wrote:

I originally thought that also but the C++ case checks for C++ standard >= Cpp14.  It seemed cleaner to not have any dependency on the C++ standard for the C block.  But I defer to your judgement if you feel adding the C case statement to the existing C++ is the way to go I'll make the change.

  case FormatStyle::LK_Cpp:
  case FormatStyle::LK_ObjC:
    if (Style.Standard >= FormatStyle::LS_Cpp14) {
      Separator = '\'';
      break;
    }

https://github.com/llvm/llvm-project/pull/182296


More information about the cfe-commits mailing list