[PATCH] D51211: [Sema] Emit -Wformat properly for bitfield promotions.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 30 09:44:53 PST 2018


aaron.ballman added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:7711-7715
+  // It's an integer promotion if the destination type is the promoted
+  // source type.
+  return ICE->getCastKind() == CK_IntegralCast &&
+         From->isPromotableIntegerType() &&
+         S.Context.getPromotedIntegerType(From) == To;
----------------
This check is not checking against the promoted type of the bit-field. See `Sema::UsualArithmeticConversions()` for an example of what I'm talking about. Is that expected?


================
Comment at: test/Sema/format-strings-bitfield-promotion.c:1
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
+
----------------
Running your test through GCC looks like the behavior matches here for C; can you also add a C++ test that demonstrates the behavior does not change?

https://godbolt.org/z/zRYDMG


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

https://reviews.llvm.org/D51211





More information about the cfe-commits mailing list