]> granicus.if.org Git - clang/commitdiff
documentation comment parsing. Added couple of
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Mar 2013 23:45:52 +0000 (23:45 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Mar 2013 23:45:52 +0000 (23:45 +0000)
top-level HeaderDoc tags @functiongroup and
@methodgroup to doc. tags recognized.
// rdar://12379114

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177358 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CommentCommands.td
include/clang/Basic/DiagnosticCommentKinds.td
lib/AST/CommentSema.cpp
test/Sema/warn-documentation.m

index e2178342270b7e4b2c03d5a3da4d043fe759aee0..9587ace87caffe67b4baf118ba8387ddc2b5946a 100644 (file)
@@ -213,7 +213,9 @@ def Union     : RecordLikeDeclarationVerbatimLineCommand<"union">;
 def Category  : DeclarationVerbatimLineCommand<"category">;
 def Template  : DeclarationVerbatimLineCommand<"template">;
 def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
+def FunctionGroup  : FunctionDeclarationVerbatimLineCommand<"functiongroup">;
 def Method    : FunctionDeclarationVerbatimLineCommand<"method">;
+def MethodGroup    : FunctionDeclarationVerbatimLineCommand<"methodgroup">;
 def Callback  : FunctionDeclarationVerbatimLineCommand<"callback">;
 def Const     : DeclarationVerbatimLineCommand<"const">;
 def Constant  : DeclarationVerbatimLineCommand<"constant">;
index 7682b85a137a6319de91ec2b76d2ace61d798c35..3880e0e5b4fa94e24698161a1c9b6a76d8e340c7 100644 (file)
@@ -74,9 +74,10 @@ def warn_doc_param_not_attached_to_a_function_decl : Warning<
   InGroup<Documentation>, DefaultIgnore;
 
 def warn_doc_function_method_decl_mismatch : Warning<
-  "'%select{\\|@}0%select{function|method|callback}1' command should be "
-  "used in a comment attached to "
-  "%select{a function|an Objective-C method|a pointer to function}2 declaration">,
+  "'%select{\\|@}0%select{function|functiongroup|method|methodgroup|callback}1' "
+  "command should be used in a comment attached to "
+  "%select{a function|a function|an Objective-C method|an Objective-C method|"
+  "a pointer to function}2 declaration">,
   InGroup<Documentation>, DefaultIgnore;
   
 def warn_doc_api_container_decl_mismatch : Warning<
index e6367c97557c69520a08d0f0a8bd830b5340a068..e0138d5f3f276593114a42d8187dd8e829e5e3bc 100644 (file)
@@ -101,11 +101,17 @@ void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) {
     case CommandTraits::KCI_function:
       DiagSelect = !isAnyFunctionDecl() ? 1 : 0;
       break;
+    case CommandTraits::KCI_functiongroup:
+      DiagSelect = !isAnyFunctionDecl() ? 2 : 0;
+      break;
     case CommandTraits::KCI_method:
-      DiagSelect = !isObjCMethodDecl() ? 2 : 0;
+      DiagSelect = !isObjCMethodDecl() ? 3 : 0;
+      break;
+    case CommandTraits::KCI_methodgroup:
+      DiagSelect = !isObjCMethodDecl() ? 4 : 0;
       break;
     case CommandTraits::KCI_callback:
-      DiagSelect = !isFunctionPointerVarDecl() ? 3 : 0;
+      DiagSelect = !isFunctionPointerVarDecl() ? 5 : 0;
       break;
     default:
       DiagSelect = 0;
index 98c499356183ab8a6fec5d2b0010f907e72102c0..1e3acf1d7238a84d932ad9d4ddcb371286adf784 100644 (file)
@@ -123,6 +123,20 @@ typedef id OBJ;
 }
 @end
 
+// rdar://12379114
+// expected-warning@+4 {{'@methodgroup' command should be used in a comment attached to an Objective-C method declaration}}
+// expected-warning@+6 {{'@method' command should be used in a comment attached to an Objective-C method declaratio}}
+@interface rdar12379114
+/*!
+ @methodgroup Creating a request
+*/
+/*!
+ @method initWithTimeout is the 2nd method
+*/
+typedef unsigned int NSTimeInterval;
+- (id)initWithTimeout:(NSTimeInterval)timeout;
+@end
+
 // expected-warning@+2 {{'@protocol' command should not be used in a comment attached to a non-protocol declaration}}
 /*!
 @protocol PROTO