Comment AST: DeclInfo: collapse a bunch of boolean flags into an enum.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161352 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Comment.cpp b/lib/AST/Comment.cpp
index e35b2a3..96b09d0 100644
--- a/lib/AST/Comment.cpp
+++ b/lib/AST/Comment.cpp
@@ -142,9 +142,7 @@
 
   // Set defaults.
   Kind = OtherKind;
-  IsTemplateDecl = false;
-  IsTemplateSpecialization = false;
-  IsTemplatePartialSpecialization = false;
+  TemplateKind = NotTemplate;
   IsObjCMethod = false;
   IsInstanceMethod = false;
   IsClassMethod = false;
@@ -174,8 +172,7 @@
     ResultType = FD->getResultType();
     unsigned NumLists = FD->getNumTemplateParameterLists();
     if (NumLists != 0) {
-      IsTemplateDecl = true;
-      IsTemplateSpecialization = true;
+      TemplateKind = TemplateSpecialization;
       TemplateParameters =
           FD->getTemplateParameterList(NumLists - 1);
     }
@@ -202,7 +199,7 @@
   case Decl::FunctionTemplate: {
     const FunctionTemplateDecl *FTD = cast<FunctionTemplateDecl>(ThisDecl);
     Kind = FunctionKind;
-    IsTemplateDecl = true;
+    TemplateKind = Template;
     const FunctionDecl *FD = FTD->getTemplatedDecl();
     ParamVars = ArrayRef<const ParmVarDecl *>(FD->param_begin(),
                                               FD->getNumParams());
@@ -213,7 +210,7 @@
   case Decl::ClassTemplate: {
     const ClassTemplateDecl *CTD = cast<ClassTemplateDecl>(ThisDecl);
     Kind = ClassKind;
-    IsTemplateDecl = true;
+    TemplateKind = Template;
     TemplateParameters = CTD->getTemplateParameters();
     break;
   }
@@ -221,15 +218,13 @@
     const ClassTemplatePartialSpecializationDecl *CTPSD =
         cast<ClassTemplatePartialSpecializationDecl>(ThisDecl);
     Kind = ClassKind;
-    IsTemplateDecl = true;
-    IsTemplatePartialSpecialization = true;
+    TemplateKind = TemplatePartialSpecialization;
     TemplateParameters = CTPSD->getTemplateParameters();
     break;
   }
   case Decl::ClassTemplateSpecialization:
     Kind = ClassKind;
-    IsTemplateDecl = true;
-    IsTemplateSpecialization = true;
+    TemplateKind = TemplateSpecialization;
     break;
   case Decl::Record:
   case Decl::CXXRecord:
@@ -251,7 +246,7 @@
   case Decl::TypeAliasTemplate: {
     const TypeAliasTemplateDecl *TAT = cast<TypeAliasTemplateDecl>(ThisDecl);
     Kind = TypedefKind;
-    IsTemplateDecl = true;
+    TemplateKind = Template;
     TemplateParameters = TAT->getTemplateParameters();
     break;
   }
diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp
index 42dd320..978c748 100644
--- a/lib/AST/CommentSema.cpp
+++ b/lib/AST/CommentSema.cpp
@@ -205,7 +205,7 @@
   TParamCommandComment *Command =
       new (Allocator) TParamCommandComment(LocBegin, LocEnd, Name);
 
-  if (!isTemplateDecl())
+  if (!isTemplateOrSpecialization())
     Diag(Command->getLocation(),
          diag::warn_doc_tparam_not_attached_to_a_template_decl)
       << Command->getCommandNameRange();
@@ -226,7 +226,7 @@
                                          Arg);
   Command->setArgs(llvm::makeArrayRef(A, 1));
 
-  if (!isTemplateDecl()) {
+  if (!isTemplateOrSpecialization()) {
     // We already warned that this \\tparam is not attached to a template decl.
     return;
   }
@@ -536,12 +536,12 @@
   return ThisDeclInfo->getKind() == DeclInfo::FunctionKind;
 }
 
-bool Sema::isTemplateDecl() {
+bool Sema::isTemplateOrSpecialization() {
   if (!ThisDeclInfo)
     return false;
   if (!ThisDeclInfo->IsFilled)
     inspectThisDecl();
-  return ThisDeclInfo->IsTemplateDecl;
+  return ThisDeclInfo->getTemplateKind() != DeclInfo::NotTemplate;
 }
 
 ArrayRef<const ParmVarDecl *> Sema::getParamVars() {