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

David Pagan via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 13:07:55 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);
----------------
ddpagan wrote:

Fixed as suggested.

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


More information about the cfe-commits mailing list