diff options
| author | Martin Storsjö <martin@martin.st> | 2019-12-18 10:41:41 +0200 |
|---|---|---|
| committer | Martin Storsjö <martin@martin.st> | 2019-12-19 12:14:09 +0200 |
| commit | f20fc65887e2085332d111ee0b05736794423c72 (patch) | |
| tree | b39d34e71a329812079217250b34654b14d7af18 | |
| parent | 29d8c27c65289d1ed370861ff75f309a689a22cb (diff) | |
| download | bcm5719-llvm-f20fc65887e2085332d111ee0b05736794423c72.tar.gz bcm5719-llvm-f20fc65887e2085332d111ee0b05736794423c72.zip | |
[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
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index de1cfe94000..a733553dc7e 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -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. |

