summaryrefslogtreecommitdiffstats
path: root/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/DeclCXX.cpp')
-rw-r--r--lib/AST/DeclCXX.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 7a930d7..25e4d19 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -66,21 +66,29 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases,
}
bool CXXRecordDecl::hasConstCopyConstructor(ASTContext &Context) const {
+ return getCopyConstructor(Context, QualType::Const) != 0;
+}
+
+CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
+ unsigned TypeQuals) const{
QualType ClassType
= Context.getTypeDeclType(const_cast<CXXRecordDecl*>(this));
DeclarationName ConstructorName
= Context.DeclarationNames.getCXXConstructorName(
- Context.getCanonicalType(ClassType));
- unsigned TypeQuals;
+ Context.getCanonicalType(ClassType));
+ unsigned FoundTQs;
DeclContext::lookup_const_iterator Con, ConEnd;
for (llvm::tie(Con, ConEnd) = this->lookup(Context, ConstructorName);
Con != ConEnd; ++Con) {
- if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, TypeQuals) &&
- (TypeQuals & QualType::Const) != 0)
- return true;
+ if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
+ FoundTQs)) {
+ if (((TypeQuals & QualType::Const) == (FoundTQs & QualType::Const)) ||
+ (!(TypeQuals & QualType::Const) && (FoundTQs & QualType::Const)))
+ return cast<CXXConstructorDecl>(*Con);
+
+ }
}
-
- return false;
+ return 0;
}
bool CXXRecordDecl::hasConstCopyAssignment(ASTContext &Context) const {
OpenPOWER on IntegriCloud