From 10989e2dade3bb35a421787c5315d2630d665842 Mon Sep 17 00:00:00 2001 From: Adrian Negreanu Date: Thu, 11 Jun 2015 09:10:10 +0300 Subject: docparser: warn when finding a documented empty return type There is an example on pg24 of [1] where a libclang based comment parser emits a warning for a documented empty return type. [1] "Parsing Documentation Comments in Clang" http://llvm.org/devmtg/2012-11/Gribenko_CommentParsing.pdf --- src/docparser.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index f4261ac..0613ccf 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -611,7 +611,18 @@ static void detectNoDocumentedParams() { g_memberDef->setHasDocumentedReturnType(TRUE); } - + if ( // see if return type is documented in a function w/o return type + g_memberDef->hasDocumentedReturnType() && + (returnType.isEmpty() || // empty return type + returnType.find("void")!=-1 || // void return type + returnType.find("subroutine")!=-1 || // fortran subroutine + g_memberDef->isConstructor() || // a constructor + g_memberDef->isDestructor() // or destructor + ) + ) + { + warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type"); + } } } -- cgit v0.12