aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/Decl.cpp13
-rw-r--r--lib/AST/DeclBase.cpp15
2 files changed, 15 insertions, 13 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 6c620713f7..063914092e 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -528,19 +528,6 @@ OverloadedOperatorKind FunctionDecl::getOverloadedOperator() const {
// TagDecl Implementation
//===----------------------------------------------------------------------===//
-bool TagDecl::isDependentType() const {
- if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(this))
- if (Record->getDescribedClassTemplate())
- 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);
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 071fb79101..ba8f3351c3 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -396,6 +396,21 @@ void DeclContext::DestroyDecls(ASTContext &C) {
(*D++)->Destroy(C);
}
+bool DeclContext::isDependentContext() const {
+ if (isFileContext())
+ return false;
+
+ if (const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(this))
+ if (Record->getDescribedClassTemplate())
+ return true;
+
+ if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(this))
+ if (Function->getDescribedFunctionTemplate())
+ return true;
+
+ return getParent() && getParent()->isDependentContext();
+}
+
bool DeclContext::isTransparentContext() const {
if (DeclKind == Decl::Enum)
return true; // FIXME: Check for C++0x scoped enums