Previously crashing input:
void f(
#if A
);
#else
#endif
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226451
91177308-0d34-0410-b5e6-
96231b3b80d8
assert(Next->is(tok::l_paren));
if (Next->Next == Next->MatchingParen)
return true;
- for (const FormatToken *Tok = Next->Next; Tok != Next->MatchingParen;
+ for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen;
Tok = Tok->Next) {
if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() ||
Tok->isOneOf(TT_PointerOrReference, TT_StartOfName))
"#if a\n"
"#else\n"
"#endif");
+
+ verifyFormat("void f(\n"
+ "#if A\n"
+ " );\n"
+ "#else\n"
+ "#endif");
}
TEST_F(FormatTest, GraciouslyHandleIncorrectPreprocessorConditions) {