diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2009-06-23 14:50:21 +0000 |
| commit | d6aff018d446f22be4e4e0277080ebfa5b157288 (patch) | |
| tree | 64b43af65e97f7659637c9ac028e39af2e26b841 /lib/AST/DeclCXX.cpp | |
| parent | b897c8660c4ff7037dde81b9645737bc1c992abe (diff) | |
Notes
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 7a930d78c123..25e4d1961778 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 { |
