[flang-commits] [flang] [flang] [cuda] Move SetImplicityCUDADevice after symbols in block construct are converted to objects (PR #143791)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Jun 12 07:44:25 PDT 2025


================
@@ -2828,6 +2828,17 @@ Scope &ScopeHandler::NonDerivedTypeScope() {
   return currScope_->IsDerivedType() ? currScope_->parent() : *currScope_;
 }
 
+static void SetImplicitCUDADevice(bool inDeviceSubprogram, Symbol &symbol) {
+  if (inDeviceSubprogram && symbol.has<ObjectEntityDetails>()) {
----------------
klausler wrote:

If the condition is removed to the call site, these lines can be simplified to
```
if (auto *object{symbol.detailsIf<ObjectEntityDetails>}) { ...
```

Otherwise, this pointer should be a reference from `symbol.get<ObjectEntityDetails>()` since it can't be null.

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


More information about the flang-commits mailing list