[flang-commits] [flang] RFC: WIP: add support for compiler directives which apply to functions (PR #75352)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Dec 13 09:06:37 PST 2023


================
@@ -111,6 +111,9 @@ static ProgramTree BuildModuleTree(const parser::Name &name, const T &x) {
   if (subps) {
     for (const auto &subp :
         std::get<std::list<parser::ModuleSubprogram>>(subps->t)) {
+      if (std::holds_alternative<
----------------
klausler wrote:

We always use braces for `if`/`for`/`while` &c. in semantics and other bits of the frontend that use safer modern C++ practices.  But in this case it would be even better to handle the new variant alternative within the call to `visit` below as a no-op.

```
common::visit(common::visitors{
  [](const common::Indirection<parser::CompilerDirective> &){},
  [&](const auto &y) { node.AddChild(ProgramTree::Build(y.value())); },
}, subp.u);
```

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


More information about the flang-commits mailing list