llvmbot wrote:
@llvm/pr-subscribers-openmp
Author: Vlad Serebrennikov (Endilll)
Changes
This patch moves OpenMP-related entities out of `Sema` to a newly created
`SemaOpenMP` class. This is a part of the effort to split `Sema` up, and
follows the recent example of CUDA, OpenACC, SYCL, HLSL. Additional context can
be found in https://github.com/llvm/llvm-project/pull/82217,
https://github.com/llvm/llvm-project/pull/84184,
https://github.com/llvm/llvm-project/pull/87634.
---
Patch is 791.89 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/88642.diff
18 Files Affected:
- (modified) clang/include/clang/Parse/Parser.h (+8-7)
- (modified) clang/include/clang/Sema/Sema.h (+7-1412)
- (added) clang/include/clang/Sema/SemaOpenMP.h (+1447)
- (modified) clang/lib/Parse/ParseDecl.cpp (+2-1)
- (modified) clang/lib/Parse/ParseExpr.cpp (+3-2)
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+128-112)
- (modified) clang/lib/Parse/ParseStmt.cpp (+2-1)
- (modified) clang/lib/Sema/Sema.cpp (+14-11)
- (modified) clang/lib/Sema/SemaDecl.cpp (+18-14)
- (modified) clang/lib/Sema/SemaDeclCXX.cpp (+5-4)
- (modified) clang/lib/Sema/SemaExpr.cpp (+31-579)
- (modified) clang/lib/Sema/SemaExprMember.cpp (+5-4)
- (modified) clang/lib/Sema/SemaLambda.cpp (+2-1)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+2506-1827)
- (modified) clang/lib/Sema/SemaStmt.cpp (+4-2)
- (modified) clang/lib/Sema/SemaTemplateInstantiateDecl.cpp (+32-28)
- (modified) clang/lib/Sema/SemaType.cpp (+2-1)
- (modified) clang/lib/Sema/TreeTransform.h (+349-335)
``diff
diff --git a/clang/include/clang/Parse/Parser.h
b/clang/include/clang/Parse/Parser.h
index c719218731c35b..a8791c40ab52f9 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -18,6 +18,7 @@
#include "clang/Lex/CodeCompletionHandler.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Sema.h"
+#include "clang/Sema/SemaOpenMP.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Frontend/OpenMP/OMPContext.h"
#include "llvm/Support/SaveAndRestore.h"
@@ -2535,7 +2536,7 @@ class Parser : public CodeCompletionHandler {
/// Returns true for declaration, false for expression.
bool isForInitDeclaration() {
if (getLangOpts().OpenMP)
- Actions.startOpenMPLoop();
+ Actions.OpenMP().startOpenMPLoop();
if (getLangOpts().CPlusPlus)
return Tok.is(tok::kw_using) ||
isCXXSimpleDeclaration(/*AllowForRangeDecl=*/true);
@@ -3394,7 +3395,7 @@ class Parser : public CodeCompletionHandler {
SourceLocation Loc);
/// Parse clauses for '#pragma omp [begin] declare target'.
- void ParseOMPDeclareTargetClauses(Sema::DeclareTargetContextInfo );
+ void ParseOMPDeclareTargetClauses(SemaOpenMP::DeclareTargetContextInfo
);
/// Parse '#pragma omp end declare target'.
void ParseOMPEndDeclareTargetDirective(OpenMPDirectiveKind BeginDKind,
@@ -3484,7 +3485,7 @@ class Parser : public CodeCompletionHandler {
/// Parses indirect clause
/// \param ParseOnly true to skip the clause's semantic actions and return
// false;
- bool ParseOpenMPIndirectClause(Sema::DeclareTargetContextInfo ,
+ bool ParseOpenMPIndirectClause(SemaOpenMP::DeclareTargetContextInfo ,
bool ParseOnly);
/// Parses clause with a single expression and an additional argument
/// of a kind \a Kind.
@@ -3554,12 +3555,12 @@ class Parser : public CodeCompletionHandler {
/// Parses a reserved locator like 'omp_all_memory'.
bool ParseOpenMPReservedLocator(OpenMPClauseKind Kind,
- Sema::OpenMPVarListDataTy ,
+ SemaOpenMP::OpenMPVarListDataTy ,
const LangOptions );
/// Parses clauses with list.
bool ParseOpenMPVarList(OpenMPDirectiveKind DKind, OpenMPClauseKind Kind,
SmallVectorImpl ,
- Sema::OpenMPVarListDataTy );
+ SemaOpenMP::OpenMPVarListDataTy );
bool ParseUnqualifiedId(CXXScopeSpec , ParsedType ObjectType,
bool ObjectHadErrors, bool EnteringContext,
bool AllowDestructorName, bool AllowConstructorName,
@@ -3567,11 +3568,11 @@ class Parser : public CodeCompletionHandler {
SourceLocation *TemplateKWLoc, UnqualifiedId
);
/// Parses the mapper modifier in map, to, and from clauses.
- bool parseMapperModifier(Sema::OpenMPVarListDataTy );
+ bool parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy );
/// Parses map-type-modifiers in map clause.
/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list)
/// where, map-type-modifier ::= always | close | mapper(mapper-identifier)
- bool parseMapTypeModifiers(Sema::OpenMPVarListDataTy );
+ bool parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy );