diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 22:46:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-05 22:46:07 +0000 |
commit | 56fe4066e589ff76051d9af0344f931d7adf628a (patch) | |
tree | cb9e284d5cef6baf14c3d5d2c1ac34756099ec7d /clang/lib/AST/CommentSema.cpp | |
parent | fad9aae937abde5d1df1b885e7bd7a01fea6fd34 (diff) | |
download | bcm5719-llvm-56fe4066e589ff76051d9af0344f931d7adf628a.tar.gz bcm5719-llvm-56fe4066e589ff76051d9af0344f931d7adf628a.zip |
doc. parsing. Improve on diagnostics on my last patch.
// rdar://13094352.
llvm-svn: 176525
Diffstat (limited to 'clang/lib/AST/CommentSema.cpp')
-rw-r--r-- | clang/lib/AST/CommentSema.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index bd32da6e6e8..23e27a3fe5b 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -90,12 +90,17 @@ ParamCommandComment *Sema::actOnParamCommandStart( void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) { const CommandInfo *Info = Traits.getCommandInfo(Comment->getCommandID()); - if (Info->IsFunctionDeclarationCommand && - !isFunctionDecl() && !isCallbackDecl()) - Diag(Comment->getLocation(), - diag::warn_doc_function_not_attached_to_a_function_decl) - << Comment->getCommandMarker() - << Info->Name << Info->Name + if (!Info->IsFunctionDeclarationCommand) + return; + StringRef Name = Info->Name; + unsigned DiagKind = llvm::StringSwitch<unsigned>(Name) + .Case("function", diag::warn_doc_function_not_attached_to_a_function_decl) + .Case("method", diag::warn_doc_method_not_attached_to_a_objc_method_decl) + .Case("callback", diag::warn_doc_callback_not_attached_to_a_function_ptr_decl) + .Default(0); + + if (DiagKind) + Diag(Comment->getLocation(), DiagKind) << Comment->getCommandMarker() << Comment->getSourceRange(); } @@ -685,8 +690,15 @@ bool Sema::isFunctionDecl() { inspectThisDecl(); return ThisDeclInfo->getKind() == DeclInfo::FunctionKind; } + +bool Sema::isObjCMethodDecl() { + return isFunctionDecl() && ThisDeclInfo->CurrentDecl && + isa<ObjCMethodDecl>(ThisDeclInfo->CurrentDecl); +} -bool Sema::isCallbackDecl() { +/// isFunctionPointerVarDecl - returns 'true' if declaration is a pointer to +/// function decl. +bool Sema::isFunctionPointerVarDecl() { if (!ThisDeclInfo) return false; if (!ThisDeclInfo->IsFilled) |