From be0d7de1a3efd49946de2985826cb2c32aa88283 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 2 Oct 2018 22:23:27 +0000 Subject: [PATCH] Remove spurious assertion in -Wdocumentation Some code in OpenCV uses interesting doxygen directives that make it so we don't see any tokens inside a @note, despite there definitely being non-whitespace characters there. The consistency check isn't needed. ParagraphComment supports receiving an empty list of comments. Fixes PR39007 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343641 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/CommentParser.cpp | 1 - test/Sema/warn-documentation.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/AST/CommentParser.cpp b/lib/AST/CommentParser.cpp index c1c04239f5..7f70b95e98 100644 --- a/lib/AST/CommentParser.cpp +++ b/lib/AST/CommentParser.cpp @@ -558,7 +558,6 @@ BlockContentComment *Parser::parseParagraphOrBlockCommand() { case tok::verbatim_block_begin: case tok::verbatim_line_name: case tok::eof: - assert(Content.size() != 0); break; // Block content or EOF ahead, finish this parapgaph. case tok::unknown_command: diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp index 7ffaffc078..5083f68633 100644 --- a/test/Sema/warn-documentation.cpp +++ b/test/Sema/warn-documentation.cpp @@ -1304,3 +1304,12 @@ typedef void (*VariadicFnType)(int a, ...); * now should work too. */ using VariadicFnType2 = void (*)(int a, ...); + +// expected-warning@+2 {{empty paragraph passed to '@note' command}} +/** +@note +\f$\texttt{mu}_{00}=\texttt{m}_{00}\f$, \f$\texttt{nu}_{00}=1\f$ +\f$\texttt{nu}_{10}=\texttt{mu}_{10}=\texttt{mu}_{01}=\texttt{mu}_{10}=0\f$ + */ +class EmptyNoteNoCrash { +}; -- 2.40.0