[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI

GCC 4.8.4 on a bot was warning about `ArgPassingKind` not fitting in
`ArgPassingRestrictions`, which appears to be incorrect, since
`ArgPassingKind` only has three potential values:

"warning: 'clang::RecordDecl::ArgPassingRestrictions' is too small to
hold all values of 'enum clang::RecordDecl::ArgPassingKind'"

Additionally, I remember hearing (though my knowledge may be outdated)
that MSVC won't merge adjacent bitfields if their types are different.

Try to fix both issues by turning these into `uint8_t`s.

llvm-svn: 329652
This commit is contained in:
George Burgess IV 2018-04-10 01:11:26 +00:00
parent 6c05a3bb71
commit 37b1dd62bb
1 changed files with 8 additions and 5 deletions

View File

@ -3599,10 +3599,13 @@ private:
/// Indicates whether this struct is destroyed in the callee. This flag is
/// meaningless when Microsoft ABI is used since parameters are always
/// destroyed in the callee.
bool ParamDestroyedInCallee : 1;
///
/// Please note that MSVC won't merge adjacent bitfields if they don't have
/// the same type.
uint8_t ParamDestroyedInCallee : 1;
/// Represents the way this type is passed to a function.
ArgPassingKind ArgPassingRestrictions : 2;
uint8_t ArgPassingRestrictions : 2;
protected:
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
@ -3691,15 +3694,15 @@ public:
/// it must have at least one trivial, non-deleted copy or move constructor.
/// FIXME: This should be set as part of completeDefinition.
bool canPassInRegisters() const {
return ArgPassingRestrictions == APK_CanPassInRegs;
return getArgPassingRestrictions() == APK_CanPassInRegs;
}
ArgPassingKind getArgPassingRestrictions() const {
return ArgPassingRestrictions;
return static_cast<ArgPassingKind>(ArgPassingRestrictions);
}
void setArgPassingRestrictions(ArgPassingKind Kind) {
ArgPassingRestrictions = Kind;
ArgPassingRestrictions = static_cast<uint8_t>(Kind);
}
bool isParamDestroyedInCallee() const {