HeaderDoc: Support more of HeaderDoc documentation 
commands; top level tags such as @interface and
their 2nd level tags such as @coclass, etc.
// rdar://12379114


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176667 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/CommentCommandTraits.h b/include/clang/AST/CommentCommandTraits.h
index 360a54b..0dfeea0 100644
--- a/include/clang/AST/CommentCommandTraits.h
+++ b/include/clang/AST/CommentCommandTraits.h
@@ -101,8 +101,15 @@
   /// \endcode
   unsigned IsDeclarationCommand : 1;
   
-  /// \brief True if verbatim-like line command is a function declaraton.
+  /// \brief True if verbatim-like line command is a function declaration.
   unsigned IsFunctionDeclarationCommand : 1;
+
+  /// \brief True if block command is further describing a container API; such
+  /// as @coclass, @classdesign, etc.
+  unsigned IsContainerDetailCommand : 1;
+  
+  /// \brief True if block command is a container API; such as @interface.
+  unsigned IsContainerDeclarationCommand : 1;
   
   /// \brief True if this command is unknown.  This \c CommandInfo object was
   /// created during parsing.
diff --git a/include/clang/AST/CommentCommands.td b/include/clang/AST/CommentCommands.td
index f3d9baa..ed5927c 100644
--- a/include/clang/AST/CommentCommands.td
+++ b/include/clang/AST/CommentCommands.td
@@ -25,6 +25,8 @@
   bit IsVerbatimLineCommand = 0;
   bit IsDeclarationCommand = 0;
   bit IsFunctionDeclarationCommand = 0;
+  bit IsContainerDetailCommand = 0;
+  bit IsContainerDeclarationCommand = 0;
 }
 
 class InlineCommand<string name> : Command<name> {
@@ -66,6 +68,12 @@
   let IsFunctionDeclarationCommand = 1;
 }
 
+class ContainerDeclarationVerbatimLineCommand<string name> :
+      VerbatimLineCommand<name> {
+  let IsDeclarationCommand = 1;
+  let IsContainerDeclarationCommand = 1;
+}
+
 //===----------------------------------------------------------------------===//
 // InlineCommand
 //===----------------------------------------------------------------------===//
@@ -181,9 +189,11 @@
 def Var       : DeclarationVerbatimLineCommand<"var">;
 
 // HeaderDoc commands.
-def Class     : DeclarationVerbatimLineCommand<"class">;
-def Interface : DeclarationVerbatimLineCommand<"interface">;
-def Protocol  : DeclarationVerbatimLineCommand<"protocol">;
+def Class     : ContainerDeclarationVerbatimLineCommand<"class">;
+def Interface : ContainerDeclarationVerbatimLineCommand<"interface">;
+def Protocol  : ContainerDeclarationVerbatimLineCommand<"protocol">;
+def Struct    : ContainerDeclarationVerbatimLineCommand<"struct">;
+def Union     : ContainerDeclarationVerbatimLineCommand<"union">;
 def Category  : DeclarationVerbatimLineCommand<"category">;
 def Template  : DeclarationVerbatimLineCommand<"template">;
 def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
@@ -191,7 +201,38 @@
 def Callback  : FunctionDeclarationVerbatimLineCommand<"callback">;
 def Const     : DeclarationVerbatimLineCommand<"const">;
 def Constant  : DeclarationVerbatimLineCommand<"constant">;
-def Struct    : DeclarationVerbatimLineCommand<"struct">;
-def Union     : DeclarationVerbatimLineCommand<"union">;
 def Enum      : DeclarationVerbatimLineCommand<"enum">;
 
+def ClassDesign   : BlockCommand<"classdesign"> {
+  let IsContainerDetailCommand = 1; 
+}
+def CoClass       : BlockCommand<"coclass"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Dependency    : BlockCommand<"dependency"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Helper        : BlockCommand<"helper"> {
+ let IsContainerDetailCommand = 1; 
+}
+def HelperClass   : BlockCommand<"helperclass"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Helps         : BlockCommand<"helps"> {
+ let IsContainerDetailCommand = 1; 
+}
+def InstanceSize  : BlockCommand<"instancesize"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Ownership     : BlockCommand<"ownership"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Performance   : BlockCommand<"performance"> {
+ let IsContainerDetailCommand = 1; 
+}
+def Security      : BlockCommand<"security"> {
+ let IsContainerDetailCommand = 1; 
+}
+def SuperClass    : BlockCommand<"superclass"> {
+ let IsContainerDetailCommand = 1; 
+}
diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h
index 1d8112f..8294a81 100644
--- a/include/clang/AST/CommentSema.h
+++ b/include/clang/AST/CommentSema.h
@@ -200,6 +200,10 @@
   void checkDeprecatedCommand(const BlockCommandComment *Comment);
   
   void checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment);
+  
+  void checkContainerDeclVerbatimLine(const BlockCommandComment *Comment);
+  
+  void checkContainerDecl(const BlockCommandComment *Comment);
 
   /// Resolve parameter names to parameter indexes in function declaration.
   /// Emit diagnostics about unknown parametrs.
@@ -211,6 +215,11 @@
   bool isObjCMethodDecl();
   bool isObjCPropertyDecl();
   bool isTemplateOrSpecialization();
+  bool isContainerDecl();
+  bool isClassStructDecl();
+  bool isUnionDecl();
+  bool isObjCInterfaceDecl();
+  bool isObjCProtocolDecl();
 
   ArrayRef<const ParmVarDecl *> getParamVars();