[clang] [clang-format] Add the C language instead of treating it like C++ (PR #128287)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 23:25:53 PST 2025


================
@@ -3957,7 +3958,12 @@ LangOptions getFormattingLangOpts(const FormatStyle &Style) {
   LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11;
 
   LangOpts.LineComment = 1;
-  LangOpts.CXXOperatorNames = Style.isCpp();
+
+  const auto Language = Style.Language;
+  LangOpts.C17 = Language == FormatStyle::LK_C;
----------------
arichardson wrote:

Shouldn't `LangOpts.CPlusPlus` be false for C inputs? But I imagine that could require some additional changes

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


More information about the cfe-commits mailing list