[PATCH] D137181: [clang-format] Don't use 'PPIndentWidth' inside multi-line macros
Noah Goldstein via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 16 22:33:55 PST 2022
goldstein.w.n added a comment.
In D137181#3926848 <https://reviews.llvm.org/D137181#3926848>, @owenpan wrote:
> In D137181#3924002 <https://reviews.llvm.org/D137181#3924002>, @sstwcw wrote:
>
>> Can you make `TokenAnnotator::printDebugInfo` print `PPLevel`?
>
> @goldstein.w.n can you add it as follows?
>
> $ git diff TokenAnnotator.cpp
> diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
> index 75570552146c..536472e9d136 100644
> --- a/clang/lib/Format/TokenAnnotator.cpp
> +++ b/clang/lib/Format/TokenAnnotator.cpp
> @@ -5093,8 +5093,9 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
> }
>
> void TokenAnnotator::printDebugInfo(const AnnotatedLine &Line) const {
> - llvm::errs() << "AnnotatedTokens(L=" << Line.Level << ", T=" << Line.Type
> - << ", C=" << Line.IsContinuation << "):\n";
> + llvm::errs() << "AnnotatedTokens(L=" << Line.Level << ", P=" << Line.PPLevel
> + << ", T=" << Line.Type << ", C=" << Line.IsContinuation
> + << "):\n";
> const FormatToken *Tok = Line.First;
> while (Tok) {
> llvm::errs() << " M=" << Tok->MustBreakBefore
Done.
>> Since you changed the rules for indentation in `UnwrappedLineFormatter`, do you also need to change `UnwrappedLineParser::mightFitOnOneLine`?
>
> `mightFitOnOneLine` is not called on PPDirective lines, but it's a good idea to add an assertion.
Added assert.
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