[clang] [clang][OpenMP] Add 'allocator' modifier for 'allocate' clause. (PR #114883)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 06:53:07 PST 2024


================
@@ -2242,9 +2247,16 @@ void OMPClausePrinter::VisitOMPAllocateClause(OMPAllocateClause *Node) {
   if (Node->varlist_empty())
     return;
   OS << "allocate";
+  OpenMPAllocateClauseModifier Modifier = Node->getAllocatorModifier();
   if (Expr *Allocator = Node->getAllocator()) {
     OS << "(";
-    Allocator->printPretty(OS, nullptr, Policy, 0);
+    if (Modifier == OMPC_ALLOCATE_allocator) {
+      OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(), Modifier);
+      OS << "(";
+      Allocator->printPretty(OS, nullptr, Policy, 0);
+      OS << ")";
+    } else
+      Allocator->printPretty(OS, nullptr, Policy, 0);
----------------
alexey-bataev wrote:

```suggestion
    } else {
      Allocator->printPretty(OS, nullptr, Policy, 0);
    }
```

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


More information about the cfe-commits mailing list