doc. parsing. Improve on diagnostics on my last patch.
// rdar://13094352.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176525 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp
index bd32da6..23e27a3 100644
--- a/lib/AST/CommentSema.cpp
+++ b/lib/AST/CommentSema.cpp
@@ -90,12 +90,17 @@
 
 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 @@
     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)