forked from OSchip/llvm-project
Kill FunctionDecl's IsCopyAssignment bit; it duplicated what could
already be determined by isCopyAssignmentOperator(), and was set too late in the process for all clients to see the appropriate value. Cleanup only; no functionality change. llvm-svn: 114916
This commit is contained in:
parent
175d6411c8
commit
ec3bec0c7a
|
@ -1102,7 +1102,6 @@ private:
|
||||||
bool HasWrittenPrototype : 1;
|
bool HasWrittenPrototype : 1;
|
||||||
bool IsDeleted : 1;
|
bool IsDeleted : 1;
|
||||||
bool IsTrivial : 1; // sunk from CXXMethodDecl
|
bool IsTrivial : 1; // sunk from CXXMethodDecl
|
||||||
bool IsCopyAssignment : 1; // sunk from CXXMethodDecl
|
|
||||||
bool HasImplicitReturnZero : 1;
|
bool HasImplicitReturnZero : 1;
|
||||||
|
|
||||||
/// \brief End part of this FunctionDecl's source range.
|
/// \brief End part of this FunctionDecl's source range.
|
||||||
|
@ -1182,7 +1181,6 @@ protected:
|
||||||
SClass(S), SClassAsWritten(SCAsWritten), IsInline(isInline),
|
SClass(S), SClassAsWritten(SCAsWritten), IsInline(isInline),
|
||||||
IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
|
IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
|
||||||
HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
|
HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
|
||||||
IsCopyAssignment(false),
|
|
||||||
HasImplicitReturnZero(false),
|
HasImplicitReturnZero(false),
|
||||||
EndRangeLoc(NameInfo.getEndLoc()),
|
EndRangeLoc(NameInfo.getEndLoc()),
|
||||||
TemplateOrSpecialization(),
|
TemplateOrSpecialization(),
|
||||||
|
@ -1291,9 +1289,6 @@ public:
|
||||||
bool isTrivial() const { return IsTrivial; }
|
bool isTrivial() const { return IsTrivial; }
|
||||||
void setTrivial(bool IT) { IsTrivial = IT; }
|
void setTrivial(bool IT) { IsTrivial = IT; }
|
||||||
|
|
||||||
bool isCopyAssignment() const { return IsCopyAssignment; }
|
|
||||||
void setCopyAssignment(bool CA) { IsCopyAssignment = CA; }
|
|
||||||
|
|
||||||
/// Whether falling off this function implicitly returns null/zero.
|
/// Whether falling off this function implicitly returns null/zero.
|
||||||
/// If a more specific implicit return value is required, front-ends
|
/// If a more specific implicit return value is required, front-ends
|
||||||
/// should synthesize the appropriate return statements.
|
/// should synthesize the appropriate return statements.
|
||||||
|
|
|
@ -284,10 +284,8 @@ CXXRecordDecl::addedMember(Decl *D) {
|
||||||
// If this is the implicit copy constructor, note that we have now
|
// If this is the implicit copy constructor, note that we have now
|
||||||
// declared it.
|
// declared it.
|
||||||
// FIXME: Move constructors
|
// FIXME: Move constructors
|
||||||
if (Method->getOverloadedOperator() == OO_Equal) {
|
if (Method->getOverloadedOperator() == OO_Equal)
|
||||||
data().DeclaredCopyAssignment = true;
|
data().DeclaredCopyAssignment = true;
|
||||||
Method->setCopyAssignment(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing else to do for implicitly-declared members.
|
// Nothing else to do for implicitly-declared members.
|
||||||
|
@ -359,8 +357,7 @@ CXXRecordDecl::addedMember(Decl *D) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// This is a copy assignment operator.
|
// This is a copy assignment operator.
|
||||||
// Note on the decl that it is a copy assignment operator.
|
// FIXME: Move assignment operators.
|
||||||
Method->setCopyAssignment(true);
|
|
||||||
|
|
||||||
// Suppress the implicit declaration of a copy constructor.
|
// Suppress the implicit declaration of a copy constructor.
|
||||||
data().UserDeclaredCopyAssignment = true;
|
data().UserDeclaredCopyAssignment = true;
|
||||||
|
|
|
@ -114,7 +114,7 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
|
||||||
if (MD->isTrivial()) {
|
if (MD->isTrivial()) {
|
||||||
if (isa<CXXDestructorDecl>(MD)) return RValue::get(0);
|
if (isa<CXXDestructorDecl>(MD)) return RValue::get(0);
|
||||||
|
|
||||||
assert(MD->isCopyAssignment() && "unknown trivial member function");
|
assert(MD->isCopyAssignmentOperator() && "unknown trivial member function");
|
||||||
// We don't like to generate the trivial copy assignment operator when
|
// We don't like to generate the trivial copy assignment operator when
|
||||||
// it isn't necessary; just produce the proper effect here.
|
// it isn't necessary; just produce the proper effect here.
|
||||||
llvm::Value *RHS = EmitLValue(*CE->arg_begin()).getAddress();
|
llvm::Value *RHS = EmitLValue(*CE->arg_begin()).getAddress();
|
||||||
|
@ -211,7 +211,7 @@ CodeGenFunction::EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E,
|
||||||
ReturnValueSlot ReturnValue) {
|
ReturnValueSlot ReturnValue) {
|
||||||
assert(MD->isInstance() &&
|
assert(MD->isInstance() &&
|
||||||
"Trying to emit a member call expr on a static method!");
|
"Trying to emit a member call expr on a static method!");
|
||||||
if (MD->isCopyAssignment()) {
|
if (MD->isCopyAssignmentOperator()) {
|
||||||
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(MD->getDeclContext());
|
const CXXRecordDecl *ClassDecl = cast<CXXRecordDecl>(MD->getDeclContext());
|
||||||
if (ClassDecl->hasTrivialCopyAssignment()) {
|
if (ClassDecl->hasTrivialCopyAssignment()) {
|
||||||
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
|
assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
|
||||||
|
|
|
@ -867,7 +867,7 @@ CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName,
|
||||||
DeferredDeclsToEmit.push_back(D);
|
DeferredDeclsToEmit.push_back(D);
|
||||||
}
|
}
|
||||||
} else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
|
} else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
|
||||||
if (MD->isCopyAssignment() && MD->isImplicit()) {
|
if (MD->isImplicit() && MD->isCopyAssignmentOperator()) {
|
||||||
assert(MD->isUsed() && "Sema doesn't consider CopyAssignment as used.");
|
assert(MD->isUsed() && "Sema doesn't consider CopyAssignment as used.");
|
||||||
DeferredDeclsToEmit.push_back(D);
|
DeferredDeclsToEmit.push_back(D);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1063,7 +1063,8 @@ Sema::CXXSpecialMember Sema::getSpecialMember(const CXXMethodDecl *MD) {
|
||||||
if (isa<CXXDestructorDecl>(MD))
|
if (isa<CXXDestructorDecl>(MD))
|
||||||
return Sema::CXXDestructor;
|
return Sema::CXXDestructor;
|
||||||
|
|
||||||
assert(MD->isCopyAssignment() && "Must have copy assignment operator");
|
assert(MD->isCopyAssignmentOperator() &&
|
||||||
|
"Must have copy assignment operator");
|
||||||
return Sema::CXXCopyAssignment;
|
return Sema::CXXCopyAssignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4930,7 +4930,6 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) {
|
||||||
CopyAssignment->setAccess(AS_public);
|
CopyAssignment->setAccess(AS_public);
|
||||||
CopyAssignment->setImplicit();
|
CopyAssignment->setImplicit();
|
||||||
CopyAssignment->setTrivial(ClassDecl->hasTrivialCopyAssignment());
|
CopyAssignment->setTrivial(ClassDecl->hasTrivialCopyAssignment());
|
||||||
CopyAssignment->setCopyAssignment(true);
|
|
||||||
|
|
||||||
// Add the parameter to the operator.
|
// Add the parameter to the operator.
|
||||||
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
|
ParmVarDecl *FromParam = ParmVarDecl::Create(Context, CopyAssignment,
|
||||||
|
|
|
@ -5525,7 +5525,7 @@ OverloadCandidateKind ClassifyOverloadCandidate(Sema &S,
|
||||||
if (!Meth->isImplicit())
|
if (!Meth->isImplicit())
|
||||||
return isTemplate ? oc_method_template : oc_method;
|
return isTemplate ? oc_method_template : oc_method;
|
||||||
|
|
||||||
assert(Meth->isCopyAssignment()
|
assert(Meth->isCopyAssignmentOperator()
|
||||||
&& "implicit method is not copy assignment operator?");
|
&& "implicit method is not copy assignment operator?");
|
||||||
return oc_implicit_copy_assignment;
|
return oc_implicit_copy_assignment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,6 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||||
FD->setHasWrittenPrototype(Record[Idx++]);
|
FD->setHasWrittenPrototype(Record[Idx++]);
|
||||||
FD->setDeleted(Record[Idx++]);
|
FD->setDeleted(Record[Idx++]);
|
||||||
FD->setTrivial(Record[Idx++]);
|
FD->setTrivial(Record[Idx++]);
|
||||||
FD->setCopyAssignment(Record[Idx++]);
|
|
||||||
FD->setHasImplicitReturnZero(Record[Idx++]);
|
FD->setHasImplicitReturnZero(Record[Idx++]);
|
||||||
FD->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
FD->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++]));
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,6 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
|
||||||
Record.push_back(D->hasWrittenPrototype());
|
Record.push_back(D->hasWrittenPrototype());
|
||||||
Record.push_back(D->isDeleted());
|
Record.push_back(D->isDeleted());
|
||||||
Record.push_back(D->isTrivial());
|
Record.push_back(D->isTrivial());
|
||||||
Record.push_back(D->isCopyAssignment());
|
|
||||||
Record.push_back(D->hasImplicitReturnZero());
|
Record.push_back(D->hasImplicitReturnZero());
|
||||||
Writer.AddSourceLocation(D->getLocEnd(), Record);
|
Writer.AddSourceLocation(D->getLocEnd(), Record);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue