From: John McCall <rjmccall@apple.com> Date: Tue, 31 Aug 2010 22:21:26 +0000 (+0000) Subject: Add convenience accessors for determining whether template declarations are definitions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13fda8afe2ddd06c12bfb93a054e6b0d6d0d99f1;p=clang Add convenience accessors for determining whether template declarations are definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112656 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 4fdcf68151..7fb6978d25 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1886,6 +1886,12 @@ public: return const_cast<TagDecl*>(this)->getCanonicalDecl(); } + /// isThisDeclarationADefinition() - Return true if this declaration + /// defines the type. Provided for consistency. + bool isThisDeclarationADefinition() const { + return isDefinition(); + } + /// isDefinition - Return true if this decl has its body specified. bool isDefinition() const { return IsDefinition; diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 76d474a8cd..482f73423e 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -815,6 +815,12 @@ public: return static_cast<FunctionDecl*>(TemplatedDecl); } + /// Returns whether this template declaration defines the primary + /// pattern. + bool isThisDeclarationADefinition() const { + return getTemplatedDecl()->isThisDeclarationADefinition(); + } + /// \brief Return the specialization with the provided arguments if it exists, /// otherwise return the insertion point. FunctionDecl *findSpecialization(const TemplateArgument *Args, @@ -1664,6 +1670,12 @@ public: return static_cast<CXXRecordDecl *>(TemplatedDecl); } + /// Returns whether this template declaration defines the primary + /// class pattern. + bool isThisDeclarationADefinition() const { + return getTemplatedDecl()->isThisDeclarationADefinition(); + } + /// Create a class template node. static ClassTemplateDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,