diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-10-12 23:29:20 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-10-12 23:29:20 +0000 |
commit | 5f608aedb6c5d32d2f7c51f9354a75b21f1eeaee (patch) | |
tree | efb96a26c2702ab7f166250ae48090a10bf9e174 /lib/AST/Decl.cpp | |
parent | b2aa66c0f5ad4e2c67b7d02af6a644432ca189cf (diff) |
Make -mms-bitfields behave consistently.
Patch by Jeremiah Zanin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index fea81cf2c4..442deca11b 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2517,7 +2517,7 @@ unsigned FieldDecl::getFieldIndex() const { unsigned Index = 0; const RecordDecl *RD = getParent(); const FieldDecl *LastFD = 0; - bool IsMsStruct = RD->hasAttr<MsStructAttr>(); + bool IsMsStruct = RD->isMsStruct(getASTContext()); for (RecordDecl::field_iterator I = RD->field_begin(), E = RD->field_end(); I != E; ++I, ++Index) { @@ -2765,6 +2765,13 @@ void RecordDecl::completeDefinition() { TagDecl::completeDefinition(); } +/// isMsStruct - Get whether or not this record uses ms_struct layout. +/// This which can be turned on with an attribute, pragma, or the +/// -mms-bitfields command-line option. +bool RecordDecl::isMsStruct(const ASTContext &C) const { + return hasAttr<MsStructAttr>() || C.getLangOpts().MSBitfields == 1; +} + static bool isFieldOrIndirectField(Decl::Kind K) { return FieldDecl::classofKind(K) || IndirectFieldDecl::classofKind(K); } |