зеркало из https://github.com/microsoft/clang-1.git
Fix infinite-loop in unwrapped line parser.
Discovered when accidentally formatting a python file :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
83a90e5e65
Коммит
6fe554eb4e
|
@ -684,7 +684,7 @@ void UnwrappedLineParser::parseRecord() {
|
|||
// (this would still leave us with an ambiguity between template function
|
||||
// and class declarations).
|
||||
if (FormatTok.Tok.is(tok::colon) || FormatTok.Tok.is(tok::less)) {
|
||||
while (FormatTok.Tok.isNot(tok::l_brace)) {
|
||||
while (!eof() && FormatTok.Tok.isNot(tok::l_brace)) {
|
||||
if (FormatTok.Tok.is(tok::semi))
|
||||
return;
|
||||
nextToken();
|
||||
|
|
|
@ -2544,6 +2544,9 @@ TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) {
|
|||
" class X x;\n"
|
||||
"else\n"
|
||||
" f();\n");
|
||||
|
||||
// This is simply incomplete. Formatting is not important, but must not crash.
|
||||
verifyFormat("class A:");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, DoNotInterfereWithErrorAndWarning) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче