[clang] Set dllimport on Objective C ivar offsets (PR #107604)
Frederik Carlier via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 7 03:46:23 PDT 2024
================
@@ -1699,11 +1699,18 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
llvm::Value *EmitIvarOffset(CodeGenFunction &CGF,
const ObjCInterfaceDecl *Interface,
const ObjCIvarDecl *Ivar) override {
- const std::string Name = GetIVarOffsetVariableName(Ivar->getContainingInterface(), Ivar);
+ const ObjCInterfaceDecl *ContainingInterface =
+ Ivar->getContainingInterface();
+ const std::string Name =
+ GetIVarOffsetVariableName(ContainingInterface, Ivar);
llvm::GlobalVariable *IvarOffsetPointer = TheModule.getNamedGlobal(Name);
- if (!IvarOffsetPointer)
+ if (!IvarOffsetPointer) {
IvarOffsetPointer = new llvm::GlobalVariable(TheModule, IntTy, false,
llvm::GlobalValue::ExternalLinkage, nullptr, Name);
+ if (Ivar->getAccessControl() != ObjCIvarDecl::Private &&
+ Ivar->getAccessControl() != ObjCIvarDecl::Package)
----------------
qmfrederik wrote:
I think the added tests demonstrate that unmarked ivars are considered protected, so let me know if that resolves this comment?
https://github.com/llvm/llvm-project/pull/107604
More information about the cfe-commits
mailing list