diff --git a/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp b/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp --- a/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp +++ b/clang-tools-extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp @@ -24,7 +24,7 @@ void UseDefaultNoneCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( ompExecutableDirective( - allOf(isAllowedToContainClauseKind(OMPC_default), + allOf(isAllowedToContainClauseKind(llvm::omp::OMPC_default), anyOf(unless(hasAnyClause(ompDefaultClause())), hasAnyClause(ompDefaultClause(unless(isNoneKind())) .bind("clause"))))) diff --git a/clang/include/clang/AST/ASTFwd.h b/clang/include/clang/AST/ASTFwd.h --- a/clang/include/clang/AST/ASTFwd.h +++ b/clang/include/clang/AST/ASTFwd.h @@ -27,8 +27,8 @@ #include "clang/AST/TypeNodes.inc" class CXXCtorInitializer; class OMPClause; -#define OPENMP_CLAUSE(KIND, CLASSNAME) class CLASSNAME; -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class; +#include "llvm/Frontend/OpenMP/OMPKinds.def" } // end namespace clang diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h --- a/clang/include/clang/AST/ASTTypeTraits.h +++ b/clang/include/clang/AST/ASTTypeTraits.h @@ -148,8 +148,8 @@ #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type, #include "clang/AST/TypeNodes.inc" NKI_OMPClause, -#define OPENMP_CLAUSE(TextualSpelling, Class) NKI_##Class, -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class, +#include "llvm/Frontend/OpenMP/OMPKinds.def" NKI_NumberOfKinds }; @@ -204,8 +204,8 @@ #include "clang/AST/StmtNodes.inc" #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type) #include "clang/AST/TypeNodes.inc" -#define OPENMP_CLAUSE(TextualSpelling, Class) KIND_TO_KIND_ID(Class) -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class) +#include "llvm/Frontend/OpenMP/OMPKinds.def" #undef KIND_TO_KIND_ID inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) { diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -285,12 +285,13 @@ /// \param EndLoc Ending location of the clause. OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_allocator, StartLoc, EndLoc), LParenLoc(LParenLoc), - Allocator(A) {} + : OMPClause(llvm::omp::OMPC_allocator, StartLoc, EndLoc), + LParenLoc(LParenLoc), Allocator(A) {} /// Build an empty clause. OMPAllocatorClause() - : OMPClause(OMPC_allocator, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_allocator, SourceLocation(), + SourceLocation()) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -315,7 +316,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_allocator; + return T->getClauseKind() == llvm::omp::OMPC_allocator; } }; @@ -350,17 +351,17 @@ OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc, Expr *Allocator, SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_allocate, StartLoc, LParenLoc, - EndLoc, N), + : OMPVarListClause(llvm::omp::OMPC_allocate, StartLoc, + LParenLoc, EndLoc, N), Allocator(Allocator), ColonLoc(ColonLoc) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPAllocateClause(unsigned N) - : OMPVarListClause(OMPC_allocate, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_allocate, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} /// Sets location of ':' symbol in clause. void setColonLoc(SourceLocation CL) { ColonLoc = CL; } @@ -412,7 +413,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_allocate; + return T->getClauseKind() == llvm::omp::OMPC_allocate; } }; @@ -470,15 +471,16 @@ OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc) - : OMPClause(OMPC_if, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Condition(Cond), ColonLoc(ColonLoc), - NameModifier(NameModifier), NameModifierLoc(NameModifierLoc) { + : OMPClause(llvm::omp::OMPC_if, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Condition(Cond), + ColonLoc(ColonLoc), NameModifier(NameModifier), + NameModifierLoc(NameModifierLoc) { setPreInitStmt(HelperCond, CaptureRegion); } /// Build an empty clause. OMPIfClause() - : OMPClause(OMPC_if, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_if, SourceLocation(), SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -512,7 +514,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_if; + return T->getClauseKind() == llvm::omp::OMPC_if; } }; @@ -548,14 +550,14 @@ OMPFinalClause(Expr *Cond, Stmt *HelperCond, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_final, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Condition(Cond) { + : OMPClause(llvm::omp::OMPC_final, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Condition(Cond) { setPreInitStmt(HelperCond, CaptureRegion); } /// Build an empty clause. OMPFinalClause() - : OMPClause(OMPC_final, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_final, SourceLocation(), SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -580,7 +582,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_final; + return T->getClauseKind() == llvm::omp::OMPC_final; } }; @@ -618,7 +620,7 @@ OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_num_threads, StartLoc, EndLoc), + : OMPClause(llvm::omp::OMPC_num_threads, StartLoc, EndLoc), OMPClauseWithPreInit(this), LParenLoc(LParenLoc), NumThreads(NumThreads) { setPreInitStmt(HelperNumThreads, CaptureRegion); @@ -626,7 +628,8 @@ /// Build an empty clause. OMPNumThreadsClause() - : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_num_threads, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -652,7 +655,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_num_threads; + return T->getClauseKind() == llvm::omp::OMPC_num_threads; } }; @@ -688,12 +691,13 @@ /// \param EndLoc Ending location of the clause. OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc), - Safelen(Len) {} + : OMPClause(llvm::omp::OMPC_safelen, StartLoc, EndLoc), + LParenLoc(LParenLoc), Safelen(Len) {} /// Build an empty clause. explicit OMPSafelenClause() - : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_safelen, SourceLocation(), SourceLocation()) { + } /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -718,7 +722,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_safelen; + return T->getClauseKind() == llvm::omp::OMPC_safelen; } }; @@ -753,12 +757,13 @@ /// \param EndLoc Ending location of the clause. OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_simdlen, StartLoc, EndLoc), LParenLoc(LParenLoc), - Simdlen(Len) {} + : OMPClause(llvm::omp::OMPC_simdlen, StartLoc, EndLoc), + LParenLoc(LParenLoc), Simdlen(Len) {} /// Build an empty clause. explicit OMPSimdlenClause() - : OMPClause(OMPC_simdlen, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_simdlen, SourceLocation(), SourceLocation()) { + } /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -783,7 +788,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_simdlen; + return T->getClauseKind() == llvm::omp::OMPC_simdlen; } }; @@ -819,12 +824,13 @@ /// \param EndLoc Ending location of the clause. OMPCollapseClause(Expr *Num, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc), - NumForLoops(Num) {} + : OMPClause(llvm::omp::OMPC_collapse, StartLoc, EndLoc), + LParenLoc(LParenLoc), NumForLoops(Num) {} /// Build an empty clause. explicit OMPCollapseClause() - : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_collapse, SourceLocation(), + SourceLocation()) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -849,7 +855,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_collapse; + return T->getClauseKind() == llvm::omp::OMPC_collapse; } }; @@ -893,12 +899,13 @@ OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc), - Kind(A), KindKwLoc(ALoc) {} + : OMPClause(llvm::omp::OMPC_default, StartLoc, EndLoc), + LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} /// Build an empty clause. OMPDefaultClause() - : OMPClause(OMPC_default, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_default, SourceLocation(), SourceLocation()) { + } /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -928,7 +935,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_default; + return T->getClauseKind() == llvm::omp::OMPC_default; } }; @@ -974,12 +981,13 @@ OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc), - Kind(A), KindKwLoc(ALoc) {} + : OMPClause(llvm::omp::OMPC_proc_bind, StartLoc, EndLoc), + LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} /// Build an empty clause. OMPProcBindClause() - : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_proc_bind, SourceLocation(), + SourceLocation()) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -1009,7 +1017,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_proc_bind; + return T->getClauseKind() == llvm::omp::OMPC_proc_bind; } }; @@ -1029,11 +1037,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_unified_address, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_unified_address, StartLoc, EndLoc) {} /// Build an empty clause. OMPUnifiedAddressClause() - : OMPClause(OMPC_unified_address, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_unified_address, SourceLocation(), + SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1051,7 +1060,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_unified_address; + return T->getClauseKind() == llvm::omp::OMPC_unified_address; } }; @@ -1071,11 +1080,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_unified_shared_memory, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_unified_shared_memory, StartLoc, EndLoc) {} /// Build an empty clause. OMPUnifiedSharedMemoryClause() - : OMPClause(OMPC_unified_shared_memory, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_unified_shared_memory, SourceLocation(), + SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1093,7 +1103,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_unified_shared_memory; + return T->getClauseKind() == llvm::omp::OMPC_unified_shared_memory; } }; @@ -1113,11 +1123,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_reverse_offload, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_reverse_offload, StartLoc, EndLoc) {} /// Build an empty clause. OMPReverseOffloadClause() - : OMPClause(OMPC_reverse_offload, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_reverse_offload, SourceLocation(), + SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1135,7 +1146,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_reverse_offload; + return T->getClauseKind() == llvm::omp::OMPC_reverse_offload; } }; @@ -1155,12 +1166,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_dynamic_allocators, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_dynamic_allocators, StartLoc, EndLoc) {} /// Build an empty clause. OMPDynamicAllocatorsClause() - : OMPClause(OMPC_dynamic_allocators, SourceLocation(), SourceLocation()) { - } + : OMPClause(llvm::omp::OMPC_dynamic_allocators, SourceLocation(), + SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1178,7 +1189,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_dynamic_allocators; + return T->getClauseKind() == llvm::omp::OMPC_dynamic_allocators; } }; @@ -1230,12 +1241,12 @@ SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc), + : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, StartLoc, EndLoc), LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} /// Build an empty clause. OMPAtomicDefaultMemOrderClause() - : OMPClause(OMPC_atomic_default_mem_order, SourceLocation(), + : OMPClause(llvm::omp::OMPC_atomic_default_mem_order, SourceLocation(), SourceLocation()) {} /// Sets the location of '('. @@ -1268,7 +1279,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_atomic_default_mem_order; + return T->getClauseKind() == llvm::omp::OMPC_atomic_default_mem_order; } }; @@ -1387,9 +1398,9 @@ Expr *ChunkSize, Stmt *HelperChunkSize, OpenMPScheduleClauseModifier M1, SourceLocation M1Loc, OpenMPScheduleClauseModifier M2, SourceLocation M2Loc) - : OMPClause(OMPC_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc), - ChunkSize(ChunkSize) { + : OMPClause(llvm::omp::OMPC_schedule, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind), + KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) { setPreInitStmt(HelperChunkSize); Modifiers[FIRST] = M1; Modifiers[SECOND] = M2; @@ -1399,7 +1410,7 @@ /// Build an empty clause. explicit OMPScheduleClause() - : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_schedule, SourceLocation(), SourceLocation()), OMPClauseWithPreInit(this) { Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown; Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown; @@ -1461,7 +1472,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_schedule; + return T->getClauseKind() == llvm::omp::OMPC_schedule; } }; @@ -1496,12 +1507,12 @@ /// \param EndLoc Ending location of the clause. OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc), - NumForLoops(Num), NumberOfLoops(NumLoops) {} + : OMPClause(llvm::omp::OMPC_ordered, StartLoc, EndLoc), + LParenLoc(LParenLoc), NumForLoops(Num), NumberOfLoops(NumLoops) {} /// Build an empty clause. explicit OMPOrderedClause(unsigned NumLoops) - : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_ordered, SourceLocation(), SourceLocation()), NumberOfLoops(NumLoops) {} /// Set the number of associated for-loops. @@ -1557,7 +1568,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_ordered; + return T->getClauseKind() == llvm::omp::OMPC_ordered; } }; @@ -1574,11 +1585,11 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_nowait, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc) {} /// Build an empty clause. OMPNowaitClause() - : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1596,7 +1607,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_nowait; + return T->getClauseKind() == llvm::omp::OMPC_nowait; } }; @@ -1613,11 +1624,11 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_untied, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_untied, StartLoc, EndLoc) {} /// Build an empty clause. OMPUntiedClause() - : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_untied, SourceLocation(), SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1635,7 +1646,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_untied; + return T->getClauseKind() == llvm::omp::OMPC_untied; } }; @@ -1653,11 +1664,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_mergeable, StartLoc, EndLoc) {} /// Build an empty clause. OMPMergeableClause() - : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_mergeable, SourceLocation(), + SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1675,7 +1687,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_mergeable; + return T->getClauseKind() == llvm::omp::OMPC_mergeable; } }; @@ -1692,10 +1704,11 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_read, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_read, StartLoc, EndLoc) {} /// Build an empty clause. - OMPReadClause() : OMPClause(OMPC_read, SourceLocation(), SourceLocation()) {} + OMPReadClause() + : OMPClause(llvm::omp::OMPC_read, SourceLocation(), SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1713,7 +1726,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_read; + return T->getClauseKind() == llvm::omp::OMPC_read; } }; @@ -1730,11 +1743,11 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_write, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_write, StartLoc, EndLoc) {} /// Build an empty clause. OMPWriteClause() - : OMPClause(OMPC_write, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_write, SourceLocation(), SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1752,7 +1765,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_write; + return T->getClauseKind() == llvm::omp::OMPC_write; } }; @@ -1812,11 +1825,12 @@ /// \param EndLoc Ending location of the clause. OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc, bool IsExtended) - : OMPClause(OMPC_update, StartLoc, EndLoc), IsExtended(IsExtended) {} + : OMPClause(llvm::omp::OMPC_update, StartLoc, EndLoc), + IsExtended(IsExtended) {} /// Build an empty clause. OMPUpdateClause(bool IsExtended) - : OMPClause(OMPC_update, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_update, SourceLocation(), SourceLocation()), IsExtended(IsExtended) {} public: @@ -1886,7 +1900,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_update; + return T->getClauseKind() == llvm::omp::OMPC_update; } }; @@ -1904,11 +1918,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_capture, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_capture, StartLoc, EndLoc) {} /// Build an empty clause. OMPCaptureClause() - : OMPClause(OMPC_capture, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_capture, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1926,7 +1941,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_capture; + return T->getClauseKind() == llvm::omp::OMPC_capture; } }; @@ -1944,11 +1959,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_seq_cst, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_seq_cst, StartLoc, EndLoc) {} /// Build an empty clause. OMPSeqCstClause() - : OMPClause(OMPC_seq_cst, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_seq_cst, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -1966,7 +1982,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_seq_cst; + return T->getClauseKind() == llvm::omp::OMPC_seq_cst; } }; @@ -1984,11 +2000,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_acq_rel, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_acq_rel, StartLoc, EndLoc) {} /// Build an empty clause. OMPAcqRelClause() - : OMPClause(OMPC_acq_rel, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_acq_rel, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -2006,7 +2023,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_acq_rel; + return T->getClauseKind() == llvm::omp::OMPC_acq_rel; } }; @@ -2024,11 +2041,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_acquire, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_acquire, StartLoc, EndLoc) {} /// Build an empty clause. OMPAcquireClause() - : OMPClause(OMPC_acquire, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_acquire, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -2046,7 +2064,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_acquire; + return T->getClauseKind() == llvm::omp::OMPC_acquire; } }; @@ -2064,11 +2082,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_release, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_release, StartLoc, EndLoc) {} /// Build an empty clause. OMPReleaseClause() - : OMPClause(OMPC_release, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_release, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -2086,7 +2105,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_release; + return T->getClauseKind() == llvm::omp::OMPC_release; } }; @@ -2104,11 +2123,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_relaxed, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_relaxed, StartLoc, EndLoc) {} /// Build an empty clause. OMPRelaxedClause() - : OMPClause(OMPC_relaxed, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_relaxed, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -2126,7 +2146,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_relaxed; + return T->getClauseKind() == llvm::omp::OMPC_relaxed; } }; @@ -2152,16 +2172,16 @@ /// \param N Number of the variables in the clause. OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_private, StartLoc, LParenLoc, - EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_private, StartLoc, + LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPPrivateClause(unsigned N) - : OMPVarListClause(OMPC_private, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_private, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} /// Sets the list of references to private copies with initializers for /// new private variables. @@ -2231,7 +2251,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_private; + return T->getClauseKind() == llvm::omp::OMPC_private; } }; @@ -2259,8 +2279,8 @@ /// \param N Number of the variables in the clause. OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_firstprivate, StartLoc, - LParenLoc, EndLoc, N), + : OMPVarListClause(llvm::omp::OMPC_firstprivate, + StartLoc, LParenLoc, EndLoc, N), OMPClauseWithPreInit(this) {} /// Build an empty clause. @@ -2268,7 +2288,7 @@ /// \param N Number of variables. explicit OMPFirstprivateClause(unsigned N) : OMPVarListClause( - OMPC_firstprivate, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_firstprivate, SourceLocation(), SourceLocation(), SourceLocation(), N), OMPClauseWithPreInit(this) {} @@ -2372,7 +2392,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_firstprivate; + return T->getClauseKind() == llvm::omp::OMPC_firstprivate; } }; @@ -2425,8 +2445,8 @@ SourceLocation EndLoc, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, unsigned N) - : OMPVarListClause(OMPC_lastprivate, StartLoc, - LParenLoc, EndLoc, N), + : OMPVarListClause(llvm::omp::OMPC_lastprivate, + StartLoc, LParenLoc, EndLoc, N), OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc), ColonLoc(ColonLoc) {} @@ -2435,7 +2455,7 @@ /// \param N Number of variables. explicit OMPLastprivateClause(unsigned N) : OMPVarListClause( - OMPC_lastprivate, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_lastprivate, SourceLocation(), SourceLocation(), SourceLocation(), N), OMPClauseWithPostUpdate(this) {} @@ -2611,7 +2631,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_lastprivate; + return T->getClauseKind() == llvm::omp::OMPC_lastprivate; } }; @@ -2636,16 +2656,16 @@ /// \param N Number of the variables in the clause. OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_shared, StartLoc, LParenLoc, - EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_shared, StartLoc, + LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPSharedClause(unsigned N) - : OMPVarListClause(OMPC_shared, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_shared, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} public: /// Creates clause with a list of variables \a VL. @@ -2683,7 +2703,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_shared; + return T->getClauseKind() == llvm::omp::OMPC_shared; } }; @@ -2734,8 +2754,8 @@ OpenMPReductionClauseModifier Modifier, unsigned N, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo) - : OMPVarListClause(OMPC_reduction, StartLoc, - LParenLoc, EndLoc, N), + : OMPVarListClause(llvm::omp::OMPC_reduction, + StartLoc, LParenLoc, EndLoc, N), OMPClauseWithPostUpdate(this), Modifier(Modifier), ModifierLoc(ModifierLoc), ColonLoc(ColonLoc), QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} @@ -2744,9 +2764,9 @@ /// /// \param N Number of variables. explicit OMPReductionClause(unsigned N) - : OMPVarListClause(OMPC_reduction, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_reduction, SourceLocation(), SourceLocation(), - N), + SourceLocation(), N), OMPClauseWithPostUpdate(this) {} /// Sets reduction modifier. @@ -2943,7 +2963,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_reduction; + return T->getClauseKind() == llvm::omp::OMPC_reduction; } }; @@ -2985,8 +3005,8 @@ SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo) - : OMPVarListClause(OMPC_task_reduction, StartLoc, - LParenLoc, EndLoc, N), + : OMPVarListClause( + llvm::omp::OMPC_task_reduction, StartLoc, LParenLoc, EndLoc, N), OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} @@ -2995,7 +3015,7 @@ /// \param N Number of variables. explicit OMPTaskReductionClause(unsigned N) : OMPVarListClause( - OMPC_task_reduction, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_task_reduction, SourceLocation(), SourceLocation(), SourceLocation(), N), OMPClauseWithPostUpdate(this) {} @@ -3175,7 +3195,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_task_reduction; + return T->getClauseKind() == llvm::omp::OMPC_task_reduction; } }; @@ -3216,8 +3236,8 @@ SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo) - : OMPVarListClause(OMPC_in_reduction, StartLoc, - LParenLoc, EndLoc, N), + : OMPVarListClause(llvm::omp::OMPC_in_reduction, + StartLoc, LParenLoc, EndLoc, N), OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} @@ -3226,7 +3246,7 @@ /// \param N Number of variables. explicit OMPInReductionClause(unsigned N) : OMPVarListClause( - OMPC_in_reduction, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_in_reduction, SourceLocation(), SourceLocation(), SourceLocation(), N), OMPClauseWithPostUpdate(this) {} @@ -3430,7 +3450,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_in_reduction; + return T->getClauseKind() == llvm::omp::OMPC_in_reduction; } }; @@ -3476,8 +3496,8 @@ OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, unsigned NumVars) - : OMPVarListClause(OMPC_linear, StartLoc, LParenLoc, - EndLoc, NumVars), + : OMPVarListClause(llvm::omp::OMPC_linear, StartLoc, + LParenLoc, EndLoc, NumVars), OMPClauseWithPostUpdate(this), Modifier(Modifier), ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {} @@ -3485,9 +3505,9 @@ /// /// \param NumVars Number of variables. explicit OMPLinearClause(unsigned NumVars) - : OMPVarListClause(OMPC_linear, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_linear, SourceLocation(), SourceLocation(), - NumVars), + SourceLocation(), NumVars), OMPClauseWithPostUpdate(this) {} /// Gets the list of initial values for linear variables. @@ -3707,7 +3727,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_linear; + return T->getClauseKind() == llvm::omp::OMPC_linear; } }; @@ -3742,17 +3762,17 @@ OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, unsigned NumVars) - : OMPVarListClause(OMPC_aligned, StartLoc, LParenLoc, - EndLoc, NumVars), + : OMPVarListClause(llvm::omp::OMPC_aligned, StartLoc, + LParenLoc, EndLoc, NumVars), ColonLoc(ColonLoc) {} /// Build an empty clause. /// /// \param NumVars Number of variables. explicit OMPAlignedClause(unsigned NumVars) - : OMPVarListClause(OMPC_aligned, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_aligned, SourceLocation(), SourceLocation(), - NumVars) {} + SourceLocation(), NumVars) {} public: /// Creates clause with a list of variables \a VL and alignment \a A. @@ -3806,7 +3826,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_aligned; + return T->getClauseKind() == llvm::omp::OMPC_aligned; } }; @@ -3845,16 +3865,16 @@ /// \param N Number of the variables in the clause. OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_copyin, StartLoc, LParenLoc, - EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_copyin, StartLoc, + LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPCopyinClause(unsigned N) - : OMPVarListClause(OMPC_copyin, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_copyin, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} /// Set list of helper expressions, required for proper codegen of the /// clause. These expressions represent source expression in the final @@ -3982,7 +4002,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_copyin; + return T->getClauseKind() == llvm::omp::OMPC_copyin; } }; @@ -4009,15 +4029,16 @@ /// \param N Number of the variables in the clause. OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_copyprivate, StartLoc, - LParenLoc, EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_copyprivate, + StartLoc, LParenLoc, EndLoc, N) { + } /// Build an empty clause. /// /// \param N Number of variables. explicit OMPCopyprivateClause(unsigned N) : OMPVarListClause( - OMPC_copyprivate, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_copyprivate, SourceLocation(), SourceLocation(), SourceLocation(), N) {} /// Set list of helper expressions, required for proper codegen of the @@ -4145,7 +4166,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_copyprivate; + return T->getClauseKind() == llvm::omp::OMPC_copyprivate; } }; @@ -4175,16 +4196,16 @@ /// \param N Number of the variables in the clause. OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_flush, StartLoc, LParenLoc, - EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_flush, StartLoc, + LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPFlushClause(unsigned N) - : OMPVarListClause(OMPC_flush, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_flush, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} public: /// Creates clause with a list of variables \a VL. @@ -4222,7 +4243,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_flush; + return T->getClauseKind() == llvm::omp::OMPC_flush; } }; @@ -4254,12 +4275,13 @@ /// \param EndLoc Ending location of the clause. OMPDepobjClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_depobj, StartLoc, EndLoc), LParenLoc(LParenLoc) {} + : OMPClause(llvm::omp::OMPC_depobj, StartLoc, EndLoc), + LParenLoc(LParenLoc) {} /// Build an empty clause. /// explicit OMPDepobjClause() - : OMPClause(OMPC_depobj, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_depobj, SourceLocation(), SourceLocation()) {} void setDepobj(Expr *E) { Depobj = E; } @@ -4308,7 +4330,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_depobj; + return T->getClauseKind() == llvm::omp::OMPC_depobj; } }; @@ -4349,8 +4371,9 @@ /// clause. OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N, unsigned NumLoops) - : OMPVarListClause(OMPC_depend, StartLoc, LParenLoc, - EndLoc, N), NumLoops(NumLoops) {} + : OMPVarListClause(llvm::omp::OMPC_depend, StartLoc, + LParenLoc, EndLoc, N), + NumLoops(NumLoops) {} /// Build an empty clause. /// @@ -4358,9 +4381,9 @@ /// \param NumLoops Number of loops that is associated with this depend /// clause. explicit OMPDependClause(unsigned N, unsigned NumLoops) - : OMPVarListClause(OMPC_depend, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_depend, SourceLocation(), SourceLocation(), - N), + SourceLocation(), N), NumLoops(NumLoops) {} /// Set dependency kind. @@ -4439,7 +4462,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_depend; + return T->getClauseKind() == llvm::omp::OMPC_depend; } }; @@ -4492,15 +4515,15 @@ OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc) - : OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Modifier(Modifier), ModifierLoc(ModifierLoc), - Device(E) { + : OMPClause(llvm::omp::OMPC_device, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Modifier(Modifier), + ModifierLoc(ModifierLoc), Device(E) { setPreInitStmt(HelperE, CaptureRegion); } /// Build an empty clause. OMPDeviceClause() - : OMPClause(OMPC_device, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_device, SourceLocation(), SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -4535,7 +4558,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_device; + return T->getClauseKind() == llvm::omp::OMPC_device; } }; @@ -4552,11 +4575,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_threads, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_threads, StartLoc, EndLoc) {} /// Build an empty clause. OMPThreadsClause() - : OMPClause(OMPC_threads, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_threads, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -4574,7 +4598,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_threads; + return T->getClauseKind() == llvm::omp::OMPC_threads; } }; @@ -4591,10 +4615,11 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_simd, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_simd, StartLoc, EndLoc) {} /// Build an empty clause. - OMPSIMDClause() : OMPClause(OMPC_simd, SourceLocation(), SourceLocation()) {} + OMPSIMDClause() + : OMPClause(llvm::omp::OMPC_simd, SourceLocation(), SourceLocation()) {} child_range children() { return child_range(child_iterator(), child_iterator()); @@ -4612,7 +4637,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_simd; + return T->getClauseKind() == llvm::omp::OMPC_simd; } }; @@ -5293,8 +5318,8 @@ OpenMPMapClauseKind MapType, bool MapTypeIsImplicit, SourceLocation MapLoc, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_map, Locs, Sizes, &MapperQualifierLoc, - &MapperIdInfo), + : OMPMappableExprListClause(llvm::omp::OMPC_map, Locs, Sizes, + &MapperQualifierLoc, &MapperIdInfo), MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) { assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() && "Unexpected number of map type modifiers."); @@ -5314,7 +5339,8 @@ /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_map, OMPVarListLocTy(), Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_map, OMPVarListLocTy(), + Sizes) {} /// Set map-type-modifier for the clause. /// @@ -5461,7 +5487,7 @@ static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_map; + return T->getClauseKind() == llvm::omp::OMPC_map; } }; @@ -5500,14 +5526,15 @@ OMPNumTeamsClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_num_teams, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), NumTeams(E) { + : OMPClause(llvm::omp::OMPC_num_teams, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), NumTeams(E) { setPreInitStmt(HelperE, CaptureRegion); } /// Build an empty clause. OMPNumTeamsClause() - : OMPClause(OMPC_num_teams, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_num_teams, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -5536,7 +5563,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_num_teams; + return T->getClauseKind() == llvm::omp::OMPC_num_teams; } }; @@ -5576,14 +5603,15 @@ OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_thread_limit, StartLoc, EndLoc), + : OMPClause(llvm::omp::OMPC_thread_limit, StartLoc, EndLoc), OMPClauseWithPreInit(this), LParenLoc(LParenLoc), ThreadLimit(E) { setPreInitStmt(HelperE, CaptureRegion); } /// Build an empty clause. OMPThreadLimitClause() - : OMPClause(OMPC_thread_limit, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_thread_limit, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -5612,7 +5640,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_thread_limit; + return T->getClauseKind() == llvm::omp::OMPC_thread_limit; } }; @@ -5651,14 +5679,14 @@ OMPPriorityClause(Expr *Priority, Stmt *HelperPriority, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_priority, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Priority(Priority) { + : OMPClause(llvm::omp::OMPC_priority, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Priority(Priority) { setPreInitStmt(HelperPriority, CaptureRegion); } /// Build an empty clause. OMPPriorityClause() - : OMPClause(OMPC_priority, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_priority, SourceLocation(), SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -5686,7 +5714,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_priority; + return T->getClauseKind() == llvm::omp::OMPC_priority; } }; @@ -5722,14 +5750,15 @@ OMPGrainsizeClause(Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_grainsize, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), Grainsize(Size) { + : OMPClause(llvm::omp::OMPC_grainsize, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Grainsize(Size) { setPreInitStmt(HelperSize, CaptureRegion); } /// Build an empty clause. explicit OMPGrainsizeClause() - : OMPClause(OMPC_grainsize, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_grainsize, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -5754,7 +5783,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_grainsize; + return T->getClauseKind() == llvm::omp::OMPC_grainsize; } }; @@ -5771,11 +5800,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_nogroup, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_nogroup, StartLoc, EndLoc) {} /// Build an empty clause. OMPNogroupClause() - : OMPClause(OMPC_nogroup, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_nogroup, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -5793,7 +5823,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_nogroup; + return T->getClauseKind() == llvm::omp::OMPC_nogroup; } }; @@ -5829,14 +5859,15 @@ OMPNumTasksClause(Expr *Size, Stmt *HelperSize, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_num_tasks, StartLoc, EndLoc), OMPClauseWithPreInit(this), - LParenLoc(LParenLoc), NumTasks(Size) { + : OMPClause(llvm::omp::OMPC_num_tasks, StartLoc, EndLoc), + OMPClauseWithPreInit(this), LParenLoc(LParenLoc), NumTasks(Size) { setPreInitStmt(HelperSize, CaptureRegion); } /// Build an empty clause. explicit OMPNumTasksClause() - : OMPClause(OMPC_num_tasks, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_num_tasks, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Sets the location of '('. @@ -5861,7 +5892,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_num_tasks; + return T->getClauseKind() == llvm::omp::OMPC_num_tasks; } }; @@ -5893,11 +5924,12 @@ /// \param EndLoc Ending location of the clause. OMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc), + : OMPClause(llvm::omp::OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc), Hint(Hint) {} /// Build an empty clause. - OMPHintClause() : OMPClause(OMPC_hint, SourceLocation(), SourceLocation()) {} + OMPHintClause() + : OMPClause(llvm::omp::OMPC_hint, SourceLocation(), SourceLocation()) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -5922,7 +5954,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_hint; + return T->getClauseKind() == llvm::omp::OMPC_hint; } }; @@ -5994,7 +6026,7 @@ SourceLocation EndLoc, OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, Stmt *HelperChunkSize) - : OMPClause(OMPC_dist_schedule, StartLoc, EndLoc), + : OMPClause(llvm::omp::OMPC_dist_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) { setPreInitStmt(HelperChunkSize); @@ -6002,7 +6034,8 @@ /// Build an empty clause. explicit OMPDistScheduleClause() - : OMPClause(OMPC_dist_schedule, SourceLocation(), SourceLocation()), + : OMPClause(llvm::omp::OMPC_dist_schedule, SourceLocation(), + SourceLocation()), OMPClauseWithPreInit(this) {} /// Get kind of the clause. @@ -6041,7 +6074,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_dist_schedule; + return T->getClauseKind() == llvm::omp::OMPC_dist_schedule; } }; @@ -6111,12 +6144,14 @@ SourceLocation MLoc, SourceLocation KLoc, SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind, OpenMPDefaultmapClauseModifier M) - : OMPClause(OMPC_defaultmap, StartLoc, EndLoc), LParenLoc(LParenLoc), - Modifier(M), ModifierLoc(MLoc), Kind(Kind), KindLoc(KLoc) {} + : OMPClause(llvm::omp::OMPC_defaultmap, StartLoc, EndLoc), + LParenLoc(LParenLoc), Modifier(M), ModifierLoc(MLoc), Kind(Kind), + KindLoc(KLoc) {} /// Build an empty clause. explicit OMPDefaultmapClause() - : OMPClause(OMPC_defaultmap, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_defaultmap, SourceLocation(), + SourceLocation()) {} /// Get kind of the clause. OpenMPDefaultmapClauseKind getDefaultmapKind() const { return Kind; } @@ -6153,7 +6188,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_defaultmap; + return T->getClauseKind() == llvm::omp::OMPC_defaultmap; } }; @@ -6191,8 +6226,8 @@ DeclarationNameInfo MapperIdInfo, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_to, Locs, Sizes, &MapperQualifierLoc, - &MapperIdInfo) {} + : OMPMappableExprListClause(llvm::omp::OMPC_to, Locs, Sizes, + &MapperQualifierLoc, &MapperIdInfo) {} /// Build an empty clause. /// @@ -6202,7 +6237,8 @@ /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_to, OMPVarListLocTy(), Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_to, OMPVarListLocTy(), + Sizes) {} /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6270,7 +6306,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_to; + return T->getClauseKind() == llvm::omp::OMPC_to; } }; @@ -6309,8 +6345,8 @@ DeclarationNameInfo MapperIdInfo, const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_from, Locs, Sizes, &MapperQualifierLoc, - &MapperIdInfo) {} + : OMPMappableExprListClause(llvm::omp::OMPC_from, Locs, Sizes, + &MapperQualifierLoc, &MapperIdInfo) {} /// Build an empty clause. /// @@ -6320,7 +6356,8 @@ /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_from, OMPVarListLocTy(), Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_from, OMPVarListLocTy(), + Sizes) {} /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6388,7 +6425,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_from; + return T->getClauseKind() == llvm::omp::OMPC_from; } }; @@ -6422,7 +6459,8 @@ /// NumComponents: total number of expression components in the clause. explicit OMPUseDevicePtrClause(const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_use_device_ptr, Locs, Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr, Locs, Sizes) { + } /// Build an empty clause. /// @@ -6432,8 +6470,8 @@ /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPUseDevicePtrClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_use_device_ptr, OMPVarListLocTy(), - Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_use_device_ptr, + OMPVarListLocTy(), Sizes) {} /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6551,7 +6589,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_use_device_ptr; + return T->getClauseKind() == llvm::omp::OMPC_use_device_ptr; } }; @@ -6585,7 +6623,7 @@ /// NumComponents: total number of expression components in the clause. explicit OMPIsDevicePtrClause(const OMPVarListLocTy &Locs, const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_is_device_ptr, Locs, Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr, Locs, Sizes) {} /// Build an empty clause. /// @@ -6595,8 +6633,8 @@ /// 3) NumComponentLists: number of component lists in this clause; and 4) /// NumComponents: total number of expression components in the clause. explicit OMPIsDevicePtrClause(const OMPMappableExprListSizeTy &Sizes) - : OMPMappableExprListClause(OMPC_is_device_ptr, OMPVarListLocTy(), - Sizes) {} + : OMPMappableExprListClause(llvm::omp::OMPC_is_device_ptr, + OMPVarListLocTy(), Sizes) {} /// Define the sizes of each trailing object array except the last one. This /// is required for TrailingObjects to work properly. @@ -6654,7 +6692,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_is_device_ptr; + return T->getClauseKind() == llvm::omp::OMPC_is_device_ptr; } }; @@ -6680,15 +6718,16 @@ /// \param N Number of the variables in the clause. OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_nontemporal, StartLoc, - LParenLoc, EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_nontemporal, + StartLoc, LParenLoc, EndLoc, N) { + } /// Build an empty clause. /// /// \param N Number of variables. explicit OMPNontemporalClause(unsigned N) : OMPVarListClause( - OMPC_nontemporal, SourceLocation(), SourceLocation(), + llvm::omp::OMPC_nontemporal, SourceLocation(), SourceLocation(), SourceLocation(), N) {} /// Get the list of privatied copies if the member expression was captured by @@ -6750,7 +6789,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_nontemporal; + return T->getClauseKind() == llvm::omp::OMPC_nontemporal; } }; @@ -6794,12 +6833,12 @@ OMPOrderClause(OpenMPOrderClauseKind A, SourceLocation ALoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_order, StartLoc, EndLoc), LParenLoc(LParenLoc), Kind(A), - KindKwLoc(ALoc) {} + : OMPClause(llvm::omp::OMPC_order, StartLoc, EndLoc), + LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} /// Build an empty clause. OMPOrderClause() - : OMPClause(OMPC_order, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_order, SourceLocation(), SourceLocation()) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -6829,7 +6868,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_order; + return T->getClauseKind() == llvm::omp::OMPC_order; } }; @@ -6847,11 +6886,12 @@ /// \param StartLoc Starting location of the clause. /// \param EndLoc Ending location of the clause. OMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc) - : OMPClause(OMPC_destroy, StartLoc, EndLoc) {} + : OMPClause(llvm::omp::OMPC_destroy, StartLoc, EndLoc) {} /// Build an empty clause. OMPDestroyClause() - : OMPClause(OMPC_destroy, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_destroy, SourceLocation(), SourceLocation()) { + } child_range children() { return child_range(child_iterator(), child_iterator()); @@ -6869,7 +6909,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_destroy; + return T->getClauseKind() == llvm::omp::OMPC_destroy; } }; @@ -6904,12 +6944,12 @@ /// \param EndLoc Ending location of the clause. OMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_detach, StartLoc, EndLoc), LParenLoc(LParenLoc), - Evt(Evt) {} + : OMPClause(llvm::omp::OMPC_detach, StartLoc, EndLoc), + LParenLoc(LParenLoc), Evt(Evt) {} /// Build an empty clause. OMPDetachClause() - : OMPClause(OMPC_detach, SourceLocation(), SourceLocation()) {} + : OMPClause(llvm::omp::OMPC_detach, SourceLocation(), SourceLocation()) {} /// Returns the location of '('. SourceLocation getLParenLoc() const { return LParenLoc; } @@ -6931,7 +6971,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_detach; + return T->getClauseKind() == llvm::omp::OMPC_detach; } }; @@ -6957,16 +6997,16 @@ /// \param N Number of the variables in the clause. OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_inclusive, StartLoc, - LParenLoc, EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_inclusive, + StartLoc, LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPInclusiveClause(unsigned N) - : OMPVarListClause(OMPC_inclusive, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_inclusive, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} public: /// Creates clause with a list of variables \a VL. @@ -7005,7 +7045,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_inclusive; + return T->getClauseKind() == llvm::omp::OMPC_inclusive; } }; @@ -7031,16 +7071,16 @@ /// \param N Number of the variables in the clause. OMPExclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) - : OMPVarListClause(OMPC_exclusive, StartLoc, - LParenLoc, EndLoc, N) {} + : OMPVarListClause(llvm::omp::OMPC_exclusive, + StartLoc, LParenLoc, EndLoc, N) {} /// Build an empty clause. /// /// \param N Number of variables. explicit OMPExclusiveClause(unsigned N) - : OMPVarListClause(OMPC_exclusive, SourceLocation(), + : OMPVarListClause(llvm::omp::OMPC_exclusive, SourceLocation(), SourceLocation(), - N) {} + SourceLocation(), N) {} public: /// Creates clause with a list of variables \a VL. @@ -7079,7 +7119,7 @@ } static bool classof(const OMPClause *T) { - return T->getClauseKind() == OMPC_exclusive; + return T->getClauseKind() == llvm::omp::OMPC_exclusive; } }; @@ -7092,17 +7132,20 @@ #define DISPATCH(CLASS) \ return static_cast(this)->Visit##CLASS(static_cast(S)) -#define OPENMP_CLAUSE(Name, Class) \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } -#include "clang/Basic/OpenMPKinds.def" +#include "llvm/Frontend/OpenMP/OMPKinds.def" RetTy Visit(PTR(OMPClause) S) { // Top switch clause: visit each OMPClause. switch (S->getClauseKind()) { - default: llvm_unreachable("Unknown clause kind!"); -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_ ## Name : return Visit ## Class(static_cast(S)); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case llvm::omp::Clause::Enum: \ + return Visit##Class(static_cast(S)); +#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ + case llvm::omp::Clause::Enum: \ + break; +#include "llvm/Frontend/OpenMP/OMPKinds.def" } } // Base case, ignore it. :) @@ -7131,8 +7174,9 @@ OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy) : OS(OS), Policy(Policy) {} -#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + void Visit##Class(Class *S); +#include "llvm/Frontend/OpenMP/OMPKinds.def" }; /// Helper data structure representing the traits in a match clause of an diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -534,8 +534,8 @@ bool TraverseOMPExecutableDirective(OMPExecutableDirective *S); bool TraverseOMPLoopDirective(OMPLoopDirective *S); bool TraverseOMPClause(OMPClause *C); -#define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) bool Visit##Class(Class *C); +#include "llvm/Frontend/OpenMP/OMPKinds.def" /// Process clauses with list of variables. template bool VisitOMPClauseList(T *Node); /// Process clauses with pre-initis. @@ -2956,17 +2956,14 @@ if (!C) return true; switch (C->getClauseKind()) { -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_##Name: \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case llvm::omp::Clause::Enum: \ TRY_TO(Visit##Class(static_cast(C))); \ break; -#include "clang/Basic/OpenMPKinds.def" - case OMPC_threadprivate: - case OMPC_uniform: - case OMPC_device_type: - case OMPC_match: - case OMPC_unknown: +#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ + case llvm::omp::Clause::Enum: \ break; +#include "llvm/Frontend/OpenMP/OMPKinds.def" } return true; } diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -7111,12 +7111,12 @@ /// #pragma omp for /// \endcode /// -/// `ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches -/// ``omp parallel`` and ``omp parallel for``. +/// `ompExecutableDirective(isAllowedToContainClause(llvm::omp::OMPC_default))`` +/// matches ``omp parallel`` and ``omp parallel for``. /// /// If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter /// should be passed as a quoted string. e.g., -/// ``isAllowedToContainClauseKind("OMPC_default").`` +/// ``isAllowedToContainClauseKind("llvm::omp::OMPC_default").`` AST_MATCHER_P(OMPExecutableDirective, isAllowedToContainClauseKind, OpenMPClauseKind, CKind) { return isAllowedClauseForDirective( diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -3242,8 +3242,13 @@ // This attribute has no spellings as it is only ever created implicitly. let Spellings = []; let SemaHandler = 0; - let Args = [UnsignedArgument<"CaptureKind">]; + let Args = [UnsignedArgument<"CaptureKindVal">]; let Documentation = [Undocumented]; + let AdditionalMembers = [{ + llvm::omp::Clause getCaptureKind() const { + return static_cast(getCaptureKindVal()); + } + }]; } def OMPReferencedVar : Attr { diff --git a/clang/include/clang/Basic/OpenMPKinds.h b/clang/include/clang/Basic/OpenMPKinds.h --- a/clang/include/clang/Basic/OpenMPKinds.h +++ b/clang/include/clang/Basic/OpenMPKinds.h @@ -23,16 +23,7 @@ using OpenMPDirectiveKind = llvm::omp::Directive; /// OpenMP clauses. -enum OpenMPClauseKind { -#define OPENMP_CLAUSE(Name, Class) \ - OMPC_##Name, -#include "clang/Basic/OpenMPKinds.def" - OMPC_threadprivate, - OMPC_uniform, - OMPC_device_type, - OMPC_match, - OMPC_unknown -}; +using OpenMPClauseKind = llvm::omp::Clause; /// OpenMP attributes for 'schedule' clause. enum OpenMPScheduleClauseKind { @@ -175,9 +166,6 @@ OMPC_REDUCTION_unknown, }; -OpenMPClauseKind getOpenMPClauseKind(llvm::StringRef Str); -const char *getOpenMPClauseName(OpenMPClauseKind Kind); - unsigned getOpenMPSimpleClauseType(OpenMPClauseKind Kind, llvm::StringRef Str); const char *getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, unsigned Type); diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -222,74 +222,6 @@ #define OPENMP_REDUCTION_MODIFIER(Name) #endif -// OpenMP clauses. -OPENMP_CLAUSE(allocator, OMPAllocatorClause) -OPENMP_CLAUSE(if, OMPIfClause) -OPENMP_CLAUSE(final, OMPFinalClause) -OPENMP_CLAUSE(num_threads, OMPNumThreadsClause) -OPENMP_CLAUSE(safelen, OMPSafelenClause) -OPENMP_CLAUSE(simdlen, OMPSimdlenClause) -OPENMP_CLAUSE(collapse, OMPCollapseClause) -OPENMP_CLAUSE(default, OMPDefaultClause) -OPENMP_CLAUSE(private, OMPPrivateClause) -OPENMP_CLAUSE(firstprivate, OMPFirstprivateClause) -OPENMP_CLAUSE(lastprivate, OMPLastprivateClause) -OPENMP_CLAUSE(shared, OMPSharedClause) -OPENMP_CLAUSE(reduction, OMPReductionClause) -OPENMP_CLAUSE(linear, OMPLinearClause) -OPENMP_CLAUSE(aligned, OMPAlignedClause) -OPENMP_CLAUSE(copyin, OMPCopyinClause) -OPENMP_CLAUSE(copyprivate, OMPCopyprivateClause) -OPENMP_CLAUSE(proc_bind, OMPProcBindClause) -OPENMP_CLAUSE(schedule, OMPScheduleClause) -OPENMP_CLAUSE(ordered, OMPOrderedClause) -OPENMP_CLAUSE(nowait, OMPNowaitClause) -OPENMP_CLAUSE(untied, OMPUntiedClause) -OPENMP_CLAUSE(mergeable, OMPMergeableClause) -OPENMP_CLAUSE(flush, OMPFlushClause) -OPENMP_CLAUSE(read, OMPReadClause) -OPENMP_CLAUSE(write, OMPWriteClause) -OPENMP_CLAUSE(update, OMPUpdateClause) -OPENMP_CLAUSE(capture, OMPCaptureClause) -OPENMP_CLAUSE(seq_cst, OMPSeqCstClause) -OPENMP_CLAUSE(acq_rel, OMPAcqRelClause) -OPENMP_CLAUSE(acquire, OMPAcquireClause) -OPENMP_CLAUSE(release, OMPReleaseClause) -OPENMP_CLAUSE(relaxed, OMPRelaxedClause) -OPENMP_CLAUSE(depend, OMPDependClause) -OPENMP_CLAUSE(device, OMPDeviceClause) -OPENMP_CLAUSE(threads, OMPThreadsClause) -OPENMP_CLAUSE(simd, OMPSIMDClause) -OPENMP_CLAUSE(map, OMPMapClause) -OPENMP_CLAUSE(num_teams, OMPNumTeamsClause) -OPENMP_CLAUSE(thread_limit, OMPThreadLimitClause) -OPENMP_CLAUSE(priority, OMPPriorityClause) -OPENMP_CLAUSE(grainsize, OMPGrainsizeClause) -OPENMP_CLAUSE(nogroup, OMPNogroupClause) -OPENMP_CLAUSE(num_tasks, OMPNumTasksClause) -OPENMP_CLAUSE(hint, OMPHintClause) -OPENMP_CLAUSE(dist_schedule, OMPDistScheduleClause) -OPENMP_CLAUSE(defaultmap, OMPDefaultmapClause) -OPENMP_CLAUSE(to, OMPToClause) -OPENMP_CLAUSE(from, OMPFromClause) -OPENMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause) -OPENMP_CLAUSE(is_device_ptr, OMPIsDevicePtrClause) -OPENMP_CLAUSE(task_reduction, OMPTaskReductionClause) -OPENMP_CLAUSE(in_reduction, OMPInReductionClause) -OPENMP_CLAUSE(unified_address, OMPUnifiedAddressClause) -OPENMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause) -OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause) -OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause) -OPENMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause) -OPENMP_CLAUSE(allocate, OMPAllocateClause) -OPENMP_CLAUSE(nontemporal, OMPNontemporalClause) -OPENMP_CLAUSE(order, OMPOrderClause) -OPENMP_CLAUSE(depobj, OMPDepobjClause) -OPENMP_CLAUSE(destroy, OMPDestroyClause) -OPENMP_CLAUSE(detach, OMPDetachClause) -OPENMP_CLAUSE(inclusive, OMPInclusiveClause) -OPENMP_CLAUSE(exclusive, OMPExclusiveClause) - // Clauses allowed for OpenMP directive 'scan'. OPENMP_SCAN_CLAUSE(inclusive) OPENMP_SCAN_CLAUSE(exclusive) diff --git a/clang/lib/AST/ASTTypeTraits.cpp b/clang/lib/AST/ASTTypeTraits.cpp --- a/clang/lib/AST/ASTTypeTraits.cpp +++ b/clang/lib/AST/ASTTypeTraits.cpp @@ -39,8 +39,8 @@ #define TYPE(DERIVED, BASE) { NKI_##BASE, #DERIVED "Type" }, #include "clang/AST/TypeNodes.inc" { NKI_None, "OMPClause" }, -#define OPENMP_CLAUSE(TextualSpelling, Class) {NKI_OMPClause, #Class}, -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) {NKI_OMPClause, #Class}, +#include "llvm/Frontend/OpenMP/OMPKinds.def" }; bool ASTNodeKind::isBaseOf(ASTNodeKind Other, unsigned *Distance) const { @@ -111,15 +111,13 @@ ASTNodeKind ASTNodeKind::getFromNode(const OMPClause &C) { switch (C.getClauseKind()) { -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_##Name: return ASTNodeKind(NKI_##Class); -#include "clang/Basic/OpenMPKinds.def" - case OMPC_threadprivate: - case OMPC_uniform: - case OMPC_device_type: - case OMPC_match: - case OMPC_unknown: +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case llvm::omp::Clause::Enum: \ + return ASTNodeKind(NKI_##Class); +#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ + case llvm::omp::Clause::Enum: \ llvm_unreachable("unexpected OpenMP clause kind"); +#include "llvm/Frontend/OpenMP/OMPKinds.def" } llvm_unreachable("invalid stmt kind"); } diff --git a/clang/lib/AST/AttrImpl.cpp b/clang/lib/AST/AttrImpl.cpp --- a/clang/lib/AST/AttrImpl.cpp +++ b/clang/lib/AST/AttrImpl.cpp @@ -108,7 +108,8 @@ for (auto *E : linears()) { OS << " linear("; if (*MI != OMPC_LINEAR_unknown) - OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "("; + OS << getOpenMPSimpleClauseTypeName(llvm::omp::Clause::OMPC_linear, *MI) + << "("; E->printPretty(OS, nullptr, Policy); if (*MI != OMPC_LINEAR_unknown) OS << ")"; diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -31,20 +31,20 @@ switch (getClauseKind()) { default: break; -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_##Name: \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case Enum: \ return static_cast(this)->children(); -#include "clang/Basic/OpenMPKinds.def" +#include "llvm/Frontend/OpenMP/OMPKinds.def" } llvm_unreachable("unknown OMPClause"); } OMPClause::child_range OMPClause::used_children() { switch (getClauseKind()) { -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_##Name: \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case Enum: \ return static_cast(this)->used_children(); -#include "clang/Basic/OpenMPKinds.def" +#include "llvm/Frontend/OpenMP/OMPKinds.def" case OMPC_threadprivate: case OMPC_uniform: case OMPC_device_type: diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -414,9 +414,8 @@ public: OMPClauseProfiler(StmtProfiler *P) : Profiler(P) { } -#define OPENMP_CLAUSE(Name, Class) \ - void Visit##Class(const Class *C); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C); +#include "llvm/Frontend/OpenMP/OMPKinds.def" void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C); void VistOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C); }; diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -314,7 +314,7 @@ } { ColorScope Color(OS, ShowColors, AttrColor); - StringRef ClauseName(getOpenMPClauseName(C->getClauseKind())); + StringRef ClauseName(llvm::omp::getOpenMPClauseName(C->getClauseKind())); OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper() << ClauseName.drop_front() << "Clause"; } @@ -1517,7 +1517,8 @@ } { ColorScope Color(OS, ShowColors, AttrColor); - StringRef ClauseName(getOpenMPClauseName(C->getClauseKind())); + StringRef ClauseName( + llvm::omp::getOpenMPClauseName(C->getClauseKind())); OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper() << ClauseName.drop_front() << "Clause"; } diff --git a/clang/lib/ASTMatchers/CMakeLists.txt b/clang/lib/ASTMatchers/CMakeLists.txt --- a/clang/lib/ASTMatchers/CMakeLists.txt +++ b/clang/lib/ASTMatchers/CMakeLists.txt @@ -1,6 +1,9 @@ add_subdirectory(Dynamic) -set(LLVM_LINK_COMPONENTS support) +set(LLVM_LINK_COMPONENTS + FrontendOpenMP + Support +) add_clang_library(clangASTMatchers ASTMatchFinder.cpp diff --git a/clang/lib/ASTMatchers/Dynamic/Marshallers.h b/clang/lib/ASTMatchers/Dynamic/Marshallers.h --- a/clang/lib/ASTMatchers/Dynamic/Marshallers.h +++ b/clang/lib/ASTMatchers/Dynamic/Marshallers.h @@ -170,9 +170,8 @@ private: static Optional getClauseKind(llvm::StringRef ClauseKind) { return llvm::StringSwitch>(ClauseKind) -#define OPENMP_CLAUSE(TextualSpelling, Class) \ - .Case("OMPC_" #TextualSpelling, OMPC_##TextualSpelling) -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) .Case(#Enum, llvm::omp::Clause::Enum) +#include "llvm/Frontend/OpenMP/OMPKinds.def" .Default(llvm::None); } diff --git a/clang/lib/Analysis/CMakeLists.txt b/clang/lib/Analysis/CMakeLists.txt --- a/clang/lib/Analysis/CMakeLists.txt +++ b/clang/lib/Analysis/CMakeLists.txt @@ -1,4 +1,5 @@ set(LLVM_LINK_COMPONENTS + FrontendOpenMP Support ) diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/lib/Basic/OpenMPKinds.cpp @@ -20,50 +20,6 @@ using namespace clang; using namespace llvm::omp; -OpenMPClauseKind clang::getOpenMPClauseKind(StringRef Str) { - // 'flush' clause cannot be specified explicitly, because this is an implicit - // clause for 'flush' directive. If the 'flush' clause is explicitly specified - // the Parser should generate a warning about extra tokens at the end of the - // directive. - // 'depobj' clause cannot be specified explicitly, because this is an implicit - // clause for 'depobj' directive. If the 'depobj' clause is explicitly - // specified the Parser should generate a warning about extra tokens at the - // end of the directive. - if (llvm::StringSwitch(Str) - .Case("flush", true) - .Case("depobj", true) - .Default(false)) - return OMPC_unknown; - return llvm::StringSwitch(Str) -#define OPENMP_CLAUSE(Name, Class) .Case(#Name, OMPC_##Name) -#include "clang/Basic/OpenMPKinds.def" - .Case("uniform", OMPC_uniform) - .Case("device_type", OMPC_device_type) - .Case("match", OMPC_match) - .Default(OMPC_unknown); -} - -const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) { - assert(Kind <= OMPC_unknown); - switch (Kind) { - case OMPC_unknown: - return "unknown"; -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_##Name: \ - return #Name; -#include "clang/Basic/OpenMPKinds.def" - case OMPC_uniform: - return "uniform"; - case OMPC_threadprivate: - return "threadprivate or thread local"; - case OMPC_device_type: - return "device_type"; - case OMPC_match: - return "match"; - } - llvm_unreachable("Invalid OpenMP clause kind"); -} - unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str) { switch (Kind) { diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -341,8 +341,7 @@ if (!Attr) return; if (((Attr->getCaptureKind() != OMPC_map) && - !isOpenMPPrivate( - static_cast(Attr->getCaptureKind()))) || + !isOpenMPPrivate(Attr->getCaptureKind())) || ((Attr->getCaptureKind() == OMPC_map) && !FD->getType()->isAnyPointerType())) return; diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -1387,7 +1387,7 @@ // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume(diag::err_expected_lparen_after, - getOpenMPClauseName(OMPC_match))) { + getOpenMPClauseName(OMPC_match).data())) { while (!SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch)) ; // Skip the last annot_pragma_openmp_end. @@ -1434,7 +1434,7 @@ // Parse '('. BalancedDelimiterTracker T(P, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume(diag::err_expected_lparen_after, - getOpenMPClauseName(Kind))) + getOpenMPClauseName(Kind).data())) return llvm::None; unsigned Type = getOpenMPSimpleClauseType( @@ -1673,18 +1673,18 @@ SmallVector Clauses; if (Tok.isNot(tok::annot_pragma_openmp_end)) { SmallVector, - OMPC_unknown + 1> - FirstClauses(OMPC_unknown + 1); + unsigned(OMPC_unknown) + 1> + FirstClauses(unsigned(OMPC_unknown) + 1); while (Tok.isNot(tok::annot_pragma_openmp_end)) { OpenMPClauseKind CKind = Tok.isAnnotation() ? OMPC_unknown : getOpenMPClauseKind(PP.getSpelling(Tok)); Actions.StartOpenMPClause(CKind); - OMPClause *Clause = ParseOpenMPClause(OMPD_allocate, CKind, - !FirstClauses[CKind].getInt()); + OMPClause *Clause = ParseOpenMPClause( + OMPD_allocate, CKind, !FirstClauses[unsigned(CKind)].getInt()); SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end, StopBeforeMatch); - FirstClauses[CKind].setInt(true); + FirstClauses[unsigned(CKind)].setInt(true); if (Clause != nullptr) Clauses.push_back(Clause); if (Tok.is(tok::annot_pragma_openmp_end)) { @@ -1708,8 +1708,9 @@ case OMPD_requires: { SourceLocation StartLoc = ConsumeToken(); SmallVector Clauses; - SmallVector, OMPC_unknown + 1> - FirstClauses(OMPC_unknown + 1); + SmallVector, + unsigned(OMPC_unknown) + 1> + FirstClauses(unsigned(OMPC_unknown) + 1); if (Tok.is(tok::annot_pragma_openmp_end)) { Diag(Tok, diag::err_omp_expected_clause) << getOpenMPDirectiveName(OMPD_requires); @@ -1720,11 +1721,11 @@ ? OMPC_unknown : getOpenMPClauseKind(PP.getSpelling(Tok)); Actions.StartOpenMPClause(CKind); - OMPClause *Clause = ParseOpenMPClause(OMPD_requires, CKind, - !FirstClauses[CKind].getInt()); + OMPClause *Clause = ParseOpenMPClause( + OMPD_requires, CKind, !FirstClauses[unsigned(CKind)].getInt()); SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end, StopBeforeMatch); - FirstClauses[CKind].setInt(true); + FirstClauses[unsigned(CKind)].setInt(true); if (Clause != nullptr) Clauses.push_back(Clause); if (Tok.is(tok::annot_pragma_openmp_end)) { @@ -2023,8 +2024,9 @@ ParsingOpenMPDirectiveRAII DirScope(*this); ParenBraceBracketBalancer BalancerRAIIObj(*this); SmallVector Clauses; - SmallVector, OMPC_unknown + 1> - FirstClauses(OMPC_unknown + 1); + SmallVector, + unsigned(OMPC_unknown) + 1> + FirstClauses(unsigned(OMPC_unknown) + 1); unsigned ScopeFlags = Scope::FnScope | Scope::DeclScope | Scope::CompoundStmtScope | Scope::OpenMPDirectiveScope; SourceLocation Loc = ConsumeAnnotationToken(), EndLoc; @@ -2069,18 +2071,18 @@ SmallVector Clauses; if (Tok.isNot(tok::annot_pragma_openmp_end)) { SmallVector, - OMPC_unknown + 1> - FirstClauses(OMPC_unknown + 1); + unsigned(OMPC_unknown) + 1> + FirstClauses(unsigned(OMPC_unknown) + 1); while (Tok.isNot(tok::annot_pragma_openmp_end)) { OpenMPClauseKind CKind = Tok.isAnnotation() ? OMPC_unknown : getOpenMPClauseKind(PP.getSpelling(Tok)); Actions.StartOpenMPClause(CKind); - OMPClause *Clause = ParseOpenMPClause(OMPD_allocate, CKind, - !FirstClauses[CKind].getInt()); + OMPClause *Clause = ParseOpenMPClause( + OMPD_allocate, CKind, !FirstClauses[unsigned(CKind)].getInt()); SkipUntil(tok::comma, tok::identifier, tok::annot_pragma_openmp_end, StopBeforeMatch); - FirstClauses[CKind].setInt(true); + FirstClauses[unsigned(CKind)].setInt(true); if (Clause != nullptr) Clauses.push_back(Clause); if (Tok.is(tok::annot_pragma_openmp_end)) { @@ -2248,11 +2250,11 @@ ImplicitClauseAllowed = false; Actions.StartOpenMPClause(CKind); HasImplicitClause = false; - OMPClause *Clause = - ParseOpenMPClause(DKind, CKind, !FirstClauses[CKind].getInt()); - FirstClauses[CKind].setInt(true); + OMPClause *Clause = ParseOpenMPClause( + DKind, CKind, !FirstClauses[unsigned(CKind)].getInt()); + FirstClauses[unsigned(CKind)].setInt(true); if (Clause) { - FirstClauses[CKind].setPointer(Clause); + FirstClauses[unsigned(CKind)].setPointer(Clause); Clauses.push_back(Clause); } @@ -2269,7 +2271,7 @@ // OpenMP [2.13.8, ordered Construct, Syntax] // If the depend clause is specified, the ordered construct is a stand-alone // directive. - if (DKind == OMPD_ordered && FirstClauses[OMPC_depend].getInt()) { + if (DKind == OMPD_ordered && FirstClauses[unsigned(OMPC_depend)].getInt()) { if ((StmtCtx & ParsedStmtContext::AllowStandaloneOpenMPDirectives) == ParsedStmtContext()) { Diag(Loc, diag::err_omp_immediate_directive) @@ -2754,7 +2756,7 @@ // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume(diag::err_expected_lparen_after, - getOpenMPClauseName(Kind))) + getOpenMPClauseName(Kind).data())) return nullptr; ExprResult Val; @@ -3066,7 +3068,7 @@ // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); if (T.expectAndConsume(diag::err_expected_lparen_after, - getOpenMPClauseName(Kind))) + getOpenMPClauseName(Kind).data())) return true; bool NeedRParenForLinear = false; diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2231,7 +2231,7 @@ } } if (OMPC != OMPC_unknown) - FD->addAttr(OMPCaptureKindAttr::CreateImplicit(Context, OMPC)); + FD->addAttr(OMPCaptureKindAttr::CreateImplicit(Context, unsigned(OMPC))); } bool Sema::isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -730,10 +730,10 @@ #define ABSTRACT_STMT(Stmt) #include "clang/AST/StmtNodes.inc" -#define OPENMP_CLAUSE(Name, Class) \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ LLVM_ATTRIBUTE_NOINLINE \ OMPClause *Transform ## Class(Class *S); -#include "clang/Basic/OpenMPKinds.def" +#include "llvm/Frontend/OpenMP/OMPKinds.def" /// Build a new qualified type given its unqualified type and type location. /// @@ -3585,10 +3585,10 @@ switch (S->getClauseKind()) { default: break; // Transform individual clause nodes -#define OPENMP_CLAUSE(Name, Class) \ - case OMPC_ ## Name : \ +#define OMP_CLAUSE_CLASS(Enum, Str, Class) \ + case Enum: \ return getDerived().Transform ## Class(cast(S)); -#include "clang/Basic/OpenMPKinds.def" +#include "llvm/Frontend/OpenMP/OMPKinds.def" } return S; diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -11613,8 +11613,8 @@ OMPClauseReader(ASTRecordReader &Record) : Record(Record), Context(Record.getContext()) {} -#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *C); +#include "llvm/Frontend/OpenMP/OMPKinds.def" OMPClause *readClause(); void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); @@ -11628,149 +11628,149 @@ OMPClause *OMPClauseReader::readClause() { OMPClause *C = nullptr; - switch (Record.readInt()) { - case OMPC_if: + switch (llvm::omp::Clause(Record.readInt())) { + case llvm::omp::OMPC_if: C = new (Context) OMPIfClause(); break; - case OMPC_final: + case llvm::omp::OMPC_final: C = new (Context) OMPFinalClause(); break; - case OMPC_num_threads: + case llvm::omp::OMPC_num_threads: C = new (Context) OMPNumThreadsClause(); break; - case OMPC_safelen: + case llvm::omp::OMPC_safelen: C = new (Context) OMPSafelenClause(); break; - case OMPC_simdlen: + case llvm::omp::OMPC_simdlen: C = new (Context) OMPSimdlenClause(); break; - case OMPC_allocator: + case llvm::omp::OMPC_allocator: C = new (Context) OMPAllocatorClause(); break; - case OMPC_collapse: + case llvm::omp::OMPC_collapse: C = new (Context) OMPCollapseClause(); break; - case OMPC_default: + case llvm::omp::OMPC_default: C = new (Context) OMPDefaultClause(); break; - case OMPC_proc_bind: + case llvm::omp::OMPC_proc_bind: C = new (Context) OMPProcBindClause(); break; - case OMPC_schedule: + case llvm::omp::OMPC_schedule: C = new (Context) OMPScheduleClause(); break; - case OMPC_ordered: + case llvm::omp::OMPC_ordered: C = OMPOrderedClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_nowait: + case llvm::omp::OMPC_nowait: C = new (Context) OMPNowaitClause(); break; - case OMPC_untied: + case llvm::omp::OMPC_untied: C = new (Context) OMPUntiedClause(); break; - case OMPC_mergeable: + case llvm::omp::OMPC_mergeable: C = new (Context) OMPMergeableClause(); break; - case OMPC_read: + case llvm::omp::OMPC_read: C = new (Context) OMPReadClause(); break; - case OMPC_write: + case llvm::omp::OMPC_write: C = new (Context) OMPWriteClause(); break; - case OMPC_update: + case llvm::omp::OMPC_update: C = OMPUpdateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_capture: + case llvm::omp::OMPC_capture: C = new (Context) OMPCaptureClause(); break; - case OMPC_seq_cst: + case llvm::omp::OMPC_seq_cst: C = new (Context) OMPSeqCstClause(); break; - case OMPC_acq_rel: + case llvm::omp::OMPC_acq_rel: C = new (Context) OMPAcqRelClause(); break; - case OMPC_acquire: + case llvm::omp::OMPC_acquire: C = new (Context) OMPAcquireClause(); break; - case OMPC_release: + case llvm::omp::OMPC_release: C = new (Context) OMPReleaseClause(); break; - case OMPC_relaxed: + case llvm::omp::OMPC_relaxed: C = new (Context) OMPRelaxedClause(); break; - case OMPC_threads: + case llvm::omp::OMPC_threads: C = new (Context) OMPThreadsClause(); break; - case OMPC_simd: + case llvm::omp::OMPC_simd: C = new (Context) OMPSIMDClause(); break; - case OMPC_nogroup: + case llvm::omp::OMPC_nogroup: C = new (Context) OMPNogroupClause(); break; - case OMPC_unified_address: + case llvm::omp::OMPC_unified_address: C = new (Context) OMPUnifiedAddressClause(); break; - case OMPC_unified_shared_memory: + case llvm::omp::OMPC_unified_shared_memory: C = new (Context) OMPUnifiedSharedMemoryClause(); break; - case OMPC_reverse_offload: + case llvm::omp::OMPC_reverse_offload: C = new (Context) OMPReverseOffloadClause(); break; - case OMPC_dynamic_allocators: + case llvm::omp::OMPC_dynamic_allocators: C = new (Context) OMPDynamicAllocatorsClause(); break; - case OMPC_atomic_default_mem_order: + case llvm::omp::OMPC_atomic_default_mem_order: C = new (Context) OMPAtomicDefaultMemOrderClause(); break; - case OMPC_private: + case llvm::omp::OMPC_private: C = OMPPrivateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_firstprivate: + case llvm::omp::OMPC_firstprivate: C = OMPFirstprivateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_lastprivate: + case llvm::omp::OMPC_lastprivate: C = OMPLastprivateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_shared: + case llvm::omp::OMPC_shared: C = OMPSharedClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_reduction: + case llvm::omp::OMPC_reduction: C = OMPReductionClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_task_reduction: + case llvm::omp::OMPC_task_reduction: C = OMPTaskReductionClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_in_reduction: + case llvm::omp::OMPC_in_reduction: C = OMPInReductionClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_linear: + case llvm::omp::OMPC_linear: C = OMPLinearClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_aligned: + case llvm::omp::OMPC_aligned: C = OMPAlignedClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_copyin: + case llvm::omp::OMPC_copyin: C = OMPCopyinClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_copyprivate: + case llvm::omp::OMPC_copyprivate: C = OMPCopyprivateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_flush: + case llvm::omp::OMPC_flush: C = OMPFlushClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_depobj: + case llvm::omp::OMPC_depobj: C = OMPDepobjClause::CreateEmpty(Context); break; - case OMPC_depend: { + case llvm::omp::OMPC_depend: { unsigned NumVars = Record.readInt(); unsigned NumLoops = Record.readInt(); C = OMPDependClause::CreateEmpty(Context, NumVars, NumLoops); break; } - case OMPC_device: + case llvm::omp::OMPC_device: C = new (Context) OMPDeviceClause(); break; - case OMPC_map: { + case llvm::omp::OMPC_map: { OMPMappableExprListSizeTy Sizes; Sizes.NumVars = Record.readInt(); Sizes.NumUniqueDeclarations = Record.readInt(); @@ -11779,31 +11779,31 @@ C = OMPMapClause::CreateEmpty(Context, Sizes); break; } - case OMPC_num_teams: + case llvm::omp::OMPC_num_teams: C = new (Context) OMPNumTeamsClause(); break; - case OMPC_thread_limit: + case llvm::omp::OMPC_thread_limit: C = new (Context) OMPThreadLimitClause(); break; - case OMPC_priority: + case llvm::omp::OMPC_priority: C = new (Context) OMPPriorityClause(); break; - case OMPC_grainsize: + case llvm::omp::OMPC_grainsize: C = new (Context) OMPGrainsizeClause(); break; - case OMPC_num_tasks: + case llvm::omp::OMPC_num_tasks: C = new (Context) OMPNumTasksClause(); break; - case OMPC_hint: + case llvm::omp::OMPC_hint: C = new (Context) OMPHintClause(); break; - case OMPC_dist_schedule: + case llvm::omp::OMPC_dist_schedule: C = new (Context) OMPDistScheduleClause(); break; - case OMPC_defaultmap: + case llvm::omp::OMPC_defaultmap: C = new (Context) OMPDefaultmapClause(); break; - case OMPC_to: { + case llvm::omp::OMPC_to: { OMPMappableExprListSizeTy Sizes; Sizes.NumVars = Record.readInt(); Sizes.NumUniqueDeclarations = Record.readInt(); @@ -11812,7 +11812,7 @@ C = OMPToClause::CreateEmpty(Context, Sizes); break; } - case OMPC_from: { + case llvm::omp::OMPC_from: { OMPMappableExprListSizeTy Sizes; Sizes.NumVars = Record.readInt(); Sizes.NumUniqueDeclarations = Record.readInt(); @@ -11821,7 +11821,7 @@ C = OMPFromClause::CreateEmpty(Context, Sizes); break; } - case OMPC_use_device_ptr: { + case llvm::omp::OMPC_use_device_ptr: { OMPMappableExprListSizeTy Sizes; Sizes.NumVars = Record.readInt(); Sizes.NumUniqueDeclarations = Record.readInt(); @@ -11830,7 +11830,7 @@ C = OMPUseDevicePtrClause::CreateEmpty(Context, Sizes); break; } - case OMPC_is_device_ptr: { + case llvm::omp::OMPC_is_device_ptr: { OMPMappableExprListSizeTy Sizes; Sizes.NumVars = Record.readInt(); Sizes.NumUniqueDeclarations = Record.readInt(); @@ -11839,27 +11839,31 @@ C = OMPIsDevicePtrClause::CreateEmpty(Context, Sizes); break; } - case OMPC_allocate: + case llvm::omp::OMPC_allocate: C = OMPAllocateClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_nontemporal: + case llvm::omp::OMPC_nontemporal: C = OMPNontemporalClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_inclusive: + case llvm::omp::OMPC_inclusive: C = OMPInclusiveClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_exclusive: + case llvm::omp::OMPC_exclusive: C = OMPExclusiveClause::CreateEmpty(Context, Record.readInt()); break; - case OMPC_order: + case llvm::omp::OMPC_order: C = new (Context) OMPOrderClause(); break; - case OMPC_destroy: + case llvm::omp::OMPC_destroy: C = new (Context) OMPDestroyClause(); break; - case OMPC_detach: + case llvm::omp::OMPC_detach: C = new (Context) OMPDetachClause(); break; +#define OMP_CLAUSE_NO_CLASS(Enum, Str) \ + case llvm::omp::Enum: \ + break; +#include "llvm/Frontend/OpenMP/OMPKinds.def" } assert(C && "Unknown OMPClause type"); diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -6037,8 +6037,8 @@ public: OMPClauseWriter(ASTRecordWriter &Record) : Record(Record) {} -#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(Class *S); +#include "llvm/Frontend/OpenMP/OMPKinds.def" void writeClause(OMPClause *C); void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C); void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C); @@ -6051,7 +6051,7 @@ } void OMPClauseWriter::writeClause(OMPClause *C) { - Record.push_back(C->getClauseKind()); + Record.push_back(unsigned(C->getClauseKind())); Visit(C); Record.AddSourceLocation(C->getBeginLoc()); Record.AddSourceLocation(C->getEndLoc()); diff --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt --- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt +++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt @@ -1,4 +1,5 @@ set(LLVM_LINK_COMPONENTS + FrontendOpenMP Support ) diff --git a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt --- a/clang/lib/StaticAnalyzer/Core/CMakeLists.txt +++ b/clang/lib/StaticAnalyzer/Core/CMakeLists.txt @@ -1,4 +1,7 @@ -set(LLVM_LINK_COMPONENTS support) +set(LLVM_LINK_COMPONENTS + FrontendOpenMP + Support +) add_clang_library(clangStaticAnalyzerCore APSIntType.cpp diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2153,8 +2153,8 @@ public: OMPClauseEnqueue(EnqueueVisitor *Visitor) : Visitor(Visitor) {} -#define OPENMP_CLAUSE(Name, Class) void Visit##Class(const Class *C); -#include "clang/Basic/OpenMPKinds.def" +#define OMP_CLAUSE_CLASS(Enum, Str, Class) void Visit##Class(const Class *C); +#include "llvm/Frontend/OpenMP/OMPKinds.def" void VisitOMPClauseWithPreInit(const OMPClauseWithPreInit *C); void VisitOMPClauseWithPostUpdate(const OMPClauseWithPostUpdate *C); }; diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -2612,7 +2612,7 @@ } TEST(HasDefaultArgument, Basic) { - EXPECT_TRUE(matches("void x(int val = 0) {}", + EXPECT_TRUE(matches("void x(int val = 0) {}", parmVarDecl(hasDefaultArgument()))); EXPECT_TRUE(notMatches("void x(int val) {}", parmVarDecl(hasDefaultArgument()))); @@ -2665,7 +2665,7 @@ EXPECT_TRUE(matches("auto Y() -> int { return 0; }", functionDecl(hasTrailingReturn()))); EXPECT_TRUE(matches("auto X() -> int;", functionDecl(hasTrailingReturn()))); - EXPECT_TRUE(notMatches("int X() { return 0; }", + EXPECT_TRUE(notMatches("int X() { return 0; }", functionDecl(hasTrailingReturn()))); EXPECT_TRUE(notMatches("int X();", functionDecl(hasTrailingReturn()))); EXPECT_TRUE(notMatchesC("void X();", functionDecl(hasTrailingReturn()))); @@ -2891,8 +2891,8 @@ } TEST(OMPExecutableDirective, isAllowedToContainClauseKind) { - auto Matcher = - ompExecutableDirective(isAllowedToContainClauseKind(OMPC_default)); + auto Matcher = ompExecutableDirective( + isAllowedToContainClauseKind(llvm::omp::OMPC_default)); const std::string Source0 = R"( void x() { diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h --- a/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPConstants.h @@ -34,11 +34,18 @@ #include "llvm/Frontend/OpenMP/OMPKinds.def" }; +/// IDs for all OpenMP clauses. +enum class Clause { +#define OMP_CLAUSE(Enum, ...) Enum, +#include "llvm/Frontend/OpenMP/OMPKinds.def" +}; + /// Make the enum values available in the llvm::omp namespace. This allows us to /// write something like OMPD_parallel if we have a `using namespace omp`. At /// the same time we do not loose the strong type guarantees of the enum class, /// that is we cannot pass an unsigned as Directive without an explicit cast. #define OMP_DIRECTIVE(Enum, ...) constexpr auto Enum = omp::Directive::Enum; +#define OMP_CLAUSE(Enum, ...) constexpr auto Enum = omp::Clause::Enum; #include "llvm/Frontend/OpenMP/OMPKinds.def" /// IDs for all omp runtime library (RTL) functions. @@ -87,6 +94,12 @@ /// Return a textual representation of the directive \p D. StringRef getOpenMPDirectiveName(Directive D); +/// Parse \p Str and return the clause it matches or OMPC_unknown if none. +Clause getOpenMPClauseKind(StringRef Str); + +/// Return a textual representation of the clause \p C. +StringRef getOpenMPClauseName(Clause C); + /// Forward declarations for LLVM-IR types (simple, function and structure) are /// generated below. Their names are defined and used in OpenMP/OMPKinds.def. /// Here we provide the forward declarations, the initializeTypes function will diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def --- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def +++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def @@ -105,6 +105,117 @@ ///} +/// OpenMP Clauses +/// +///{ + +#ifndef OMP_CLAUSE +#define OMP_CLAUSE(Enum, Str, Implicit) +#endif +#ifndef OMP_CLAUSE_CLASS +#define OMP_CLAUSE_CLASS(Enum, Str, Class) +#endif +#ifndef OMP_CLAUSE_NO_CLASS +#define OMP_CLAUSE_NO_CLASS(Enum, Str) +#endif + +#define __OMP_CLAUSE(Name, Class) \ + OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \ + OMP_CLAUSE_CLASS(OMPC_##Name, #Name, Class) +#define __OMP_CLAUSE_NO_CLASS(Name) \ + OMP_CLAUSE(OMPC_##Name, #Name, /* Implicit */ false) \ + OMP_CLAUSE_NO_CLASS(OMPC_##Name, #Name) +#define __OMP_IMPLICIT_CLAUSE_CLASS(Name, Str, Class) \ + OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \ + OMP_CLAUSE_CLASS(OMPC_##Name, Str, Class) +#define __OMP_IMPLICIT_CLAUSE_NO_CLASS(Name, Str) \ + OMP_CLAUSE(OMPC_##Name, Str, /* Implicit */ true) \ + OMP_CLAUSE_NO_CLASS(OMPC_##Name, Str) + +__OMP_CLAUSE(allocator, OMPAllocatorClause) +__OMP_CLAUSE(if, OMPIfClause) +__OMP_CLAUSE(final, OMPFinalClause) +__OMP_CLAUSE(num_threads, OMPNumThreadsClause) +__OMP_CLAUSE(safelen, OMPSafelenClause) +__OMP_CLAUSE(simdlen, OMPSimdlenClause) +__OMP_CLAUSE(collapse, OMPCollapseClause) +__OMP_CLAUSE(default, OMPDefaultClause) +__OMP_CLAUSE(private, OMPPrivateClause) +__OMP_CLAUSE(firstprivate, OMPFirstprivateClause) +__OMP_CLAUSE(lastprivate, OMPLastprivateClause) +__OMP_CLAUSE(shared, OMPSharedClause) +__OMP_CLAUSE(reduction, OMPReductionClause) +__OMP_CLAUSE(linear, OMPLinearClause) +__OMP_CLAUSE(aligned, OMPAlignedClause) +__OMP_CLAUSE(copyin, OMPCopyinClause) +__OMP_CLAUSE(copyprivate, OMPCopyprivateClause) +__OMP_CLAUSE(proc_bind, OMPProcBindClause) +__OMP_CLAUSE(schedule, OMPScheduleClause) +__OMP_CLAUSE(ordered, OMPOrderedClause) +__OMP_CLAUSE(nowait, OMPNowaitClause) +__OMP_CLAUSE(untied, OMPUntiedClause) +__OMP_CLAUSE(mergeable, OMPMergeableClause) +__OMP_CLAUSE(read, OMPReadClause) +__OMP_CLAUSE(write, OMPWriteClause) +__OMP_CLAUSE(update, OMPUpdateClause) +__OMP_CLAUSE(capture, OMPCaptureClause) +__OMP_CLAUSE(seq_cst, OMPSeqCstClause) +__OMP_CLAUSE(acq_rel, OMPAcqRelClause) +__OMP_CLAUSE(acquire, OMPAcquireClause) +__OMP_CLAUSE(release, OMPReleaseClause) +__OMP_CLAUSE(relaxed, OMPRelaxedClause) +__OMP_CLAUSE(depend, OMPDependClause) +__OMP_CLAUSE(device, OMPDeviceClause) +__OMP_CLAUSE(threads, OMPThreadsClause) +__OMP_CLAUSE(simd, OMPSIMDClause) +__OMP_CLAUSE(map, OMPMapClause) +__OMP_CLAUSE(num_teams, OMPNumTeamsClause) +__OMP_CLAUSE(thread_limit, OMPThreadLimitClause) +__OMP_CLAUSE(priority, OMPPriorityClause) +__OMP_CLAUSE(grainsize, OMPGrainsizeClause) +__OMP_CLAUSE(nogroup, OMPNogroupClause) +__OMP_CLAUSE(num_tasks, OMPNumTasksClause) +__OMP_CLAUSE(hint, OMPHintClause) +__OMP_CLAUSE(dist_schedule, OMPDistScheduleClause) +__OMP_CLAUSE(defaultmap, OMPDefaultmapClause) +__OMP_CLAUSE(to, OMPToClause) +__OMP_CLAUSE(from, OMPFromClause) +__OMP_CLAUSE(use_device_ptr, OMPUseDevicePtrClause) +__OMP_CLAUSE(is_device_ptr, OMPIsDevicePtrClause) +__OMP_CLAUSE(task_reduction, OMPTaskReductionClause) +__OMP_CLAUSE(in_reduction, OMPInReductionClause) +__OMP_CLAUSE(unified_address, OMPUnifiedAddressClause) +__OMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause) +__OMP_CLAUSE(reverse_offload, OMPReverseOffloadClause) +__OMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause) +__OMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause) +__OMP_CLAUSE(allocate, OMPAllocateClause) +__OMP_CLAUSE(nontemporal, OMPNontemporalClause) +__OMP_CLAUSE(order, OMPOrderClause) +__OMP_CLAUSE(destroy, OMPDestroyClause) +__OMP_CLAUSE(detach, OMPDetachClause) +__OMP_CLAUSE(inclusive, OMPInclusiveClause) +__OMP_CLAUSE(exclusive, OMPExclusiveClause) + +__OMP_CLAUSE_NO_CLASS(uniform) +__OMP_CLAUSE_NO_CLASS(device_type) +__OMP_CLAUSE_NO_CLASS(match) + +__OMP_IMPLICIT_CLAUSE_CLASS(depobj, "depobj", OMPDepobjClause) +__OMP_IMPLICIT_CLAUSE_CLASS(flush, "flush", OMPFlushClause) + +__OMP_IMPLICIT_CLAUSE_NO_CLASS(threadprivate, "threadprivate or thread local") +__OMP_IMPLICIT_CLAUSE_NO_CLASS(unknown, "unknown") + +#undef __OMP_IMPLICIT_CLAUSE_NO_CLASS +#undef __OMP_IMPLICIT_CLAUSE_CLASS +#undef __OMP_CLAUSE +#undef OMP_CLAUSE_NO_CLASS +#undef OMP_CLAUSE_CLASS +#undef OMP_CLAUSE + +///} + /// Types used in runtime structs or runtime functions /// ///{ @@ -232,8 +343,10 @@ __OMP_RTL(__kmpc_master, false, Int32, IdentPtr, Int32) __OMP_RTL(__kmpc_end_master, false, Void, IdentPtr, Int32) __OMP_RTL(__kmpc_critical, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy) -__OMP_RTL(__kmpc_critical_with_hint, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy, Int32) -__OMP_RTL(__kmpc_end_critical, false, Void, IdentPtr, Int32, KmpCriticalNamePtrTy) +__OMP_RTL(__kmpc_critical_with_hint, false, Void, IdentPtr, Int32, + KmpCriticalNamePtrTy, Int32) +__OMP_RTL(__kmpc_end_critical, false, Void, IdentPtr, Int32, + KmpCriticalNamePtrTy) __OMP_RTL(__last, false, Void, ) diff --git a/llvm/lib/Frontend/OpenMP/OMPConstants.cpp b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp --- a/llvm/lib/Frontend/OpenMP/OMPConstants.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPConstants.cpp @@ -36,6 +36,24 @@ llvm_unreachable("Invalid OpenMP directive kind"); } +Clause llvm::omp::getOpenMPClauseKind(StringRef Str) { + return llvm::StringSwitch(Str) +#define OMP_CLAUSE(Enum, Str, Implicit) \ + .Case(Str, Implicit ? OMPC_unknown : Enum) +#include "llvm/Frontend/OpenMP/OMPKinds.def" + .Default(OMPC_unknown); +} + +StringRef llvm::omp::getOpenMPClauseName(Clause C) { + switch (C) { +#define OMP_CLAUSE(Enum, Str, ...) \ + case Enum: \ + return Str; +#include "llvm/Frontend/OpenMP/OMPKinds.def" + } + llvm_unreachable("Invalid OpenMP clause kind"); +} + /// Declarations for LLVM-IR types (simple, array, function and structure) are /// generated below. Their names are defined and used in OpenMPKinds.def. Here /// we provide the declarations, the initializeTypes function will provide the