[PATCH] D74970: [OpenMP] Refactor the analysis in checkMapClauseBaseExpression using StmtVisitor clause.
Chi Chun Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 21 10:05:43 PST 2020
cchen marked an inline comment as done.
cchen added inline comments.
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:15356
+ Expr::EvalResult Result;
+ if (AE->getIdx()->EvaluateAsInt(Result, SemaRef.getASTContext())) {
+ if (!Result.Val.getInt().isNullValue()) {
----------------
ABataev wrote:
> Need to check that `AE->getIdx()` is not value dependent, otherwise it may crash
It seems Clang would catch the error before we do the analysis:
```
orig.cpp:6:24: error: array subscript is not an integer
#pragma omp target map(a[b])
^ ~
orig.cpp:15:3: note: in instantiation of function template specialization 'gg<int, double>' requested here
gg<int, double>(a, c);
^
orig.cpp:8:5: error: array subscript is not an integer
a[b] = 10;
^ ~
2 errors generated.
```
Also, if we still need it, do we also check type dependent?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74970/new/
https://reviews.llvm.org/D74970
More information about the cfe-commits
mailing list