[clang] [clang-format] Option to ignore macro definitions (PR #70338)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 19 08:39:35 PST 2023


================
@@ -1355,6 +1362,10 @@ unsigned UnwrappedLineFormatter::format(
     bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
                           Indent != TheLine.First->OriginalColumn;
     bool ShouldFormat = TheLine.Affected || FixIndentation;
+
+    if (Style.IgnorePPDefinitions && lineContainsPPDefinition(TheLine))
+      ShouldFormat = false;
----------------
HazardyKnusperkeks wrote:

```suggestion
    bool ShouldFormat = (TheLine.Affected || FixIndentation) && (!Style.IgnorePPDefinitions || lineContainsPPDefinition(TheLine));
```
Maybe? Don't know which is better.

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


More information about the cfe-commits mailing list