[clang] [OpenACC] Add 'collapse' clause AST/basic Sema implementation (PR #109461)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 12:39:16 PDT 2024


================
@@ -1583,6 +1618,33 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc,
                        OK_Ordinary, ColonLoc, RBLoc);
 }
 
+ExprResult SemaOpenACC::CheckCollapseLoopCount(Expr *LoopCount) {
+  if (!LoopCount)
+    return ExprError();
+
+  assert((LoopCount->isInstantiationDependent() ||
+          LoopCount->getType()->isIntegerType()) &&
+         "Loop argument non integer?");
+
+  // If this is dependent, there really isn't anything we can check.
+  if (LoopCount->isInstantiationDependent())
+    return ExprResult{LoopCount};
+
+  std::optional<llvm::APSInt> ICE =
+      LoopCount->getIntegerConstantExpr(getASTContext());
----------------
erichkeane wrote:

Thats a great idea!  We don't really have any other constant-expressions in OpenACC implemented yet, so this is the first.

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


More information about the cfe-commits mailing list