[OpenCL] Warn about side effects for unevaluated vec_step arg
authorSven van Haastregt <sven.vanhaastregt@arm.com>
Tue, 5 Jan 2021 11:51:10 +0000 (11:51 +0000)
committerSven van Haastregt <sven.vanhaastregt@arm.com>
Tue, 5 Jan 2021 11:51:10 +0000 (11:51 +0000)
commit0e4d2361b817bd16f97cd45d5792017edc3891ee
tree1ff8ab7ef66ab7819ca441e4bcef557589aea264
parentf784be0777f34a5b3bc3da6892ca242de7840fce
[OpenCL] Warn about side effects for unevaluated vec_step arg

The argument to the `vec_step` builtin is not evaluated.  Hoist the
diagnostic for this in `Sema::CheckUnaryExprOrTypeTraitOperand` such
that it comes before `Sema::CheckVecStepTraitOperandType`.

A minor side-effect of this change is that it also produces the
warning for `co_await` and `co_yield` as `sizeof` arguments now, which
seems to be reasonable given that the warning is emitted for `typeid`
already.

Differential Revision: https://reviews.llvm.org/D91348
clang/lib/Sema/SemaExpr.cpp
clang/test/SemaCXX/coroutines.cpp
clang/test/SemaOpenCL/vec_step.cl