From af19a6aaa2959ef5e76f19d51e87ef523bdeedde Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Thu, 2 Aug 2012 21:45:39 +0000 Subject: Comments AST: refactor DeclInfo to use an enum for decl kind instead of separate flags. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161217 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Comment.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/AST/Comment.cpp') diff --git a/lib/AST/Comment.cpp b/lib/AST/Comment.cpp index ecf6d2a553..ba68cee734 100644 --- a/lib/AST/Comment.cpp +++ b/lib/AST/Comment.cpp @@ -141,7 +141,7 @@ void DeclInfo::fill() { assert(!IsFilled); // Set defaults. - IsFunctionDecl = false; + Kind = FunctionKind; IsTemplateDecl = false; IsTemplateSpecialization = false; IsTemplatePartialSpecialization = false; @@ -153,7 +153,7 @@ void DeclInfo::fill() { if (!ThisDecl) { // Defaults are OK. } else if (const FunctionDecl *FD = dyn_cast(ThisDecl)) { - IsFunctionDecl = true; + Kind = FunctionKind; ParamVars = ArrayRef(FD->param_begin(), FD->getNumParams()); unsigned NumLists = FD->getNumTemplateParameterLists(); @@ -169,14 +169,14 @@ void DeclInfo::fill() { IsClassMethod = !IsInstanceMethod; } } else if (const ObjCMethodDecl *MD = dyn_cast(ThisDecl)) { - IsFunctionDecl = true; + Kind = FunctionKind; ParamVars = ArrayRef(MD->param_begin(), MD->param_size()); IsInstanceMethod = MD->isInstanceMethod(); IsClassMethod = !IsInstanceMethod; } else if (const FunctionTemplateDecl *FTD = dyn_cast(ThisDecl)) { - IsFunctionDecl = true; + Kind = FunctionKind; IsTemplateDecl = true; const FunctionDecl *FD = FTD->getTemplatedDecl(); ParamVars = ArrayRef(FD->param_begin(), @@ -184,18 +184,30 @@ void DeclInfo::fill() { TemplateParameters = FTD->getTemplateParameters(); } else if (const ClassTemplateDecl *CTD = dyn_cast(ThisDecl)) { + Kind = ClassKind; IsTemplateDecl = true; TemplateParameters = CTD->getTemplateParameters(); } else if (const ClassTemplatePartialSpecializationDecl *CTPSD = dyn_cast(ThisDecl)) { + Kind = ClassKind; IsTemplateDecl = true; IsTemplatePartialSpecialization = true; TemplateParameters = CTPSD->getTemplateParameters(); } else if (isa(ThisDecl)) { + Kind = ClassKind; IsTemplateDecl = true; IsTemplateSpecialization = true; + } else if (isa(ThisDecl)) { + Kind = ClassKind; + } else if (isa(ThisDecl) || isa(ThisDecl)) { + Kind = VariableKind; + } else if (isa(ThisDecl)) { + Kind = NamespaceKind; + } else if (isa(ThisDecl)) { + Kind = TypedefKind; } else if (const TypeAliasTemplateDecl *TAT = dyn_cast(ThisDecl)) { + Kind = TypedefKind; IsTemplateDecl = true; TemplateParameters = TAT->getTemplateParameters(); } @@ -204,3 +216,4 @@ void DeclInfo::fill() { } // end namespace comments } // end namespace clang + -- cgit v1.2.3-70-g09d2