[PATCH] D146418: Support for OpenMP 5.0 sec 2.12.7 - Declare Target initializer expressions
Alexey Bataev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 20 07:15:02 PDT 2023
ABataev added inline comments.
================
Comment at: clang/lib/Parse/ParseDecl.cpp:2107
+ DeclVar->addAttr(TargetDecl->getAttr<OMPDeclareTargetDeclAttr>());
+ ParseImplicitDeclareTargetAttr(DeclVar);
+ }
----------------
RitanyaB wrote:
> 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.
I do not ask to remove it, but use extra memory (SamllVector) to save the decls, requiring analysis, and iterate through this vector.
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