aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-05-10 22:57:19 +0000
committerDouglas Gregor <dgregor@apple.com>2009-05-10 22:57:19 +0000
commit7da97d0f31e1ec16998d3de2cfd2e88fe3736673 (patch)
treeb02158638458d3b80d52e441baab194451072e77 /lib/AST/Decl.cpp
parent0393e285fd621c02a3f4a341bbb5c1ae4c5946d5 (diff)
Implement the semantics of the injected-class-name within a class
template. The injected-class-name is either a type or a template, depending on whether a '<' follows it. As a type, the injected-class-name's template argument list contains its template parameters in declaration order. As part of this, add logic for canonicalizing declarations, and be sure to canonicalize declarations used in template names and template arguments. A TagType is dependent if the declaration it references is dependent. I'm not happy about the rather complicated protocol needed to use ASTContext::getTemplateSpecializationType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 9aba33c943..621145f1af 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -14,6 +14,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Expr.h"
@@ -505,6 +506,18 @@ OverloadedOperatorKind FunctionDecl::getOverloadedOperator() const {
// TagDecl Implementation
//===----------------------------------------------------------------------===//
+bool TagDecl::isDependentType() const {
+ if (isa<TemplateDecl>(this))
+ return true;
+
+ if (const TagDecl *TD = dyn_cast_or_null<TagDecl>(getDeclContext()))
+ return TD->isDependentType();
+
+ // FIXME: Tag types declared function templates are dependent types.
+ // FIXME: Look through block scopes.
+ return false;
+}
+
void TagDecl::startDefinition() {
TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
TagT->decl.setPointer(this);