diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 17:30:38 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 17:30:38 +0000 |
commit | db148be93c9af45da1f3aa9302c577618a56e6ea (patch) | |
tree | 30878bea76d21f92becdd1d3e0664d12e1894a05 /lib | |
parent | 06e504462014b0506a70c7730ea45c551a103364 (diff) |
Copying result of object property reference expression
into a temporary is elidable as well.
(Finishes up radar 8291337).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/Expr.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index dbfe2d52b8..9536b9bf24 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1661,7 +1661,12 @@ bool Expr::isTemporaryObject(ASTContext &C, const CXXRecordDecl *TempTy) const { const Expr *E = skipTemporaryBindingsAndNoOpCasts(this); // Temporaries are by definition pr-values of class type. - if (!E->Classify(C).isPRValue()) return false; + if (!E->Classify(C).isPRValue()) { + // In this context, property reference is a message call and is pr-value. + if (!isa<ObjCPropertyRefExpr>(E) && + !isa<ObjCImplicitSetterGetterRefExpr>(E)) + return false; + } // Black-list a few cases which yield pr-values of class type that don't // refer to temporaries of that type: |