summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-14 00:01:54 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-14 00:01:54 +0000
commit92b3f47de277c491f7fdd236beaf2ab87988b640 (patch)
tree7ce8c9193505e66905cdcf9a1450de179fdcbf7e /clang/lib
parent262332f24bed2933269b461176ce1eda37ad8637 (diff)
downloadbcm5719-llvm-92b3f47de277c491f7fdd236beaf2ab87988b640.tar.gz
bcm5719-llvm-92b3f47de277c491f7fdd236beaf2ab87988b640.zip
Fixed a bug in ir-gen for copy assignment synthesis.
Fixed a bug when evaluating those copy-assignments which need by lazily syntheized. A test case for these. llvm-svn: 78965
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp5
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 24e87f521f3..4460a254b78 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -1045,7 +1045,10 @@ void CodeGenFunction::SynthesizeCXXCopyAssignment(const CXXMethodDecl *CD,
LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
RValue RVRHS = EmitLoadOfLValue(RHS, FieldType);
EmitStoreThroughLValue(RVRHS, LHS, FieldType);
- }
+ }
+
+ // return *this;
+ Builder.CreateStore(LoadOfThis, ReturnValue);
FinishFunction();
}
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index c9e7e934fd7..6a5700ef19b 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -739,7 +739,9 @@ void CodeGenModule::DeferredCopyAssignmentToEmit(GlobalDecl CopyAssignDecl) {
CXXRecordDecl *BaseClassDecl
= cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
const CXXMethodDecl *MD = 0;
- if (BaseClassDecl->hasConstCopyAssignment(getContext(), MD))
+ if (!BaseClassDecl->hasTrivialCopyAssignment() &&
+ !BaseClassDecl->hasUserDeclaredCopyAssignment() &&
+ BaseClassDecl->hasConstCopyAssignment(getContext(), MD))
GetAddrOfFunction(GlobalDecl(MD), 0);
}
@@ -755,7 +757,9 @@ void CodeGenModule::DeferredCopyAssignmentToEmit(GlobalDecl CopyAssignDecl) {
CXXRecordDecl *FieldClassDecl
= cast<CXXRecordDecl>(FieldClassType->getDecl());
const CXXMethodDecl *MD = 0;
- if (FieldClassDecl->hasConstCopyAssignment(getContext(), MD))
+ if (!FieldClassDecl->hasTrivialCopyAssignment() &&
+ !FieldClassDecl->hasUserDeclaredCopyAssignment() &&
+ FieldClassDecl->hasConstCopyAssignment(getContext(), MD))
GetAddrOfFunction(GlobalDecl(MD), 0);
}
}
OpenPOWER on IntegriCloud