HazardyKnusperkeks wrote:

> > I would do this instead:
> > ```diff
> > --- a/clang/lib/Format/TokenAnnotator.cpp
> > +++ b/clang/lib/Format/TokenAnnotator.cpp
> > @@ -2336,7 +2336,7 @@ private:
> >        for (FormatToken *Previous = Current.Previous;
> >             Previous && Previous->isOneOf(tok::star, tok::amp);
> >             Previous = Previous->Previous) {
> > -        Previous->setType(TT_PointerOrReference);
> > +        Previous->setFinalizedType(TT_PointerOrReference);
> >        }
> >        if (Line.MustBeDeclaration &&
> >            Contexts.front().ContextType != Context::CtorInitializer) {
> > ```
> > 
> >   
> > IMO, this is more conservative and serves a catch-all for uncovered edge 
> > cases.
> 
> Also, it would obsolete #212856, which caused the regression in #222132.

I don't like the idea of code which is not used/necessary for any of our tests 
to pass. And while there are still some cases not covered, I think we have a 
good base for annotating those tokens.

This code was useful at some point, but I think it became obsolete and no one 
registered it. In this case we have invalid/incomplete code, but there's no 
real chance that these already annotated tokens would be pointers, so 
overwriting that seems like a bad idea to me.

https://github.com/llvm/llvm-project/pull/220080
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to