summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-09-15 10:14:12 +0000
committerJohn McCall <rjmccall@apple.com>2010-09-15 10:14:12 +0000
commit7a626f63f7091212a1d2f941c8bee5f482223bfa (patch)
tree80a6ae297730f708626a2b8e004fb5585eb0166a /clang/lib/Sema/SemaDeclCXX.cpp
parentd88d759a74f1b79cdd45b27f5c1c56cf2d0a472e (diff)
downloadbcm5719-llvm-7a626f63f7091212a1d2f941c8bee5f482223bfa.tar.gz
bcm5719-llvm-7a626f63f7091212a1d2f941c8bee5f482223bfa.zip
one piece of code is responsible for the lifetime of every aggregate
slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index d16d9e9763d..0580392689b 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5462,12 +5462,10 @@ Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
// with the same cv-unqualified type, the copy/move operation
// can be omitted by constructing the temporary object
// directly into the target of the omitted copy/move
- if (Constructor->isCopyConstructor() && ExprArgs.size() >= 1) {
+ if (ConstructKind == CXXConstructExpr::CK_Complete &&
+ Constructor->isCopyConstructor() && ExprArgs.size() >= 1) {
Expr *SubExpr = ((Expr **)ExprArgs.get())[0];
- Elidable = SubExpr->isTemporaryObject() &&
- ConstructKind == CXXConstructExpr::CK_Complete &&
- Context.hasSameUnqualifiedType(SubExpr->getType(),
- Context.getTypeDeclType(Constructor->getParent()));
+ Elidable = SubExpr->isTemporaryObject(Context, Constructor->getParent());
}
return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor,
OpenPOWER on IntegriCloud