r363450 - Use unsigned for bitfields to avoid sign extension
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 14 13:19:29 PDT 2019
Author: rnk
Date: Fri Jun 14 13:19:29 2019
New Revision: 363450
URL: http://llvm.org/viewvc/llvm-project?rev=363450&view=rev
Log:
Use unsigned for bitfields to avoid sign extension
Modified:
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/Sema/DeclSpec.cpp
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=363450&r1=363449&r2=363450&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Jun 14 13:19:29 2019
@@ -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;
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=363450&r1=363449&r2=363450&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Fri Jun 14 13:19:29 2019
@@ -1037,9 +1037,9 @@ bool DeclSpec::setModulePrivateSpec(Sour
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;
More information about the cfe-commits
mailing list