From 66f6c24146efccc9ad7e37dbd2bd0ea1844e6422 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 4 Mar 2013 18:53:41 +0000 Subject: [PATCH] comment parsing. Missed a case of referring to original command in diagnostic. // rdar://13066276 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176444 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticCommentKinds.td | 2 +- lib/AST/CommentSema.cpp | 1 + test/Sema/warn-documentation.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/clang/Basic/DiagnosticCommentKinds.td b/include/clang/Basic/DiagnosticCommentKinds.td index f8a2af398d..73c0dc9dd0 100644 --- a/include/clang/Basic/DiagnosticCommentKinds.td +++ b/include/clang/Basic/DiagnosticCommentKinds.td @@ -69,7 +69,7 @@ def warn_doc_param_spaces_in_direction : Warning< InGroup, DefaultIgnore; def warn_doc_param_not_attached_to_a_function_decl : Warning< - "'\\param' command used in a comment that is not attached to " + "'%select{\\|@}0param' command used in a comment that is not attached to " "a function declaration">, InGroup, DefaultIgnore; diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index e7bd5c8cad..3e4b28356b 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -78,6 +78,7 @@ ParamCommandComment *Sema::actOnParamCommandStart(SourceLocation LocBegin, if (!isFunctionDecl()) Diag(Command->getLocation(), diag::warn_doc_param_not_attached_to_a_function_decl) + << AtCommand << Command->getCommandNameRange(Traits); return Command; diff --git a/test/Sema/warn-documentation.cpp b/test/Sema/warn-documentation.cpp index d166ae0b58..f9eb458ce8 100644 --- a/test/Sema/warn-documentation.cpp +++ b/test/Sema/warn-documentation.cpp @@ -907,3 +907,11 @@ struct s; struct q* g(void); struct q; +// expected-warning@+3 {{'@param' command used in a comment that is not attached to a function declaration}} +// expected-warning@+3 {{'@result' command used in a comment that is not attached to a function or method declaration}} +/*! @function Base64EncodeEx + @param inFlags This is error flag + @result Error +*/ +typedef unsigned int Base64Flags; +unsigned Base64EncodeEx(Base64Flags inFlags); -- 2.40.0