llvm::IRBuilder<> b(llvm::BasicBlock::Create(CGM.getLLVMContext(), "entry",
Init));
b.CreateAlignedStore(CGM.getNSConcreteGlobalBlock(),
- b.CreateStructGEP(literal, 0),
+ b.CreateStructGEP(literal->getValueType(), literal, 0),
CGM.getPointerAlign().getAsAlign());
b.CreateRetVoid();
// We can't use the normal LLVM global initialisation array, because we
/// Generate the name of a symbol for a reference to a class. Accesses to
/// classes should be indirected via this.
- typedef std::pair<std::string, std::pair<llvm::Constant*, int>> EarlyInitPair;
+ typedef std::pair<std::string, std::pair<llvm::GlobalVariable*, int>>
+ EarlyInitPair;
std::vector<EarlyInitPair> EarlyInitList;
std::string SymbolForClassRef(StringRef Name, bool isWeak) {
}
}
}
- auto *ObjCStrGV =
+ llvm::GlobalVariable *ObjCStrGV =
Fields.finishAndCreateGlobal(
isNamed ? StringRef(StringName) : ".objc_string",
Align, false, isNamed ? llvm::GlobalValue::LinkOnceODRLinkage
ObjCStrGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
}
if (CGM.getTriple().isOSBinFormatCOFF()) {
- std::pair<llvm::Constant*, int> v{ObjCStrGV, 0};
+ std::pair<llvm::GlobalVariable*, int> v{ObjCStrGV, 0};
EarlyInitList.emplace_back(Sym, v);
}
llvm::Constant *ObjCStr = llvm::ConstantExpr::getBitCast(ObjCStrGV, IdTy);
for (const auto &lateInit : EarlyInitList) {
auto *global = TheModule.getGlobalVariable(lateInit.first);
if (global) {
+ llvm::GlobalVariable *GV = lateInit.second.first;
b.CreateAlignedStore(
global,
- b.CreateStructGEP(lateInit.second.first, lateInit.second.second),
+ b.CreateStructGEP(GV->getValueType(), GV, lateInit.second.second),
CGM.getPointerAlign().getAsAlign());
}
}
// struct objc_property_list *properties
classFields.add(GeneratePropertyList(OID, classDecl));
- auto *classStruct =
+ llvm::GlobalVariable *classStruct =
classFields.finishAndCreateGlobal(SymbolForClass(className),
CGM.getPointerAlign(), false, llvm::GlobalValue::ExternalLinkage);
if (IsCOFF) {
// we can't import a class struct.
if (OID->getClassInterface()->hasAttr<DLLExportAttr>()) {
- cast<llvm::GlobalValue>(classStruct)->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
+ classStruct->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
cast<llvm::GlobalValue>(classRefSymbol)->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
}
if (SuperClass) {
- std::pair<llvm::Constant*, int> v{classStruct, 1};
+ std::pair<llvm::GlobalVariable*, int> v{classStruct, 1};
EarlyInitList.emplace_back(std::string(SuperClass->getName()),
std::move(v));
}