[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
Tue May 30 09:13:38 PDT 2023


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23106
+class GlobalDeclRefChecker final
+    : public ConstStmtVisitor<GlobalDeclRefChecker> {
+  SmallVector<VarDecl *> DeclVector;
----------------
Use just a StmtVisitor, if you still dropping const modifier.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23114
+  void VisitDeclRefExpr(const DeclRefExpr *Node) {
+    if (auto *VD = const_cast<VarDecl *>(dyn_cast<VarDecl>(Node->getDecl()))) {
+      VD->addAttr(A);
----------------
remove const_cast


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23131
+    A = TD->getAttr<OMPDeclareTargetDeclAttr>();
+    DeclVector.push_back(dyn_cast<VarDecl>(TD));
+    while (!DeclVector.empty()) {
----------------
You don't need to use dyn_cast here, use just cast


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146418/new/

https://reviews.llvm.org/D146418



More information about the cfe-commits mailing list