[clang] [clang-format] Add an option to format integer and float literal case (PR #151590)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 31 14:46:50 PDT 2025


================
@@ -3100,6 +3100,54 @@ struct FormatStyle {
   /// \version 11
   TrailingCommaStyle InsertTrailingCommas;
 
+  /// Character case format for different components of a numeric literal.
+  ///
+  /// For all options, ``0`` leave the case unchanged, ``-1``
+  /// uses lower case and, ``1`` uses upper case.
+  ///
+  struct NumericLiteralCaseStyle {
+    /// Format numeric constant prefixes.
+    /// \code{.text}
+    ///   /* -1: lower case */ b = 0x01;
+    ///   /*  0: don't care */
+    ///   /*  1: upper case */ b = 0X01;
+    /// \endcode
+    int8_t PrefixCase;
----------------
HazardyKnusperkeks wrote:

Please go for an `enum {Always, Never, Leave}`, that is consistent with other options.

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


More information about the cfe-commits mailing list