[clang] [OpenMP][clang][HIP][CUDA] fix weak alias emit on device compilation (PR #164326)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 24 13:58:44 PDT 2025


================
@@ -4065,8 +4065,40 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
 
   // If this is an alias definition (which otherwise looks like a declaration)
   // emit it now.
-  if (Global->hasAttr<AliasAttr>())
+  if (Global->hasAttr<AliasAttr>()) {
+    if (LangOpts.OpenMPIsTargetDevice || LangOpts.CUDA) {
+      const auto *AA = Global->getAttr<AliasAttr>();
+      assert(AA && "Not an alias?");
----------------
Jason-VanBeusekom wrote:

Removed in:[16c1a68](https://github.com/llvm/llvm-project/pull/164326/commits/16c1a6888b87644f24c07a75c067d9e25eb1ac3e)

I copied this from `EmitAliasDefinition` which does not check with `Global->hasAttr<AliasAttr>()`

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


More information about the cfe-commits mailing list