[PATCH] D50250: [clang][ubsan] Implicit Conversion Sanitizer - integer sign change - clang part

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 3 06:48:32 PDT 2018

lebedev.ri added inline comments.

Comment at: lib/CodeGen/CGExprScalar.cpp:2004
+    if (auto *ICE = dyn_cast<ImplicitCastExpr>(CE)) {
+      if (CGF.SanOpts.hasOneOf(SanitizerKind::ImplicitConversion) &&
+          !ICE->isPartOfExplicitCast()) {
erichkeane wrote:
> Is this an error?  You swapped a 'has' with a 'hasOneOf' but only listed a single thing.
`ImplicitConversion` is a *group*, which includes `ImplicitIntegerTruncation` and `ImplicitIntegerSignChange`.
So `hasOneOf(group)` checks that at least one check of the group is enabled.
No, this is correct, else the tests would break.

  rC Clang


More information about the cfe-commits mailing list