[flang-commits] [flang] [flang][openacc] Allow open acc routines from other modules. (PR #136012)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Tue May 6 09:17:02 PDT 2025
================
@@ -1034,61 +1034,53 @@ void AccAttributeVisitor::AddRoutineInfoToSymbol(
Symbol &symbol, const parser::OpenACCRoutineConstruct &x) {
if (symbol.has<SubprogramDetails>()) {
Fortran::semantics::OpenACCRoutineInfo info;
+ std::vector<OpenACCRoutineDeviceTypeInfo *> currentDevices;
+ currentDevices.push_back(&info);
const auto &clauses = std::get<Fortran::parser::AccClauseList>(x.t);
for (const Fortran::parser::AccClause &clause : clauses.v) {
- if (std::get_if<Fortran::parser::AccClause::Seq>(&clause.u)) {
- if (info.deviceTypeInfos().empty()) {
- info.set_isSeq();
- } else {
- info.deviceTypeInfos().back().set_isSeq();
- }
+ if (const auto *dTypeClause =
+ std::get_if<Fortran::parser::AccClause::DeviceType>(&clause.u)) {
+ currentDevices.clear();
+ for (const auto &deviceTypeExpr : dTypeClause->v.v)
+ currentDevices.push_back(&info.add_deviceTypeInfo(deviceTypeExpr.v));
+ } else if (std::get_if<Fortran::parser::AccClause::Nohost>(&clause.u)) {
+ info.set_isNohost();
+ } else if (std::get_if<Fortran::parser::AccClause::Seq>(&clause.u)) {
+ for (auto &device : currentDevices)
----------------
klausler wrote:
Always use braces around the bodies of `if`, `for`, `while`, &c. in Semantics.
https://github.com/llvm/llvm-project/pull/136012
More information about the flang-commits
mailing list