[clang] [OpenACC] Implement 'num_gangs' sema for compute constructs (PR #89460)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 08:32:26 PDT 2024


================
@@ -3644,10 +3644,22 @@ class Parser : public CodeCompletionHandler {
   /// Parses the clause of the 'bind' argument, which can be a string literal or
   /// an ID expression.
   ExprResult ParseOpenACCBindClauseArgument();
+
+  /// A type to represent the state of parsing after an attempt to parse an
+  /// OpenACC int-expr. This is useful to determine whether an int-expr list can
+  /// continue parsing after a failed int-expr.
+  using OpenACCIntExprParseResult =
+      std::pair<ExprResult, OpenACCParseCanContinue>;
   /// Parses the clause kind of 'int-expr', which can be any integral
   /// expression.
-  ExprResult ParseOpenACCIntExpr(OpenACCDirectiveKind DK, OpenACCClauseKind CK,
-                                 SourceLocation Loc);
+  OpenACCIntExprParseResult ParseOpenACCIntExpr(OpenACCDirectiveKind DK,
+                                                OpenACCClauseKind CK,
+                                                SourceLocation Loc);
+  /// Parses the argument list for 'num_gangs', which allows up to 3
+  /// 'int-expr's.
+  bool ParseOpenACCIntExprList(OpenACCDirectiveKind DK, OpenACCClauseKind CK,
+                               SourceLocation Loc,
+                               llvm::SmallVector<Expr *> &IntExprs);
----------------
alexey-bataev wrote:

```suggestion
                               llvm::SmallVectorImpl<Expr *> &IntExprs);
```

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


More information about the cfe-commits mailing list