[clang] [clang][OpenMP] Simplify handling of implicit DSA/mapping information (PR #106786)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 06:26:34 PDT 2024


================
@@ -6060,69 +6057,55 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
       return StmtError();
     // Generate list of implicitly defined firstprivate variables.
     VarsWithInheritedDSA = DSAChecker.getVarsWithInheritedDSA();
+    VariableImplicitInfo ImpInfo = DSAChecker.getImplicitInfo();
 
-    SmallVector<Expr *, 4> ImplicitFirstprivates(
-        DSAChecker.getImplicitFirstprivate());
-    SmallVector<Expr *, 4> ImplicitPrivates(DSAChecker.getImplicitPrivate());
-    const unsigned DefaultmapKindNum = OMPC_DEFAULTMAP_unknown + 1;
-    SmallVector<Expr *, 4> ImplicitMaps[DefaultmapKindNum][OMPC_MAP_delete];
-    SmallVector<OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers>
-        ImplicitMapModifiers[DefaultmapKindNum];
     SmallVector<SourceLocation, NumberOfOMPMapClauseModifiers>
-        ImplicitMapModifiersLoc[DefaultmapKindNum];
+        ImplicitMapModifiersLoc[VariableImplicitInfo::DefaultmapKindNum];
     // Get the original location of present modifier from Defaultmap clause.
-    SourceLocation PresentModifierLocs[DefaultmapKindNum];
+    SourceLocation PresentModifierLocs[VariableImplicitInfo::DefaultmapKindNum];
     for (OMPClause *C : Clauses) {
       if (auto *DMC = dyn_cast<OMPDefaultmapClause>(C))
         if (DMC->getDefaultmapModifier() == OMPC_DEFAULTMAP_MODIFIER_present)
           PresentModifierLocs[DMC->getDefaultmapKind()] =
               DMC->getDefaultmapModifierLoc();
     }
-    for (unsigned VC = 0; VC < DefaultmapKindNum; ++VC) {
+
+    for (unsigned VC = 0; VC < VariableImplicitInfo::DefaultmapKindNum; ++VC) {
       auto K = static_cast<OpenMPDefaultmapClauseKind>(VC);
----------------
alexey-bataev wrote:

```suggestion
    for (OpenMPDefaultmapClauseKind K : enum_seq_inclusive<OpenMPDefaultmapClauseKind>(OMPC_DEFAULTMAP_scalar, OMPC_DEFAULTMAP_unknown)) {
```


https://github.com/llvm/llvm-project/pull/106786


More information about the cfe-commits mailing list