summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-09-15 01:00:55 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-09-15 01:00:55 +0000
commitd558aa86277ca2673c85c882458eed5de8753f7b (patch)
tree91c8864d5089c2f7655faa278d88474505361350 /clang/lib/Sema/SemaDecl.cpp
parentd128fff5dfa7cf45ca7798807824523fcb839a58 (diff)
downloadbcm5719-llvm-d558aa86277ca2673c85c882458eed5de8753f7b.tar.gz
bcm5719-llvm-d558aa86277ca2673c85c882458eed5de8753f7b.zip
[MS ABI] Overwide bool bitfields should be permitted
Overwide bool bitfields have eight bits of storage size, make sure we take the padding into account when determining whether or not they are problematic. llvm-svn: 247651
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 8501bc5b224..9c641ddbb65 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -12626,11 +12626,14 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc,
}
if (!FieldTy->isDependentType()) {
- uint64_t TypeWidth = Context.getIntWidth(FieldTy);
+ bool UseMSBitfieldSemantics =
+ IsMsStruct || Context.getTargetInfo().getCXXABI().isMicrosoft();
+ bool UseStorageSize = getLangOpts().CPlusPlus && UseMSBitfieldSemantics;
+ uint64_t TypeWidth = UseStorageSize ? Context.getTypeSize(FieldTy)
+ : Context.getIntWidth(FieldTy);
if (Value.ugt(TypeWidth)) {
- if (!getLangOpts().CPlusPlus || IsMsStruct ||
- Context.getTargetInfo().getCXXABI().isMicrosoft()) {
- if (FieldName)
+ if (!getLangOpts().CPlusPlus || UseMSBitfieldSemantics) {
+ if (FieldName)
return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_width)
<< FieldName << (unsigned)Value.getZExtValue()
<< (unsigned)TypeWidth;
OpenPOWER on IntegriCloud