[clang] [clang-format] Option to ignore PP directives (PR #70338)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 18 04:52:45 PST 2023


================
@@ -1355,8 +1355,11 @@ unsigned UnwrappedLineFormatter::format(
     bool FixIndentation = (FixBadIndentation || ContinueFormatting) &&
                           Indent != TheLine.First->OriginalColumn;
     bool ShouldFormat = TheLine.Affected || FixIndentation;
-    if (Style.IgnorePPDefinitions && TheLine.Type == LT_PreprocessorDirective)
+    if (Style.IgnorePPDefinitions && TheLine.Type == LT_PreprocessorDirective &&
+        TheLine.getFirstNonComment()->Next->is(tok::pp_define)) {
----------------
tomekpaszek wrote:

Good point, better safe than sorry. I've refactored the condition in the next changeset.

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


More information about the cfe-commits mailing list