summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c55c07efb77..43aa2d73fc6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -12625,26 +12625,26 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc,
}
if (!FieldTy->isDependentType()) {
- uint64_t TypeSize = Context.getTypeSize(FieldTy);
- if (Value.getZExtValue() > TypeSize) {
+ uint64_t TypeWidth = Context.getIntWidth(FieldTy);
+ if (Value.ugt(TypeWidth)) {
if (!getLangOpts().CPlusPlus || IsMsStruct ||
Context.getTargetInfo().getCXXABI().isMicrosoft()) {
if (FieldName)
- return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_size)
+ return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_width)
<< FieldName << (unsigned)Value.getZExtValue()
- << (unsigned)TypeSize;
+ << (unsigned)TypeWidth;
- return Diag(FieldLoc, diag::err_anon_bitfield_width_exceeds_type_size)
- << (unsigned)Value.getZExtValue() << (unsigned)TypeSize;
+ return Diag(FieldLoc, diag::err_anon_bitfield_width_exceeds_type_width)
+ << (unsigned)Value.getZExtValue() << (unsigned)TypeWidth;
}
if (FieldName)
- Diag(FieldLoc, diag::warn_bitfield_width_exceeds_type_size)
+ Diag(FieldLoc, diag::warn_bitfield_width_exceeds_type_width)
<< FieldName << (unsigned)Value.getZExtValue()
- << (unsigned)TypeSize;
+ << (unsigned)TypeWidth;
else
- Diag(FieldLoc, diag::warn_anon_bitfield_width_exceeds_type_size)
- << (unsigned)Value.getZExtValue() << (unsigned)TypeSize;
+ Diag(FieldLoc, diag::warn_anon_bitfield_width_exceeds_type_width)
+ << (unsigned)Value.getZExtValue() << (unsigned)TypeWidth;
}
}
OpenPOWER on IntegriCloud