[PATCH] D146418: Support for OpenMP 5.0 sec 2.12.7 - Declare Target initializer expressions
Ritanya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 20 07:06:28 PDT 2023
RitanyaB added inline comments.
================
Comment at: clang/lib/Parse/ParseDecl.cpp:2107
+ DeclVar->addAttr(TargetDecl->getAttr<OMPDeclareTargetDeclAttr>());
+ ParseImplicitDeclareTargetAttr(DeclVar);
+ }
----------------
ABataev wrote:
> Try to avoid recursion here
Consider the following example-
```static int var1 = 10;
static int *var2 = &var1;
#pragma omp declare target
int **ptr1=&var2;
#pragma omp end declare target
```
In this case, by default ptr1 gets OMPDeclareTargetDeclAttr and the function mentioned above (ParseImplicitDeclareTargetAttr) would add OMPDeclareTargetDeclAttr to var2. But, in order to add OMPDeclareTargetDeclAttr to var1, recursion would be required.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146418/new/
https://reviews.llvm.org/D146418
More information about the cfe-commits
mailing list