diff options
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/CommentParser.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/CommentSema.cpp | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/CommentParser.cpp b/clang/lib/AST/CommentParser.cpp index 09912c61886..c361679e905 100644 --- a/clang/lib/AST/CommentParser.cpp +++ b/clang/lib/AST/CommentParser.cpp @@ -706,6 +706,8 @@ VerbatimLineComment *Parser::parseVerbatimLine() { TextBegin, Text); consumeToken(); + S.checkFunctionDeclVerbatimLine(VL); + return VL; } diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index d959d19b916..0cf7b5fd50d 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -88,6 +88,15 @@ ParamCommandComment *Sema::actOnParamCommandStart( return Command; } +void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) { + const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID()); + if (Info->IsFunctionDeclarationCommand && + !isFunctionDecl()) + Diag(Comment->getLocation(), + diag::warn_doc_function_not_attached_to_a_function_decl) + << Comment->getSourceRange(); +} + void Sema::actOnParamCommandDirectionArg(ParamCommandComment *Command, SourceLocation ArgLocBegin, SourceLocation ArgLocEnd, |