[clang] [llvm] Trying to fix undefined symbol error caused by iterator variable (PR #141507)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 06:40:56 PDT 2025
================
@@ -2969,6 +2969,11 @@ static LValue EmitGlobalVarDeclLValue(CodeGenFunction &CGF,
llvm::Value *V = CGF.CGM.GetAddrOfGlobalVar(VD);
+ if (VD->hasAttr<OMPIteratorAttr>()) {
+ llvm::GlobalVariable *Var = llvm::dyn_cast<llvm::GlobalVariable>(V);
+ Var->setInitializer(CGF.CGM.EmitNullConstant(E->getType()));
----------------
ShashwathiNavada wrote:
> This is not the place to set an initializer for a variable.
>
> For most variable definitions, there's a single location where it makes sense to "define" the variable.
Thank you for the response, I have moved the definition. Does it look good now?
https://github.com/llvm/llvm-project/pull/141507
More information about the cfe-commits
mailing list