[clang] [OpenACC] Private Clause on Compute Constructs (PR #90521)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 07:59:07 PDT 2024


================
@@ -423,6 +450,52 @@ ExprResult SemaOpenACC::ActOnIntExpr(OpenACCDirectiveKind DK,
   return IntExpr;
 }
 
+ExprResult SemaOpenACC::ActOnVar(Expr *VarExpr) {
+  // We still need to retain the array subscript/subarray exprs, so work on a
+  // copy.
+  Expr *CurVarExpr = VarExpr->IgnoreParenImpCasts();
+
+  // Sub-arrays/subscript-exprs are fine as long as the base is a
+  // VarExpr/MemberExpr. So strip all of those off.
+  while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
+    if (auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
+      CurVarExpr = SubScrpt->getBase()->IgnoreParenImpCasts();
+    else
+      CurVarExpr =
+          cast<ArraySectionExpr>(CurVarExpr)->getBase()->IgnoreParenImpCasts();
+  }
----------------
erichkeane wrote:

My reading of the standard says 'no', it shouldn't?  I wouldn't consider that to be an 'array-element'.

Both of the existing implementations I have access to also reject it: https://godbolt.org/z/Pj98d6c5M

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


More information about the cfe-commits mailing list