clang-format: Fix bad memory access.

llvm-svn: 226680
This commit is contained in:
Daniel Jasper 2015-01-21 18:04:02 +00:00
parent f3a7da349c
commit d1debfc2bb
2 changed files with 2 additions and 0 deletions

View File

@ -683,6 +683,7 @@ private:
TT_TrailingReturnArrow))
CurrentToken->Type = TT_Unknown;
CurrentToken->Role.reset();
CurrentToken->MatchingParen = nullptr;
CurrentToken->FakeLParens.clear();
CurrentToken->FakeRParens = 0;
}

View File

@ -2612,6 +2612,7 @@ TEST_F(FormatTest, MacroDefinitionsWithIncompleteCode) {
verifyFormat("#if \"a");
verifyNoCrash("#if a\na(\n#else\n#endif\n{a");
verifyNoCrash("a={0,1\n#if a\n#else\n;\n#endif\n}");
}
TEST_F(FormatTest, MacrosWithoutTrailingSemicolon) {