[cfe-commits] r160975 - in /cfe/trunk: lib/AST/CommentParser.cpp test/Sema/warn-documentation.cpp
Dmitri Gribenko
gribozavr at gmail.com
Mon Jul 30 11:05:28 PDT 2012
Author: gribozavr
Date: Mon Jul 30 13:05:28 2012
New Revision: 160975
URL: http://llvm.org/viewvc/llvm-project?rev=160975&view=rev
Log:
Comment parser: don't crash on a completely empty \param followed by a block
command
Modified:
cfe/trunk/lib/AST/CommentParser.cpp
cfe/trunk/test/Sema/warn-documentation.cpp
Modified: cfe/trunk/lib/AST/CommentParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=160975&r1=160974&r2=160975&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentParser.cpp (original)
+++ cfe/trunk/lib/AST/CommentParser.cpp Mon Jul 30 13:05:28 2012
@@ -318,9 +318,9 @@
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) {
Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=160975&r1=160974&r2=160975&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Mon Jul 30 13:05:28 2012
@@ -298,3 +298,9 @@
*/
void test_nocrash1(int);
+// We used to crash on this.
+// expected-warning at +2 {{empty paragraph passed to '\param' command}}
+// expected-warning at +1 {{empty paragraph passed to '\brief' command}}
+/// \param\brief
+void test_nocrash2(int);
+
More information about the cfe-commits
mailing list