[PATCH] D124036: [clang-format] Don't skip PP lines if original line was a PP line when trying to merge lines
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 08:42:52 PDT 2022
aeubanks added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:310-313
for (; J != AnnotatedLines.begin(); --J)
- if (!(*J)->InPPDirective && (*J)->Level < TheLine->Level)
+ if ((TheLine->InPPDirective || !(*J)->InPPDirective) &&
+ (*J)->Level < TheLine->Level)
break;
----------------
owenpan wrote:
> Or simply return before the `for` loop if `TheLine->InPPDirective` is true?
I'm not 100% sure how `TheLine->Level` works in the presence of macros (e.g. a function that's fully defined in a macro), would we want to also search for `(*J)->Level < TheLine->Level` in that case?
either way, I've taken your suggestion because I'd like to get this crash fix landed
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124036/new/
https://reviews.llvm.org/D124036
More information about the cfe-commits
mailing list