tahonermann added inline comments.

================
Comment at: clang/lib/Format/TokenAnnotator.cpp:2009-2010
                (Line.MightBeFunctionDecl || Line.InPPDirective) &&
-               Current.NestingLevel == 0 &&
+               Current.NestingLevel == 0 && Current.Previous &&
                !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) {
       // not auto operator->() -> xxx;
----------------
owenpan wrote:
> `Current.Previous` can't be null here because `AutoFound` is `true`.
Could you please elaborate on why you believe it is safe to move the check of 
`Current.Previous` inside the body of the `if` statement? Doing so will short 
circuit the remaining `else if` cases such that `Current.setType()` will not be 
called at all. It isn't obvious to me that those cases should not be considered 
if the previous token was not one of `kw_operator` or `identifier`. This looks 
like it has potential to change behavior.

The change that was originally proposed is clearly safe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158293

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

Reply via email to