ABataev added inline comments.

================
Comment at: lib/Sema/SemaOpenMP.cpp:9016-9023
@@ +9015,10 @@
+
+  // If this is an array subscript, it refers to the whole size if the size of
+  // the dimension is constant and equals 1. Also, an array section assumes the
+  // format of an array subscript if no colon is used.
+  if (isa<ArraySubscriptExpr>(E) || (OASE && OASE->getColonLoc().isInvalid())) 
{
+    if (auto *ATy = dyn_cast<ConstantArrayType>(BaseQTy.getTypePtr()))
+      return ATy->getSize().getSExtValue() == 1;
+    return false;
+  }
+
----------------
ABataev wrote:
> I agree with all your examples except for this one
> ```
> #pragma omp target map(a[:][arg:])
> ```
> For me, this is valid if you can't prove it is non-contiguous. You should 
> consider this as a possibly contiguous. If it is not contiguous, it is user's 
> problem. But if he needs to use such form of expression, I don't see why we 
> should not allow him to do this.
I don't think this code
```
const int n = 0;
arr[n:]
```
will work in C. Try to add a test for C, not C++. In C 'const' does not mean 
you can evaluate the value of the variable during compilation.


http://reviews.llvm.org/D17547



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to