Thanks for all these bug fixes! -- Sean Silva
On Wed, Aug 28, 2013 at 5:17 AM, Daniel Jasper <[email protected]> wrote: > Author: djasper > Date: Wed Aug 28 04:17:37 2013 > New Revision: 189460 > > URL: http://llvm.org/viewvc/llvm-project?rev=189460&view=rev > Log: > clang-format: Fix segfault in 'incomplete' macros. > > The code leading to a segfault was: > #pragma omp threadprivate(y)), // long comment leading to a line break > > This fixes llvm.org/PR16513. > > Modified: > cfe/trunk/lib/Format/ContinuationIndenter.cpp > cfe/trunk/unittests/Format/FormatTest.cpp > > Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=189460&r1=189459&r2=189460&view=diff > > ============================================================================== > --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original) > +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Wed Aug 28 04:17:37 2013 > @@ -536,9 +536,10 @@ unsigned ContinuationIndenter::moveState > > // If we encounter a closing ), ], } or >, we can remove a level from > our > // stacks. > - if (Current.isOneOf(tok::r_paren, tok::r_square) || > - (Current.is(tok::r_brace) && State.NextToken != Line.First) || > - State.NextToken->Type == TT_TemplateCloser) { > + if (State.Stack.size() > 1 && > + (Current.isOneOf(tok::r_paren, tok::r_square) || > + (Current.is(tok::r_brace) && State.NextToken != Line.First) || > + State.NextToken->Type == TT_TemplateCloser)) { > State.Stack.pop_back(); > --State.ParenLevel; > } > > Modified: cfe/trunk/unittests/Format/FormatTest.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=189460&r1=189459&r2=189460&view=diff > > ============================================================================== > --- cfe/trunk/unittests/Format/FormatTest.cpp (original) > +++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Aug 28 04:17:37 2013 > @@ -1942,6 +1942,9 @@ TEST_F(FormatTest, MacroDefinitionsWithI > verifyFormat("#define A template <typename T>"); > verifyFormat("#define STR(x) #x\n" > "f(STR(this_is_a_string_literal{));"); > + verifyFormat("#pragma omp threadprivate( \\\n" > + " y)), // expected-warning", > + getLLVMStyleWithColumns(28)); > } > > TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) { > > > _______________________________________________ > 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
