[cfe-commits] r171522 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp

Daniel Jasper djasper at google.com
Fri Jan 4 13:41:27 PST 2013


Probably, but I fear we'll need to do a lot more to understand those
initializers .. :-/


On Fri, Jan 4, 2013 at 10:25 PM, Nico Weber <thakis at chromium.org> wrote:

> On Fri, Jan 4, 2013 at 12:46 PM, Daniel Jasper <djasper at google.com> wrote:
> > Author: djasper
> > Date: Fri Jan  4 14:46:38 2013
> > New Revision: 171522
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=171522&view=rev
> > Log:
> > Correctly format dereference and address of in array parameters.
> >
> > Before: InvalidRegions[ &R] = 0;
> > After:  InvalidRegions[&R] = 0;
> >
> > This fixes llvm.org/PR14793
> >
> > Modified:
> >     cfe/trunk/lib/Format/Format.cpp
> >     cfe/trunk/unittests/Format/FormatTest.cpp
> >
> > Modified: cfe/trunk/lib/Format/Format.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=171522&r1=171521&r2=171522&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Format/Format.cpp (original)
> > +++ cfe/trunk/lib/Format/Format.cpp Fri Jan  4 14:46:38 2013
> > @@ -878,8 +878,9 @@
> >      const FormatToken &PrevToken = Line.Tokens[Index - 1];
> >      const FormatToken &NextToken = Line.Tokens[Index + 1];
> >
> > -    if (PrevToken.Tok.is(tok::l_paren) || PrevToken.Tok.is(tok::comma)
> ||
> > -        PrevToken.Tok.is(tok::kw_return) || PrevToken.Tok.is(tok::colon)
> ||
> > +    if (PrevToken.Tok.is(tok::l_paren) || PrevToken.Tok.is(tok::l_square)
> ||
> > +        PrevToken.Tok.is(tok::comma) || PrevToken.Tok.is(tok::kw_return)
> ||
> > +        PrevToken.Tok.is(tok::colon) ||
>
> Do you want l_brace too, for
>
> int main() {
>   int a;
>   int *pa{&a};
> }
>
> ? (with -std=c++11)
>
> >          Annotations[Index - 1].Type ==
> TokenAnnotation::TT_BinaryOperator)
> >        return TokenAnnotation::TT_UnaryOperator;
> >
> >
> > Modified: cfe/trunk/unittests/Format/FormatTest.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171522&r1=171521&r2=171522&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/unittests/Format/FormatTest.cpp (original)
> > +++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Jan  4 14:46:38 2013
> > @@ -768,6 +768,8 @@
> >    verifyFormat("a * ++b;");
> >    verifyFormat("a * --b;");
> >
> > +  verifyFormat("InvalidRegions[*R] = 0;");
> > +
> >    // FIXME: Is this desired for LLVM? Fix if not.
> >    verifyFormat("A<int *> a;");
> >    verifyFormat("A<int **> a;");
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130104/31e4bf49/attachment.html>


More information about the cfe-commits mailing list