Use unsigned for bitfields to avoid sign extension

llvm-svn: 363450
This commit is contained in:
Reid Kleckner 2019-06-14 20:19:29 +00:00
parent b48e44a65c
commit 49b965079b
2 changed files with 8 additions and 5 deletions

View File

@ -363,7 +363,7 @@ private:
unsigned Friend_specified : 1;
// constexpr-specifier
ConstexprSpecKind ConstexprSpecifier : 2;
unsigned ConstexprSpecifier : 2;
union {
UnionParsedType TypeRep;
@ -728,7 +728,10 @@ public:
bool isModulePrivateSpecified() const { return ModulePrivateLoc.isValid(); }
SourceLocation getModulePrivateSpecLoc() const { return ModulePrivateLoc; }
ConstexprSpecKind getConstexprSpecifier() const { return ConstexprSpecifier; }
ConstexprSpecKind getConstexprSpecifier() const {
return ConstexprSpecKind(ConstexprSpecifier);
}
SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; }
bool hasConstexprSpecifier() const {
return ConstexprSpecifier != CSK_unspecified;

View File

@ -1037,9 +1037,9 @@ bool DeclSpec::setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec,
bool DeclSpec::SetConstexprSpec(ConstexprSpecKind ConstexprKind,
SourceLocation Loc, const char *&PrevSpec,
unsigned &DiagID) {
if (ConstexprSpecifier != CSK_unspecified) {
if (ConstexprSpecifier == CSK_consteval || ConstexprKind == CSK_consteval)
return BadSpecifier(ConstexprKind, ConstexprSpecifier, PrevSpec, DiagID);
if (getConstexprSpecifier() != CSK_unspecified) {
if (getConstexprSpecifier() == CSK_consteval || ConstexprKind == CSK_consteval)
return BadSpecifier(ConstexprKind, getConstexprSpecifier(), PrevSpec, DiagID);
DiagID = diag::warn_duplicate_declspec;
PrevSpec = "constexpr";
return true;