r343641 - Remove spurious assertion in -Wdocumentation

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 15:23:27 PDT 2018


Author: rnk
Date: Tue Oct  2 15:23:27 2018
New Revision: 343641

URL: http://llvm.org/viewvc/llvm-project?rev=343641&view=rev
Log:
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

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=343641&r1=343640&r2=343641&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentParser.cpp (original)
+++ cfe/trunk/lib/AST/CommentParser.cpp Tue Oct  2 15:23:27 2018
@@ -558,7 +558,6 @@ BlockContentComment *Parser::parseParagr
     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:

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=343641&r1=343640&r2=343641&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Tue Oct  2 15:23:27 2018
@@ -1304,3 +1304,12 @@ typedef void (*VariadicFnType)(int a, ..
  * now should work too.
  */
 using VariadicFnType2 = void (*)(int a, ...);
+
+// expected-warning at +2 {{empty paragraph passed to '@note' command}}
+/**
+ at 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 {
+};




More information about the cfe-commits mailing list