summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-11-26 07:45:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-11-26 07:45:48 +0000
commitffc066f4b9f60cff4c4393d7e838a10b26fb48ff (patch)
treed16f8a964a92abef0ec08a13957741b771f3d36a /clang/lib/CodeGen/CGCXX.cpp
parent84a7e347bfabdb149cbe1553d0884b19ff555862 (diff)
downloadbcm5719-llvm-ffc066f4b9f60cff4c4393d7e838a10b26fb48ff.tar.gz
bcm5719-llvm-ffc066f4b9f60cff4c4393d7e838a10b26fb48ff.zip
Shortcut explicit calls to a trivial copy assignment operator.
llvm-svn: 89944
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 3b97fcb1171..a0b02d53b66 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -270,6 +270,14 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE) {
This = BaseLV.getAddress();
}
+ if (MD->isCopyAssignment() && MD->isTrivial()) {
+ // We don't like to generate the trivial copy assignment operator when
+ // it isn't necessary; just produce the proper effect here.
+ llvm::Value *RHS = EmitLValue(*CE->arg_begin()).getAddress();
+ EmitAggregateCopy(This, RHS, CE->getType());
+ return RValue::get(This);
+ }
+
// C++ [class.virtual]p12:
// Explicit qualification with the scope operator (5.1) suppresses the
// virtual call mechanism.
OpenPOWER on IntegriCloud