goldstein.w.n added a comment.

In D137181#3923434 <https://reviews.llvm.org/D137181#3923434>, @owenpan wrote:

> In D137181#3918715 <https://reviews.llvm.org/D137181#3918715>, @goldstein.w.n 
> wrote:
>
>> In D137181#3918673 <https://reviews.llvm.org/D137181#3918673>, @owenpan 
>> wrote:
>>
>>> Below is how I defined `PPLevel`:
>>>
>>>   $ git diff UnwrappedLineParser.h
>>>   diff --git a/clang/lib/Format/UnwrappedLineParser.h 
>>> b/clang/lib/Format/UnwrappedLineParser.h
>>>   index b9b106bcc89a..a234f6852e0c 100644
>>>   --- a/clang/lib/Format/UnwrappedLineParser.h
>>>   +++ b/clang/lib/Format/UnwrappedLineParser.h
>>>   @@ -43,6 +43,9 @@ struct UnwrappedLine {
>>>    
>>>      /// The indent level of the \c UnwrappedLine.
>>>      unsigned Level;
>>>   +  /// The \c PPBranchLevel (adjusted for header guards) of the macro 
>>> definition
>>>   +  /// this line belongs to.
>>>   +  unsigned PPLevel;
>>>    
>>>      /// Whether this \c UnwrappedLine is part of a preprocessor directive.
>>>      bool InPPDirective;
>>>   @@ -358,7 +361,7 @@ struct UnwrappedLineNode {
>>>    };
>>>    
>>>    inline UnwrappedLine::UnwrappedLine()
>>>   -    : Level(0), InPPDirective(false), InPragmaDirective(false),
>>>   +    : Level(0), PPLevel(0), InPPDirective(false), 
>>> InPragmaDirective(false),
>>>          InMacroBody(false), MustBeDeclaration(false),
>>>          MatchingOpeningBlockLineIndex(kInvalidIndex) {}
>>>    
>>>
>>> Conceptually, I think it's more accurate to make `PPLevel` to mean the PP 
>>> branching level of the `#define` line, not the first line of the macro 
>>> body. IMO it may simplify the changes you made to the formatter.
>>
>> Hmm? Not sure what you mean.
>
> Does the comments above `unsigned PPLevel;` in the above `git diff` output 
> help? Anyway, you already addressed my comment by decreasing `PPLevel` by 1, 
> so it's ok now.

Got it. Is the patch okay?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137181/new/

https://reviews.llvm.org/D137181

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to