ABataev added inline comments.

================
Comment at: clang/lib/Sema/SemaDecl.cpp:14473
+      // directive and has static storage duration.
+      if (auto *VD = dyn_cast_or_null<VarDecl>(D);
+          LangOpts.OpenMP && VD && VD->hasAttr<OMPDeclareTargetDeclAttr>() &&
----------------
В is already checked that is not nullptr, so just a dyn_cast should be enough


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23094-23095
+public:
+  SmallVector<Decl *> DeclVector;
+  Decl *TargetDecl;
+  void VisitDeclRefExpr(const DeclRefExpr *Node) {
----------------
Why public?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23098
+    Decl *DeclVar = nullptr;
+    if (const VarDecl *VD = dyn_cast<VarDecl>(Node->getDecl())) {
+      DeclVar = (Decl *)Node->getDecl();
----------------
const auto *VD


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23099
+    if (const VarDecl *VD = dyn_cast<VarDecl>(Node->getDecl())) {
+      DeclVar = (Decl *)Node->getDecl();
+      
DeclVar->addAttr((this->TargetDecl)->getAttr<OMPDeclareTargetDeclAttr>());
----------------
Use VD instead of this and drop const


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23100-23101
+      DeclVar = (Decl *)Node->getDecl();
+      
DeclVar->addAttr((this->TargetDecl)->getAttr<OMPDeclareTargetDeclAttr>());
+      (this->DeclVector).push_back(DeclVar);
+    }
----------------
Drop this and extra parens


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23107-23110
+      if (isa<Expr>(*it))
+        VisitExpr(dyn_cast<Expr>(*it));
+      if (isa<DeclRefExpr>(*it))
+        Visit(*it);
----------------
Just Visit(*it)?


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