[PATCH] D74144: [OPENMP50]Add basic support for array-shaping operation.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 13:33:03 PDT 2020


ABataev marked an inline comment as done.
ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:4751
+                                       LParenLoc, RParenLoc, Dims, Brackets);
+  if (!BaseTy->isAnyPointerType())
+    return ExprError(Diag(Base->getExprLoc(),
----------------
ABataev wrote:
> rjmccall wrote:
> > I think you should perform DefaultFunctionArrayLvalueConversion here so that e.g. arrays will decay to pointers, you load pointers from l-values, and so on.  If you do so, it'll handle placeholders for you.
> > 
> > Do you really want to allow this to operate on non-C pointer types?
> 1. Standard clearly states that the type of the base expression must be a pointer. I don't think that we should perform implicit type casting here, like decay to pointers, etc.
> 2. It is just a simple form of checking that this is a pointer type. Since this expression is not allowed in other languages (and I filter it out at the parsing stage), I think it is ok to use the generic form of type checking.
Forgot to mention, that I thought about possible conversion here. But it may lead to some unpredictable results, like:
```
int a[3];
...([3][4][n])a...
```
Better to do not allow this kind of operation, I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74144/new/

https://reviews.llvm.org/D74144





More information about the cfe-commits mailing list