[clang] [clang-format] Add IndentPPDirectives Leave option (PR #139750)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 12 00:57:17 PDT 2025


================
@@ -3627,7 +3627,8 @@ void TokenAnnotator::setCommentLineLevels(
       // Align comments for preprocessor lines with the # in column 0 if
       // preprocessor lines are not indented. Otherwise, align with the next
       // line.
-      Line->Level = Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
+      Line->Level = (Style.IndentPPDirectives == FormatStyle::PPDIS_AfterHash ||
+                     Style.IndentPPDirectives == FormatStyle::PPDIS_None) &&
----------------
owenca wrote:

```suggestion
      Line->Level = Style.IndentPPDirectives < FormatStyle::PPDIS_BeforeHash &&
```

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


More information about the cfe-commits mailing list