summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-10-21 22:06:03 +0000
committerJohn McCall <rjmccall@apple.com>2015-10-21 22:06:03 +0000
commit09ec1ecf03db8ad73284552b1b93e1e3968dbf46 (patch)
tree3b14fd0e2d6c74dfb10adbad88a25dcded39219f /clang/lib
parent7737bd9f9fb5d9cfd5717f36791036fa08d57b95 (diff)
downloadbcm5719-llvm-09ec1ecf03db8ad73284552b1b93e1e3968dbf46.tar.gz
bcm5719-llvm-09ec1ecf03db8ad73284552b1b93e1e3968dbf46.zip
Enable ARC on the fragile runtime.
This is almost entirely a matter of just flipping a switch. 99% of the runtime support is available all the way back to when it was implemented in the non-fragile runtime, i.e. in Lion. However, fragile runtimes do not recognize ARC-style ivar layout strings, which means that accessing __strong or __weak ivars reflectively (e.g. via object_setIvar) will end up accessing the ivar as if it were __unsafe_unretained. Therefore, when using reflective technologies like KVC, be sure that your paths always refer to a property. rdar://23209307 llvm-svn: 250955
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index ddac815038d..a44cdf8c345 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -3063,7 +3063,8 @@ enum FragileClassFlags {
FragileABI_Class_Factory = 0x00001,
FragileABI_Class_Meta = 0x00002,
FragileABI_Class_HasCXXStructors = 0x02000,
- FragileABI_Class_Hidden = 0x20000
+ FragileABI_Class_Hidden = 0x20000,
+ FragileABI_Class_CompiledByARC = 0x04000000
};
enum NonFragileClassFlags {
@@ -3125,6 +3126,10 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
unsigned Flags = FragileABI_Class_Factory;
if (ID->hasNonZeroConstructors() || ID->hasDestructors())
Flags |= FragileABI_Class_HasCXXStructors;
+
+ if (CGM.getLangOpts().ObjCAutoRefCount)
+ Flags |= FragileABI_Class_CompiledByARC;
+
CharUnits Size =
CGM.getContext().getASTObjCImplementationLayout(ID).getSize();
@@ -4847,7 +4852,7 @@ CGObjCCommonMac::BuildIvarLayout(const ObjCImplementationDecl *OMD,
if (isNonFragileABI()) {
baseOffset = beginOffset; // InstanceStart
- } else if (auto superClass = OMD->getSuperClass()) {
+ } else if (auto superClass = OI->getSuperClass()) {
auto startOffset =
CGM.getContext().getASTObjCInterfaceLayout(superClass).getSize();
baseOffset = startOffset.RoundUpToAlignment(CGM.getPointerAlign());
OpenPOWER on IntegriCloud