[clang] [CIR][CUDA] Handle local, __device__, and __shared__ variables (PR #184248)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 13:48:49 PST 2026


================
@@ -797,6 +797,22 @@ CIRGenModule::getOrCreateCIRGlobal(StringRef mangledName, mlir::Type ty,
                "external const declaration with initializer");
   }
 
+  // TODO(cir): if this method is used to handle functions we must have
+  // something closer to GlobalValue::isDeclaration instead of checking for
+  // initializer.
+  if (gv.isDeclaration()) {
----------------
andykaylor wrote:

Classic codegen is doing this here:

```
  if (D &&
      D->isThisDeclarationADefinition(Context) == VarDecl::DeclarationOnly) {
```
Is there a reason we shouldn't do that instead of calling `gv.isDeclaration()`?

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


More information about the cfe-commits mailing list