diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 01:05:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 01:05:07 +0000 |
commit | 8a7a59226d48ae98bd5bc09adc111be543b5e941 (patch) | |
tree | 9c759e48a1b4f70188d67bdd113a98853a1da2c9 /clang/lib | |
parent | a69d0aaa71dd74e28a2e5990166819e15fb8f31f (diff) | |
download | bcm5719-llvm-8a7a59226d48ae98bd5bc09adc111be543b5e941.tar.gz bcm5719-llvm-8a7a59226d48ae98bd5bc09adc111be543b5e941.zip |
doc parsing. We want to issue a strong warning when
an @function comment is not followed by a function decl.
// rdar://13094352
llvm-svn: 176468
Diffstat (limited to 'clang/lib')
-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, |