[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 01:35:37 PST 2022
owenpan added a comment.
In D137181#3910800 <https://reviews.llvm.org/D137181#3910800>, @goldstein.w.n wrote:
> In D137181#3910799 <https://reviews.llvm.org/D137181#3910799>, @owenpan wrote:
>
>> IMO we should find a simpler way to indent bodies of macro definitions that are nested more than one level deep. I prefer we handle that in another patch and only support the examples in the summary for now.
>
> I'm not sure what changes to the patch that would imply?
I meant only making changes to UnwrappedLineFormatter.cpp.
> Also want to note, for the unit tests to all pass only 4-places actually need the
> `PPLevel` tracking.
> L373
> L1286
> L1290
> L1312
I think you were referring to UnwrappedLineParser.cpp here. Anyway, I think most of the added tests are incorrect: the first line in a macro body should be indented 3 columns relative to `define` as explained in D137181#3910566 <https://reviews.llvm.org/D137181#3910566>.
One idea I've experimented with is to pass `PPBranchLevel` from `UnwrappedLine` to `AnnotatedLine` and use that in the unwrapped line formatter. It seems very promising.
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