ABataev added inline comments.

================
Comment at: clang/lib/Parse/ParseDecl.cpp:2093-2115
+void ParseImplicitDeclareTargetAttr(Decl *TargetDecl) {
+  if (TargetDecl && TargetDecl->hasAttr<OMPDeclareTargetDeclAttr>() &&
+      isa<VarDecl>(TargetDecl)) {
+    VarDecl *TargetVarDecl = cast<VarDecl>(TargetDecl);
+    Expr *Ex = TargetVarDecl->getInit()->IgnoreCasts();
+    const DeclRefExpr *DeclRef = nullptr;
+    if (Ex && isa<UnaryOperator>(Ex) && TargetVarDecl->hasGlobalStorage()) {
----------------
It has nothing to do with parsing, sema analysis. Make it part of 
Sema::checkDeclIsAllowedInOpenMPTarget


================
Comment at: clang/lib/Parse/ParseDecl.cpp:2107
+              
DeclVar->addAttr(TargetDecl->getAttr<OMPDeclareTargetDeclAttr>());
+              ParseImplicitDeclareTargetAttr(DeclVar);
+            }
----------------
Try to avoid recursion here


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