[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 06:40:33 PST 2018
aaron.ballman added inline comments.
================
Comment at: lib/Sema/SemaChecking.cpp:7598-7602
+ if (ICE->getCastKind() == CK_IntegralCast &&
+ From->isPromotableIntegerType() &&
+ S.Context.getPromotedIntegerType(From) == To)
+ return true;
+ return false;
----------------
Can be simplified to: `return ICE->getCastKind() == CK_IntegralCast && From->isPromotableIntegerType() && S.Context.getPromotedIntegerType(From) == To;`
================
Comment at: test/Sema/format-strings.c:699-700
+ unsigned long b : 2;
+ long c : 32; // assumes that int is 32 bits
+ unsigned long d : 32; // assumes that int is 32 bits
+} bf;
----------------
The test currently does not have a target triple, so this is likely to fail on some bots. Rather than tie this entire test to one architecture, I'd split the bit-field tests out into a separate file and pick an explicit triple that meets this assumption.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D51211/new/
https://reviews.llvm.org/D51211
More information about the cfe-commits
mailing list