Comment parser: don't crash on a completely empty \param followed by a block

command


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160975 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dmitri Gribenko 2012-07-30 18:05:28 +00:00
Родитель 74edbd4edf
Коммит e5deb79d0e
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -318,9 +318,9 @@ BlockCommandComment *Parser::parseBlockCommand() {
if (Tok.is(tok::command) && S.isBlockCommand(Tok.getCommandName())) {
// Block command ahead. We can't nest block commands, so pretend that this
// command has an empty argument.
ParagraphComment *PC = S.actOnParagraphComment(
ParagraphComment *Paragraph = S.actOnParagraphComment(
ArrayRef<InlineContentComment *>());
return S.actOnBlockCommandFinish(BC, PC);
return S.actOnBlockCommandFinish(IsParam ? PC : BC, Paragraph);
}
if (IsParam || NumArgs > 0) {

Просмотреть файл

@ -298,3 +298,9 @@ namespace test_attach24 {
*/
void test_nocrash1(int);
// We used to crash on this.
// expected-warning@+2 {{empty paragraph passed to '\param' command}}
// expected-warning@+1 {{empty paragraph passed to '\brief' command}}
/// \param\brief
void test_nocrash2(int);