[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-16 Thread Vlad Serebrennikov via cfe-commits

https://github.com/Endilll closed 
https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Alexey Bataev via cfe-commits

https://github.com/alexey-bataev approved this pull request.

LG

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Vlad Serebrennikov via cfe-commits


@@ -997,6 +987,11 @@ class Sema final : public SemaBase {
 return *OpenACCPtr;
   }
 
+  SemaOpenMP () {
+assert(OpenMPPtr);

Endilll wrote:

Done

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Vlad Serebrennikov via cfe-commits


@@ -997,6 +987,11 @@ class Sema final : public SemaBase {
 return *OpenACCPtr;
   }
 
+  SemaOpenMP () {

Endilll wrote:

This was discussed back when we started splitting `Sema` up: 
https://github.com/llvm/llvm-project/pull/84184#discussion_r1520027821. We can 
reopen the discussion if you insist, otherwise I'd like to keep it consistent 
with CUDA, HLSL, etc.

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Vlad Serebrennikov via cfe-commits


@@ -11,6 +11,7 @@
 ///
 
//===--===//
 
+#include "clang/Sema/SemaOpenMP.h"

Endilll wrote:

Main module header goes first per our coding standard: 
https://llvm.org/docs/CodingStandards.html#include-style

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Alexey Bataev via cfe-commits


@@ -997,6 +987,11 @@ class Sema final : public SemaBase {
 return *OpenACCPtr;
   }
 
+  SemaOpenMP () {
+assert(OpenMPPtr);

alexey-bataev wrote:

Add assertion message

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Alexey Bataev via cfe-commits


@@ -11,6 +11,7 @@
 ///
 
//===--===//
 
+#include "clang/Sema/SemaOpenMP.h"

alexey-bataev wrote:

Sort it properly?

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-14 Thread Alexey Bataev via cfe-commits


@@ -997,6 +987,11 @@ class Sema final : public SemaBase {
 return *OpenACCPtr;
   }
 
+  SemaOpenMP () {

alexey-bataev wrote:

```suggestion
  SemaOpenMP () {
```


https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-13 Thread Vlad Serebrennikov via cfe-commits

Endilll wrote:

I intentionally split formatting changes into a separate commit if reviewers 
want to look at changes without formatting noise.

If, given the volume of changes here, there is an appetite to remove `OpenMP` 
and `OMP` from names inside `SemaOpenMP` right in this patch, I can do that. I 
did that for HLSL and OpenACC, but those were an order of magnitude smaller 
patches that this one.

https://github.com/llvm/llvm-project/pull/88642
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Introduce `SemaOpenMP` (PR #88642)

2024-04-13 Thread via cfe-commits

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 );