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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to