diff options
| author | John McCall <rjmccall@apple.com> | 2012-03-30 21:29:05 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2012-03-30 21:29:05 +0000 |
| commit | f9582a705a128ad6cd62ac9a5da94399f0ea6050 (patch) | |
| tree | 3eb44edbff87698baf893fdb800935d98136d4b2 | |
| parent | 892f48058b7b4f3dd768d5fe421f42cb3a8a356d (diff) | |
| download | bcm5719-llvm-f9582a705a128ad6cd62ac9a5da94399f0ea6050.tar.gz bcm5719-llvm-f9582a705a128ad6cd62ac9a5da94399f0ea6050.zip | |
Fix a pair of invalidation bugs when emitting protocol definitions
in the fragile and non-fragile Mac ObjC runtimes. No useful test
case. Fixes rdar://problem/11072576.
llvm-svn: 153778
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index ece778cc12b..e5246f101f9 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -1914,7 +1914,7 @@ struct _objc__method_prototype_list *class_methods See EmitProtocolExtension(). */ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { - llvm::GlobalVariable *&Entry = Protocols[PD->getIdentifier()]; + llvm::GlobalVariable *Entry = Protocols[PD->getIdentifier()]; // Early exit if a defining object has already been generated. if (Entry && Entry->hasInitializer()) @@ -1997,6 +1997,8 @@ llvm::Constant *CGObjCMac::GetOrEmitProtocol(const ObjCProtocolDecl *PD) { Entry->setSection("__OBJC,__protocol,regular,no_dead_strip"); // FIXME: Is this necessary? Why only for protocol? Entry->setAlignment(4); + + Protocols[PD->getIdentifier()] = Entry; } CGM.AddUsedGlobal(Entry); @@ -5552,7 +5554,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocolRef( llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( const ObjCProtocolDecl *PD) { - llvm::GlobalVariable *&Entry = Protocols[PD->getIdentifier()]; + llvm::GlobalVariable *Entry = Protocols[PD->getIdentifier()]; // Early exit if a defining object has already been generated. if (Entry && Entry->hasInitializer()) @@ -5649,6 +5651,8 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( Entry->setAlignment( CGM.getTargetData().getABITypeAlignment(ObjCTypes.ProtocolnfABITy)); Entry->setSection("__DATA,__datacoal_nt,coalesced"); + + Protocols[PD->getIdentifier()] = Entry; } Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); CGM.AddUsedGlobal(Entry); |

