The code leading to a segfault was:
#pragma omp threadprivate(y)), // long comment leading to a line break
This fixes llvm.org/PR16513.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189460
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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;
}
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) {