[PATCH] D91348: [OpenCL] Warn about side effects for unevaluated vec_step arg

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 31 03:48:19 PST 2020


Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: lxfind.

LGTM, the change seems reasonable. Thanks!

> A minor side-effect of this change is that it also produces the
> warning for co_await and co_yield now.

This warning is produced for **sizeof** and it seems like a duplication of another diagnostic that occurs for this case. But this happens elsewhere and it is not harmful so it seems acceptable. Alternatively, we could try to move code that contains `CheckVecStepTraitOperandType` some line below instead of moving the warning to the top. But I don't find it necessary.

Btw just a suggestion - it is better to upload a full diff because the regular diff is not reliable in the Phabricator as line numbers change quickly in the repository and there is no information on the parent commit for the patch.



================
Comment at: clang/lib/Sema/SemaExpr.cpp:4038
 
+  // The operand for sizeof and alignof is in an unevaluated expression context,
+  // so side effects could result in unintended consequences.
----------------
The comment could be updated to add vec_step. Although I think the comment has already changed in the repo so a rebase would be necessary.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91348



More information about the cfe-commits mailing list