[clang] Fix compilation with GCC < 8 for MinGW

GCC 7 and earlier, when targeting MinGW, seems to have a bug in
layout/size of bitfield structs if they contain a nested enum,
making the size of the struct 8 bytes, while we have a static assert
requiring it to be 4 bytes or less.

While this clearly is a GCC bug, the workaround (moving the enum out
of the bitfield) also is very nonintrusive and matches other existing
enums there.

Differential Revision: https://reviews.llvm.org/D71650
This commit is contained in:
Martin Storsjö 2019-12-18 10:41:41 +02:00
parent 29d8c27c65
commit f20fc65887
1 changed files with 3 additions and 3 deletions

View File

@ -873,6 +873,8 @@ protected:
DAK_Normal
};
enum { NumScopeDepthOrObjCQualsBits = 7 };
class ParmVarDeclBitfields {
friend class ASTDeclReader;
friend class ParmVarDecl;
@ -895,8 +897,6 @@ protected:
/// Whether this parameter is an ObjC method parameter or not.
unsigned IsObjCMethodParam : 1;
enum { NumScopeDepthOrObjCQualsBits = 7 };
/// If IsObjCMethodParam, a Decl::ObjCDeclQualifier.
/// Otherwise, the number of function parameter scopes enclosing
/// the function parameter scope in which this parameter was
@ -1627,7 +1627,7 @@ public:
}
static constexpr unsigned getMaxFunctionScopeDepth() {
return (1u << ParmVarDeclBitfields::NumScopeDepthOrObjCQualsBits) - 1;
return (1u << NumScopeDepthOrObjCQualsBits) - 1;
}
/// Returns the index of this parameter in its prototype or method scope.