[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros
sstwcw via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 6 17:52:14 PST 2022
sstwcw added a comment.
Here is one problem:
clang-format -style='{IndentPPDirectives: BeforeHash, PPIndentWidth: 1, IndentWidth: 4, IndentCaseLabels: true}'
actual:
#define X \
switch (x) { \
case 0: \
break; \
default: \
break; \
}
expected:
#define X \
switch (x) { \
case 0: \
break; \
default: \
break; \
}
Me guessing what caused the problem. You intend for `PPLevel` to mean the depth of `#if` sections. But you accidentally made it change along with `Level` where you shouldn't, for example in `UnwrappedLineParser.cpp: 600`.
In addition, I suggest including `PPBranchLevel` in `PPLevel` only instead of also in `Level`.
================
Comment at: clang/lib/Format/UnwrappedLineParser.h:47
+ /// The preprocessor indent level of the \c UnwrappedLine.
+ int PPLevel;
----------------
Please elaborate what preprocessor indent level means.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137181/new/
https://reviews.llvm.org/D137181
More information about the cfe-commits
mailing list