|
@@ -3810,14 +3810,13 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|
if (!CFConstantStringClassRef) {
|
|
if (!CFConstantStringClassRef) {
|
|
llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy);
|
|
llvm::Type *Ty = getTypes().ConvertType(getContext().IntTy);
|
|
Ty = llvm::ArrayType::get(Ty, 0);
|
|
Ty = llvm::ArrayType::get(Ty, 0);
|
|
- llvm::Constant *GV =
|
|
|
|
- CreateRuntimeVariable(Ty, "__CFConstantStringClassReference");
|
|
|
|
|
|
+ llvm::GlobalValue *GV = cast<llvm::GlobalValue>(
|
|
|
|
+ CreateRuntimeVariable(Ty, "__CFConstantStringClassReference"));
|
|
|
|
|
|
if (getTriple().isOSBinFormatCOFF()) {
|
|
if (getTriple().isOSBinFormatCOFF()) {
|
|
IdentifierInfo &II = getContext().Idents.get(GV->getName());
|
|
IdentifierInfo &II = getContext().Idents.get(GV->getName());
|
|
TranslationUnitDecl *TUDecl = getContext().getTranslationUnitDecl();
|
|
TranslationUnitDecl *TUDecl = getContext().getTranslationUnitDecl();
|
|
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
|
DeclContext *DC = TranslationUnitDecl::castToDeclContext(TUDecl);
|
|
- llvm::GlobalValue *CGV = cast<llvm::GlobalValue>(GV);
|
|
|
|
|
|
|
|
const VarDecl *VD = nullptr;
|
|
const VarDecl *VD = nullptr;
|
|
for (const auto &Result : DC->lookup(&II))
|
|
for (const auto &Result : DC->lookup(&II))
|
|
@@ -3825,13 +3824,14 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
|
|
break;
|
|
break;
|
|
|
|
|
|
if (!VD || !VD->hasAttr<DLLExportAttr>()) {
|
|
if (!VD || !VD->hasAttr<DLLExportAttr>()) {
|
|
- CGV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
|
|
|
|
- CGV->setLinkage(llvm::GlobalValue::ExternalLinkage);
|
|
|
|
|
|
+ GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
|
|
|
|
+ GV->setLinkage(llvm::GlobalValue::ExternalLinkage);
|
|
} else {
|
|
} else {
|
|
- CGV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
|
|
|
|
- CGV->setLinkage(llvm::GlobalValue::ExternalLinkage);
|
|
|
|
|
|
+ GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
|
|
|
|
+ GV->setLinkage(llvm::GlobalValue::ExternalLinkage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ setDSOLocal(GV);
|
|
|
|
|
|
// Decay array -> ptr
|
|
// Decay array -> ptr
|
|
CFConstantStringClassRef =
|
|
CFConstantStringClassRef =
|