================
@@ -266,7 +266,7 @@ SemaCUDA::CUDAVariableTarget SemaCUDA::IdentifyTarget(const
VarDecl *Var) {
// attribute are emitted
// - on both sides in host device functions
// - on device side in device or global functions
- if (auto *FD = dyn_cast<FunctionDecl>(Var->getDeclContext())) {
+ if (auto *FD = Var->getDeclContext()->getEnclosingFunction()) {
----------------
Fznamznon wrote:
NIT: that is not entirely obvious that the result is a `FunctionDecl`, so maybe
it is worth spelling out the type
```suggestion
if (FunctionDecl *FD = Var->getDeclContext()->getEnclosingFunction()) {
```
https://github.com/llvm/llvm-project/pull/236605
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits