[flang-commits] [flang] [flang][debug] Fix build after fir.global linkage became a typed enum (PR #220280)
Abid Qadeer via flang-commits
flang-commits at lists.llvm.org
Tue Sep 1 08:54:16 PDT 2026
https://github.com/abidh created https://github.com/llvm/llvm-project/pull/220280
#220243 replaced the string `linkName` on `fir.global` with a typed
`fir::LinkageAttr`, so `GlobalOp::getLinkName()` no longer exists.
It landed 46 minutes before #215369 was merged, and the two changes touch
disjoint sets of files: #220243 never touched `AddDebugInfo.cpp`, and
#215369 added the only `getLinkName()` call in it. They merged cleanly with
no textual conflict, and main is currently unable to build flang:
```
flang/lib/Optimizer/Transforms/AddDebugInfo.cpp:564:39: error:
'class fir::GlobalOp' has no member named 'getLinkName';
did you mean 'getLinkage'?
```
Use the typed accessor, matching what #220243 did for the same idiom in
`CUFDeviceGlobal.cpp`.
This is offered in place of reverting #215369 (#220272), since the rest of
that change is unaffected by the rename. `flang/test/Transforms` and
`flang/test/Integration` pass locally.
Made with [Cursor](https://cursor.com)
>From 950fda0045440f3fd1f93f1e9f342095c2c79c66 Mon Sep 17 00:00:00 2001
From: Abid Qadeer <haqadeer at amd.com>
Date: Tue, 1 Sep 2026 16:52:05 +0100
Subject: [PATCH] [flang][debug] Fix build after fir.global linkage became a
typed enum
#220243 replaced the string linkName on fir.global with a fir::LinkageAttr,
so getLinkName() no longer exists. It landed 46 minutes before #215369 was
merged, and touched no file that #215369 touched, so the two merged cleanly
and left main unable to build.
Use the typed accessor, matching what #220243 did for the same idiom in
CUFDeviceGlobal.cpp.
Co-authored-by: Cursor <cursoragent at cursor.com>
---
flang/lib/Optimizer/Transforms/AddDebugInfo.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
index 0847b4d5d3b89..8f1dc8dcfe3f6 100644
--- a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
+++ b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
@@ -561,7 +561,8 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
// declared inside a procedure, is not visible outside this compilation unit.
// It also needs no linkage name because there is no external symbol for a
// debugger to match it against.
- const bool isLocalToUnit = globalOp.getLinkName() == "internal";
+ const bool isLocalToUnit =
+ globalOp.getLinkage() == fir::LinkageEnum::Internal;
mlir::StringAttr linkageName =
isLocalToUnit ? mlir::StringAttr()
: mlir::StringAttr::get(context, globalOp.getName());
More information about the flang-commits
mailing list