Yay! Thanks. -- Sean Silva
On Tue, May 19, 2015 at 5:29 AM, Daniel Jasper <[email protected]> wrote: > Author: djasper > Date: Tue May 19 07:29:27 2015 > New Revision: 237690 > > URL: http://llvm.org/viewvc/llvm-project?rev=237690&view=rev > Log: > clang-format: Improve *-detection. > > Before: > S << a *(10); > > After: > S << a * (10); > > This fixes llvm.org/PR16500. > > Modified: > cfe/trunk/lib/Format/TokenAnnotator.cpp > cfe/trunk/unittests/Format/FormatTest.cpp > > Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=237690&r1=237689&r2=237690&view=diff > > ============================================================================== > --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original) > +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Tue May 19 07:29:27 2015 > @@ -825,6 +825,9 @@ private: > Previous->Type = TT_PointerOrReference; > } > } > + } else if (Current.is(tok::lessless) && > + (!Current.Previous || > !Current.Previous->is(tok::kw_operator))) { > + Contexts.back().IsExpression = true; > } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { > Contexts.back().IsExpression = true; > } else if (Current.is(TT_TrailingReturnArrow)) { > > Modified: cfe/trunk/unittests/Format/FormatTest.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=237690&r1=237689&r2=237690&view=diff > > ============================================================================== > --- cfe/trunk/unittests/Format/FormatTest.cpp (original) > +++ cfe/trunk/unittests/Format/FormatTest.cpp Tue May 19 07:29:27 2015 > @@ -5468,6 +5468,8 @@ TEST_F(FormatTest, UnderstandsUsesOfStar > verifyIndependentOfContext("int a = *b;"); > verifyIndependentOfContext("int a = *b * c;"); > verifyIndependentOfContext("int a = b * *c;"); > + verifyIndependentOfContext("int a = b * (10);"); > + verifyIndependentOfContext("S << b * (10);"); > verifyIndependentOfContext("return 10 * b;"); > verifyIndependentOfContext("return *b * *c;"); > verifyIndependentOfContext("return a & ~b;"); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
