diff options
| author | Reid Kleckner <rnk@google.com> | 2019-06-14 20:19:29 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2019-06-14 20:19:29 +0000 |
| commit | 49b965079b18f8aa485dd1156dd088d40b7ee465 (patch) | |
| tree | cc430cdf1179168cdb35178e18cf3c850c99babd | |
| parent | b48e44a65cff83ec71e5fac88952d2dc31660041 (diff) | |
| download | bcm5719-llvm-49b965079b18f8aa485dd1156dd088d40b7ee465.tar.gz bcm5719-llvm-49b965079b18f8aa485dd1156dd088d40b7ee465.zip | |
Use unsigned for bitfields to avoid sign extension
llvm-svn: 363450
| -rw-r--r-- | clang/include/clang/Sema/DeclSpec.h | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/clang/include/clang/Sema/DeclSpec.h b/clang/include/clang/Sema/DeclSpec.h index 5c549d76aaf..b417f89c0e5 100644 --- a/clang/include/clang/Sema/DeclSpec.h +++ b/clang/include/clang/Sema/DeclSpec.h @@ -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; diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 21d7f6bd426..9433efb1819 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -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; |

