diff options
author | John McCall <rjmccall@apple.com> | 2011-09-13 06:00:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-09-13 06:00:03 +0000 |
commit | 6c11f0b3106263600af2ea0438ebb372821514aa (patch) | |
tree | 3b9f8f697ad2087382656c47cffffcce8a06ad0e /lib/CodeGen/CGObjC.cpp | |
parent | 5889c60d19101156a3a54b8c49bcc60a12cc1fdb (diff) |
Handle reference properties correctly in the trivial-getter check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index f0a47af909..ca04a7b178 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -564,13 +564,19 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP, FinishFunction(); } -static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *PID) { - const Expr *getter = PID->getGetterCXXConstructor(); +static bool hasTrivialGetExpr(const ObjCPropertyImplDecl *propImpl) { + const Expr *getter = propImpl->getGetterCXXConstructor(); if (!getter) return true; // Sema only makes only of these when the ivar has a C++ class type, // so the form is pretty constrained. + // If the property has a reference type, we might just be binding a + // reference, in which case the result will be a gl-value. We should + // treat this as a non-trivial operation. + if (getter->isGLValue()) + return false; + // If we selected a trivial copy-constructor, we're okay. if (const CXXConstructExpr *construct = dyn_cast<CXXConstructExpr>(getter)) return (construct->getConstructor()->isTrivial()); |