diff options
author | ed <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
commit | da468bf93e74598f985f4988936ee5ca2dc9a38c (patch) | |
tree | 64b43af65e97f7659637c9ac028e39af2e26b841 /lib/AST/DeclCXX.cpp | |
parent | 8927c19a5ed03bef55dac4b623688387bcc794dc (diff) | |
download | FreeBSD-src-da468bf93e74598f985f4988936ee5ca2dc9a38c.zip FreeBSD-src-da468bf93e74598f985f4988936ee5ca2dc9a38c.tar.gz |
Import Clang r73954.
Diffstat (limited to 'lib/AST/DeclCXX.cpp')
-rw-r--r-- | lib/AST/DeclCXX.cpp | 22 |
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 { |