[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 May 22 07:15:30 PDT 2023
ABataev added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:14475-14477
+ VD->hasGlobalStorage()) {
+ ActOnOpenMPDeclareTargetInitializer(D);
+ }
----------------
Remove braces
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23091
+class GlobalDeclRefChecker final
+ : public ConstStmtVisitor<GlobalDeclRefChecker> {
----------------
Please, add comments, describing the class and its functionality
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23095
+ Decl *TargetDecl;
+ void SetTargetDecl(Decl *TD) { TargetDecl = TD; }
+ bool CheckDeclVector() { return DeclVector.empty(); }
----------------
setTargetDecl
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23096
+ void SetTargetDecl(Decl *TD) { TargetDecl = TD; }
+ bool CheckDeclVector() { return DeclVector.empty(); }
+ void pushDecl(VarDecl *TargetVarDecl) { DeclVector.push_back(TargetVarDecl); }
----------------
1. checkDeclVector
2. const member function
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23098
+ void pushDecl(VarDecl *TargetVarDecl) { DeclVector.push_back(TargetVarDecl); }
+ VarDecl *popDecl() { return DeclVector.pop_back_val(); }
+
----------------
const member function
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23104
+ VD->addAttr(this->TargetDecl->getAttr<OMPDeclareTargetDeclAttr>());
+ this->pushDecl(VD);
+ }
----------------
Remove this->
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:23113
+ }
+ void DeclTargetInitializer(Decl *TD) {
+ SetTargetDecl(TD);
----------------
1. Better to make it static member function.
2. Follow the rules for function names.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146418/new/
https://reviews.llvm.org/D146418
More information about the cfe-commits
mailing list