[clang] [flang] [llvm] [Flang][OpenMP] Implement variable-category for default clause (OMP 6.0) (PR #223476)

Phoebe Linck via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 18:56:39 PST 2026


================
@@ -91,6 +91,70 @@ bool IsClauseAllowedOnDirective(llvm::omp::Clause clauseId,
       clauseId, dirId, version, GetSemanticOverridesOrNull(semaCtx));
 }
 
+bool IsOpenMPPointer(const Symbol &symbol) {
+  if (IsPointer(symbol) || IsBuiltinCPtr(symbol))
+    return true;
+  return false;
+}
+
+bool IsOpenMPAggregate(const Symbol &symbol) {
+  if (IsAllocatable(symbol) || IsOpenMPPointer(symbol))
+    return false;
+
+  const auto *type{symbol.GetType()};
+  if (!type)
+    return false;
+
+  // OpenMP categorizes Fortran characters as aggregates.
+  if (type->category() == Fortran::semantics::DeclTypeSpec::Category::Character)
+    return true;
+
+  if (const auto *det{symbol.GetUltimate()
+              .detailsIf<Fortran::semantics::ObjectEntityDetails>()})
+    if (det->IsArray())
+      return true;
+
+  if (type->AsDerived())
+    return true;
+
+  if (IsDeferredShape(symbol) || IsAssumedRank(symbol) ||
+      IsAssumedShape(symbol))
+    return true;
+  return false;
+}
+
+bool IsOpenMPScalar(const Symbol &symbol) {
----------------
phi-bee wrote:

Done.

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


More information about the cfe-commits mailing list