[clang] Trying to fix undefined symbol error caused by iterator variable (PR #141507)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 26 10:01:34 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/CodeGen/CGExpr.cpp clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/declare_mapper_codegen.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 116317c14..dfa34f77b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3011,8 +3011,8 @@ 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()));
+    llvm::GlobalVariable *Var = llvm::dyn_cast<llvm::GlobalVariable>(V);
+    Var->setInitializer(CGF.CGM.EmitNullConstant(E->getType()));
   }
 
   if (VD->getTLSKind() != VarDecl::TLS_None)
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 1756c20ce..7eaabae14 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -24476,8 +24476,8 @@ ExprResult SemaOpenMP::ActOnOMPIteratorExpr(Scope *S,
         VarDecl::Create(Context, SemaRef.CurContext, StartLoc, D.DeclIdentLoc,
                         D.DeclIdent, DeclTy, TInfo, SC_None);
     VD->setImplicit();
-    VD->addAttr(OMPIteratorAttr::CreateImplicit(
-        Context, SourceRange(StartLoc)));
+    VD->addAttr(
+        OMPIteratorAttr::CreateImplicit(Context, SourceRange(StartLoc)));
     if (S) {
       // Check for conflicting previous declaration.
       DeclarationNameInfo NameInfo(VD->getDeclName(), D.DeclIdentLoc);

``````````

</details>


https://github.com/llvm/llvm-project/pull/141507


More information about the cfe-commits mailing list