[flang-commits] [flang] [flang][OpenMP] Add semantic check for device clause (PR #72789)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Sun Nov 19 00:19:42 PST 2023


================
@@ -2748,6 +2748,16 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Device &x) {
   const auto &device{std::get<1>(deviceClause.t)};
   RequiresPositiveParameter(
       llvm::omp::Clause::OMPC_device, device, "device expression");
+  auto modifier = std::get<0>(x.v.t);
+  if (modifier.has_value() &&
+      modifier.value() == parser::OmpDeviceClause::DeviceModifier::Ancestor) {
----------------
kiranchandramohan wrote:

```suggestion
  if (modifier &&
      *modifier == parser::OmpDeviceClause::DeviceModifier::Ancestor) {
```

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


More information about the flang-commits mailing list