diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /lib/CodeGen/CGObjCMac.cpp | |
parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) |
Notes
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index ef4e6cd4f01b3..0c766575dc218 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -888,7 +888,7 @@ protected: /// int * but is actually an Obj-C class pointer. llvm::WeakTrackingVH ConstantStringClassRef; - /// \brief The LLVM type corresponding to NSConstantString. + /// The LLVM type corresponding to NSConstantString. llvm::StructType *NSConstantStringType = nullptr; llvm::StringMap<llvm::GlobalVariable *> NSConstantStringMap; @@ -1708,7 +1708,7 @@ struct NullReturnState { e = Method->param_end(); i != e; ++i, ++I) { const ParmVarDecl *ParamDecl = (*i); if (ParamDecl->hasAttr<NSConsumedAttr>()) { - RValue RV = I->RV; + RValue RV = I->getRValue(CGF); assert(RV.isScalar() && "NullReturnState::complete - arg not on object"); CGF.EmitARCRelease(RV.getScalarVal(), ARCImpreciseLifetime); @@ -3401,7 +3401,9 @@ static bool hasMRCWeakIvars(CodeGenModule &CGM, See EmitClassExtension(); */ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) { - DefinedSymbols.insert(ID->getIdentifier()); + IdentifierInfo *RuntimeName = + &CGM.getContext().Idents.get(ID->getObjCRuntimeNameAsString()); + DefinedSymbols.insert(RuntimeName); std::string ClassName = ID->getNameAsString(); // FIXME: Gross @@ -4179,10 +4181,6 @@ void FragileHazards::emitHazardsInNewBlocks() { } } -static void addIfPresent(llvm::DenseSet<llvm::Value*> &S, llvm::Value *V) { - if (V) S.insert(V); -} - static void addIfPresent(llvm::DenseSet<llvm::Value*> &S, Address V) { if (V.isValid()) S.insert(V.getPointer()); } @@ -4984,7 +4982,9 @@ llvm::Value *CGObjCMac::EmitClassRef(CodeGenFunction &CGF, if (ID->hasAttr<ObjCRuntimeVisibleAttr>()) return EmitClassRefViaRuntime(CGF, ID, ObjCTypes); - return EmitClassRefFromId(CGF, ID->getIdentifier()); + IdentifierInfo *RuntimeName = + &CGM.getContext().Idents.get(ID->getObjCRuntimeNameAsString()); + return EmitClassRefFromId(CGF, RuntimeName); } llvm::Value *CGObjCMac::EmitNSAutoreleasePoolClassRef(CodeGenFunction &CGF) { @@ -6309,9 +6309,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { llvm::GlobalVariable *MetaTClass = BuildClassObject(CI, /*metaclass*/ true, IsAGV, SuperClassGV, CLASS_RO_GV, classIsHidden); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (CI->hasAttr<DLLExportAttr>()) - MetaTClass->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(MetaTClass, CI); DefinedMetaClasses.push_back(MetaTClass); // Metadata for the class @@ -6351,9 +6349,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { llvm::GlobalVariable *ClassMD = BuildClassObject(CI, /*metaclass*/ false, MetaTClass, SuperClassGV, CLASS_RO_GV, classIsHidden); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (CI->hasAttr<DLLExportAttr>()) - ClassMD->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + CGM.setGVProperties(ClassMD, CI); DefinedClasses.push_back(ClassMD); ImplementedClasses.push_back(CI); @@ -6403,7 +6399,7 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF, PTGV->setAlignment(Align.getQuantity()); if (!CGM.getTriple().isOSBinFormatMachO()) PTGV->setComdat(CGM.getModule().getOrInsertComdat(ProtocolName)); - CGM.addCompilerUsedGlobal(PTGV); + CGM.addUsedGlobal(PTGV); return CGF.Builder.CreateAlignedLoad(PTGV, Align); } @@ -6847,7 +6843,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( Protocols[PD->getIdentifier()] = Entry; } Entry->setVisibility(llvm::GlobalValue::HiddenVisibility); - CGM.addCompilerUsedGlobal(Entry); + CGM.addUsedGlobal(Entry); // Use this protocol meta-data to build protocol list table in section // __DATA, __objc_protolist @@ -6866,7 +6862,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol( PTGV->setSection(GetSectionName("__objc_protolist", "coalesced,no_dead_strip")); PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility); - CGM.addCompilerUsedGlobal(PTGV); + CGM.addUsedGlobal(PTGV); return Entry; } @@ -6952,7 +6948,7 @@ llvm::Value *CGObjCNonFragileABIMac::EmitIvarOffset( // This could be 32bit int or 64bit integer depending on the architecture. // Cast it to 64bit integer value, if it is a 32bit integer ivar offset value - // as this is what caller always expectes. + // as this is what caller always expects. if (ObjCTypes.IvarOffsetVarTy == ObjCTypes.IntTy) IvarOffsetValue = CGF.Builder.CreateIntCast( IvarOffsetValue, ObjCTypes.LongTy, true, "ivar.conv"); @@ -7079,7 +7075,7 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF, CGF.getPointerAlign()); // Update the message ref argument. - args[1].RV = RValue::get(mref.getPointer()); + args[1].setRValue(RValue::get(mref.getPointer())); // Load the function to call from the message ref table. Address calleeAddr = @@ -7528,12 +7524,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.EHTypeTy, false, llvm::GlobalValue::ExternalLinkage, nullptr, EHTypeName); - if (CGM.getTriple().isOSBinFormatCOFF()) { - if (ID->hasAttr<DLLExportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); - else if (ID->hasAttr<DLLImportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); - } + CGM.setGVProperties(Entry, ID); return Entry; } } @@ -7572,10 +7563,8 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, CGM.getPointerAlign(), /*constant*/ false, L); - if (CGM.getTriple().isOSBinFormatCOFF()) - if (hasObjCExceptionAttribute(CGM.getContext(), ID)) - if (ID->hasAttr<DLLExportAttr>()) - Entry->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); + if (hasObjCExceptionAttribute(CGM.getContext(), ID)) + CGM.setGVProperties(Entry, ID); } assert(Entry->getLinkage() == L); |