[flang-commits] [flang] [flang][pft] visit original symbol in acc use_device (PR #194588)
via flang-commits
flang-commits at lists.llvm.org
Tue Apr 28 07:07:54 PDT 2026
================
@@ -2221,6 +2221,25 @@ struct SymbolVisitor {
return false;
}
+ bool Pre(const Fortran::parser::AccClause::UseDevice &useDevice) {
+ // For use_device, each symbol's parser Name has been given a local copy
+ // of the symbol with the DEVICE attribute. The original symbol will be
+ // needed in lowering and may not appear in the parse tree of the function
+ // anymore. Visit it now: it is not directly accessible from the construct
+ // symbol, so the parent scope must be searched to find it.
+ for (const auto &accObject : useDevice.v.v) {
+ if (const semantics::Symbol *deviceSym =
+ Fortran::parser::GetFirstName(accObject).symbol) {
+ if (const semantics::Symbol *hostSym =
+ deviceSym->owner().parent().FindSymbol(deviceSym->name()))
----------------
jeanPerier wrote:
Yes, I added a submodule test and a test where a local is shadowing the module variable. Thanks for your attention to testing and the great suggestions!
https://github.com/llvm/llvm-project/pull/194588
More information about the flang-commits
mailing list