<div dir="ltr">Thanks for all these bug fixes!<div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 28, 2013 at 5:17 AM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Wed Aug 28 04:17:37 2013<br>
New Revision: 189460<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=189460&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=189460&view=rev</a><br>
Log:<br>
clang-format: Fix segfault in 'incomplete' macros.<br>
<br>
The code leading to a segfault was:<br>
#pragma omp threadprivate(y)), // long comment leading to a line break<br>
<br>
This fixes <a href="http://llvm.org/PR16513" target="_blank">llvm.org/PR16513</a>.<br>
<br>
Modified:<br>
cfe/trunk/lib/Format/ContinuationIndenter.cpp<br>
cfe/trunk/unittests/Format/FormatTest.cpp<br>
<br>
Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=189460&r1=189459&r2=189460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=189460&r1=189459&r2=189460&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)<br>
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Wed Aug 28 04:17:37 2013<br>
@@ -536,9 +536,10 @@ unsigned ContinuationIndenter::moveState<br>
<br>
// If we encounter a closing ), ], } or >, we can remove a level from our<br>
// stacks.<br>
- if (Current.isOneOf(tok::r_paren, tok::r_square) ||<br>
- (Current.is(tok::r_brace) && State.NextToken != Line.First) ||<br>
- State.NextToken->Type == TT_TemplateCloser) {<br>
+ if (State.Stack.size() > 1 &&<br>
+ (Current.isOneOf(tok::r_paren, tok::r_square) ||<br>
+ (Current.is(tok::r_brace) && State.NextToken != Line.First) ||<br>
+ State.NextToken->Type == TT_TemplateCloser)) {<br>
State.Stack.pop_back();<br>
--State.ParenLevel;<br>
}<br>
<br>
Modified: cfe/trunk/unittests/Format/FormatTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=189460&r1=189459&r2=189460&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=189460&r1=189459&r2=189460&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)<br>
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Aug 28 04:17:37 2013<br>
@@ -1942,6 +1942,9 @@ TEST_F(FormatTest, MacroDefinitionsWithI<br>
verifyFormat("#define A template <typename T>");<br>
verifyFormat("#define STR(x) #x\n"<br>
"f(STR(this_is_a_string_literal{));");<br>
+ verifyFormat("#pragma omp threadprivate( \\\n"<br>
+ " y)), // expected-warning",<br>
+ getLLVMStyleWithColumns(28));<br>
}<br>
<br>
TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>