if (!LangOpts.CPlusPlus0x)
return false;
+ SourceLocation Loc = CD->getLocation();
+
// Do access control from the constructor
ContextRAII CtorContext(*this, CD);
CXXDestructorDecl *BaseDtor = LookupDestructor(BaseDecl);
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
InitializedEntity BaseEntity =
InitializedEntity::InitializeBase(Context, BI, 0);
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
InitializationSequence InitSeq(*this, BaseEntity, Kind, 0, 0);
CXXDestructorDecl *BaseDtor = LookupDestructor(BaseDecl);
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
InitializedEntity BaseEntity =
InitializedEntity::InitializeBase(Context, BI, BI);
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
InitializationSequence InitSeq(*this, BaseEntity, Kind, 0, 0);
CXXDestructorDecl *FieldDtor = LookupDestructor(FieldRecord);
if (FieldDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), FieldDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, FieldDtor, PDiag()) !=
AR_accessible)
return true;
InitializedEntity MemberEntity =
InitializedEntity::InitializeMember(*FI, 0);
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
InitializationSequence InitSeq(*this, MemberEntity, Kind, 0, 0);
if (!LangOpts.CPlusPlus0x)
return false;
+ SourceLocation Loc = CD->getLocation();
+
// Do access control from the constructor
ContextRAII CtorContext(*this, CD);
CXXDestructorDecl *BaseDtor = LookupDestructor(BaseDecl);
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
InitializedEntity BaseEntity =
InitializedEntity::InitializeBase(Context, BI, 0);
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
// Construct a fake expression to perform the copy overloading.
QualType ArgType = BaseType.getUnqualifiedType();
if (ConstArg)
ArgType.addConst();
- Expr *Arg = new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue);
+ Expr *Arg = new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue);
InitializationSequence InitSeq(*this, BaseEntity, Kind, &Arg, 1);
CXXDestructorDecl *BaseDtor = LookupDestructor(BaseDecl);
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
InitializedEntity BaseEntity =
InitializedEntity::InitializeBase(Context, BI, BI);
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
// Construct a fake expression to perform the copy overloading.
QualType ArgType = BaseType.getUnqualifiedType();
if (ConstArg)
ArgType.addConst();
- Expr *Arg = new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue);
+ Expr *Arg = new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue);
InitializationSequence InitSeq(*this, BaseEntity, Kind, &Arg, 1);
CXXDestructorDecl *FieldDtor = LookupDestructor(FieldRecord);
if (FieldDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), FieldDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, FieldDtor, PDiag()) !=
AR_accessible)
return true;
}
}
InitializationKind Kind =
- InitializationKind::CreateDirect(SourceLocation(), SourceLocation(),
- SourceLocation());
+ InitializationKind::CreateDirect(Loc, Loc, Loc);
// Construct a fake expression to perform the copy overloading.
QualType ArgType = FieldType;
ArgType = ArgType->getPointeeType();
else if (ConstArg)
ArgType.addConst();
- Expr *Arg = new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue);
+ Expr *Arg = new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue);
InitializationSequence InitSeq(*this, Entities.back(), Kind, &Arg, 1);
if (!LangOpts.CPlusPlus0x)
return false;
+ SourceLocation Loc = MD->getLocation();
+
// Do access control from the constructor
ContextRAII MethodContext(*this, MD);
DeclarationName OperatorName =
Context.DeclarationNames.getCXXOperatorName(OO_Equal);
- LookupResult R(*this, OperatorName, SourceLocation(), LookupOrdinaryName);
+ LookupResult R(*this, OperatorName, Loc, LookupOrdinaryName);
R.suppressDiagnostics();
// FIXME: We should put some diagnostic logic right into this function.
QualType ThisType = BaseType;
if (ConstArg)
ArgType.addConst();
- Expr *Args[] = { new (Context) OpaqueValueExpr(SourceLocation(), ThisType,
- VK_LValue)
- , new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue)
+ Expr *Args[] = { new (Context) OpaqueValueExpr(Loc, ThisType, VK_LValue)
+ , new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue)
};
- OverloadCandidateSet OCS((SourceLocation()));
+ OverloadCandidateSet OCS((Loc));
OverloadCandidateSet::iterator Best;
AddFunctionCandidates(R.asUnresolvedSet(), Args, 2, OCS);
- if (OCS.BestViableFunction(*this, SourceLocation(), Best, false) !=
+ if (OCS.BestViableFunction(*this, Loc, Best, false) !=
OR_Success)
return true;
}
QualType ThisType = BaseType;
if (ConstArg)
ArgType.addConst();
- Expr *Args[] = { new (Context) OpaqueValueExpr(SourceLocation(), ThisType,
- VK_LValue)
- , new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue)
+ Expr *Args[] = { new (Context) OpaqueValueExpr(Loc, ThisType, VK_LValue)
+ , new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue)
};
- OverloadCandidateSet OCS((SourceLocation()));
+ OverloadCandidateSet OCS((Loc));
OverloadCandidateSet::iterator Best;
AddFunctionCandidates(R.asUnresolvedSet(), Args, 2, OCS);
- if (OCS.BestViableFunction(*this, SourceLocation(), Best, false) !=
+ if (OCS.BestViableFunction(*this, Loc, Best, false) !=
OR_Success)
return true;
}
QualType ThisType = FieldType;
if (ConstArg)
ArgType.addConst();
- Expr *Args[] = { new (Context) OpaqueValueExpr(SourceLocation(), ThisType,
- VK_LValue)
- , new (Context) OpaqueValueExpr(SourceLocation(), ArgType,
- VK_LValue)
+ Expr *Args[] = { new (Context) OpaqueValueExpr(Loc, ThisType, VK_LValue)
+ , new (Context) OpaqueValueExpr(Loc, ArgType, VK_LValue)
};
- OverloadCandidateSet OCS((SourceLocation()));
+ OverloadCandidateSet OCS((Loc));
OverloadCandidateSet::iterator Best;
AddFunctionCandidates(R.asUnresolvedSet(), Args, 2, OCS);
- if (OCS.BestViableFunction(*this, SourceLocation(), Best, false) !=
+ if (OCS.BestViableFunction(*this, Loc, Best, false) !=
OR_Success)
return true;
}
if (!LangOpts.CPlusPlus0x)
return false;
+ SourceLocation Loc = DD->getLocation();
+
// Do access control from the destructor
ContextRAII CtorContext(*this, DD);
// a destructor that is inaccessible from the defaulted destructor
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
}
// a destructor that is inaccessible from the defaulted destructor
if (BaseDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), BaseDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, BaseDtor, PDiag()) !=
AR_accessible)
return true;
}
// inaccessible from the defaulted destructor
if (FieldDtor->isDeleted())
return true;
- if (CheckDestructorAccess(SourceLocation(), FieldDtor, PDiag()) !=
+ if (CheckDestructorAccess(Loc, FieldDtor, PDiag()) !=
AR_accessible)
return true;
FunctionDecl *OperatorDelete = 0;
DeclarationName Name =
Context.DeclarationNames.getCXXOperatorName(OO_Delete);
- if (FindDeallocationFunction(SourceLocation(), RD, Name, OperatorDelete,
+ if (FindDeallocationFunction(Loc, RD, Name, OperatorDelete,
false))
return true;
}
// Note that we have declared this constructor.
++ASTContext::NumImplicitDefaultConstructorsDeclared;
-
- // Do not delete this yet if we're in a template
- if (!ClassDecl->isDependentType() &&
- ShouldDeleteDefaultConstructor(DefaultCon))
- DefaultCon->setDeletedAsWritten();
if (Scope *S = getScopeForContext(ClassDecl))
PushOnScopeChains(DefaultCon, S, false);
ClassDecl->addDecl(DefaultCon);
+
+ if (ShouldDeleteDefaultConstructor(DefaultCon))
+ DefaultCon->setDeletedAsWritten();
return DefaultCon;
}
// Note that we have added this copy-assignment operator.
++ASTContext::NumImplicitCopyAssignmentOperatorsDeclared;
-
- if (ShouldDeleteCopyAssignmentOperator(CopyAssignment))
- CopyAssignment->setDeletedAsWritten();
if (Scope *S = getScopeForContext(ClassDecl))
PushOnScopeChains(CopyAssignment, S, false);
ClassDecl->addDecl(CopyAssignment);
+ if (ShouldDeleteCopyAssignmentOperator(CopyAssignment))
+ CopyAssignment->setDeletedAsWritten();
+
AddOverriddenMethods(ClassDecl, CopyAssignment);
return CopyAssignment;
}
SC_None, 0);
CopyConstructor->setParams(&FromParam, 1);
- if (ShouldDeleteCopyConstructor(CopyConstructor))
- CopyConstructor->setDeletedAsWritten();
-
if (Scope *S = getScopeForContext(ClassDecl))
PushOnScopeChains(CopyConstructor, S, false);
ClassDecl->addDecl(CopyConstructor);
+
+ if (ShouldDeleteCopyConstructor(CopyConstructor))
+ CopyConstructor->setDeletedAsWritten();
return CopyConstructor;
}