aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-01 22:47:18 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-01 22:47:18 +0000
commitdb89f289a22897f1031c92f3e49f7a9ba7bae61e (patch)
tree8fbabd9a90fadfe64264df06204689027194de8c /lib/Sema/SemaDeclCXX.cpp
parenteb8c670d2949eb62005eca36c64c9461f2a2173e (diff)
Add a new routine Sema::LookupDestructor and make all destructor-lookup calls use that routine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 391541d484..fc52b3df10 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2230,7 +2230,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
if (FieldClassDecl->hasTrivialDestructor())
continue;
- CXXDestructorDecl *Dtor = FieldClassDecl->getDestructor();
+ CXXDestructorDecl *Dtor = LookupDestructor(FieldClassDecl);
CheckDestructorAccess(Field->getLocation(), Dtor,
PDiag(diag::err_access_dtor_field)
<< Field->getDeclName()
@@ -2256,7 +2256,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
if (BaseClassDecl->hasTrivialDestructor())
continue;
- CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor();
+ CXXDestructorDecl *Dtor = LookupDestructor(BaseClassDecl);
// FIXME: caret should be on the start of the class name
CheckDestructorAccess(Base->getSourceRange().getBegin(), Dtor,
@@ -2283,7 +2283,7 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
if (BaseClassDecl->hasTrivialDestructor())
continue;
- CXXDestructorDecl *Dtor = BaseClassDecl->getDestructor();
+ CXXDestructorDecl *Dtor = LookupDestructor(BaseClassDecl);
CheckDestructorAccess(ClassDecl->getLocation(), Dtor,
PDiag(diag::err_access_dtor_vbase)
<< VBase->getType());
@@ -4256,7 +4256,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(Scope *S,
if (const RecordType *BaseType = B->getType()->getAs<RecordType>())
ExceptSpec.CalledDecl(
- cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor());
+ LookupDestructor(cast<CXXRecordDecl>(BaseType->getDecl())));
}
// Virtual base-class destructors.
@@ -4265,7 +4265,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(Scope *S,
B != BEnd; ++B) {
if (const RecordType *BaseType = B->getType()->getAs<RecordType>())
ExceptSpec.CalledDecl(
- cast<CXXRecordDecl>(BaseType->getDecl())->getDestructor());
+ LookupDestructor(cast<CXXRecordDecl>(BaseType->getDecl())));
}
// Field destructors.
@@ -4275,7 +4275,7 @@ CXXDestructorDecl *Sema::DeclareImplicitDestructor(Scope *S,
if (const RecordType *RecordTy
= Context.getBaseElementType(F->getType())->getAs<RecordType>())
ExceptSpec.CalledDecl(
- cast<CXXRecordDecl>(RecordTy->getDecl())->getDestructor());
+ LookupDestructor(cast<CXXRecordDecl>(RecordTy->getDecl())));
}
QualType Ty = Context.getFunctionType(Context.VoidTy,
@@ -5214,7 +5214,7 @@ void Sema::FinalizeVarWithDestructor(VarDecl *VD, const RecordType *Record) {
CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(Record->getDecl());
if (!ClassDecl->isInvalidDecl() && !VD->isInvalidDecl() &&
!ClassDecl->hasTrivialDestructor() && !ClassDecl->isDependentContext()) {
- CXXDestructorDecl *Destructor = ClassDecl->getDestructor();
+ CXXDestructorDecl *Destructor = LookupDestructor(ClassDecl);
MarkDeclarationReferenced(VD->getLocation(), Destructor);
CheckDestructorAccess(VD->getLocation(), Destructor,
PDiag(diag::err_access_dtor_var)
@@ -6685,8 +6685,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) {
= Context.getBaseElementType(Field->getType())
->getAs<RecordType>()) {
CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
- if (CXXDestructorDecl *Destructor
- = const_cast<CXXDestructorDecl*>(RD->getDestructor())) {
+ if (CXXDestructorDecl *Destructor = LookupDestructor(RD)) {
MarkDeclarationReferenced(Field->getLocation(), Destructor);
CheckDestructorAccess(Field->getLocation(), Destructor,
PDiag(diag::err_access_dtor_ivar)