patch to mark use of implicit copy constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73922 91177308-0d34-0410-b5e6-96231b3b80d8
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 @@
}
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 {