File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -5125,10 +5125,10 @@ void RecordDecl::completeDefinition() {
5125
5125
// / This which can be turned on with an attribute, pragma, or the
5126
5126
// / -mms-bitfields command-line option.
5127
5127
bool RecordDecl::isMsStruct (const ASTContext &C) const {
5128
- if (hasAttr<MSStructAttr>())
5129
- return true ;
5130
5128
if (hasAttr<GCCStructAttr>())
5131
5129
return false ;
5130
+ if (hasAttr<MSStructAttr>())
5131
+ return true ;
5132
5132
auto LayoutCompatibility = C.getLangOpts ().getLayoutCompatibility ();
5133
5133
if (LayoutCompatibility == LangOptions::LayoutCompatibilityKind::Default)
5134
5134
return C.defaultsToMsStruct ();
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-linux-gnu %s
2
+ // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-linux-gnu -fms-layout-compatibility=microsoft %s
3
+ // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-windows-gnu %s
4
+ // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-pc-windows-gnu -fms-layout-compatibility=itanium %s
5
+
6
+ struct {
7
+ int a : 24 ;
8
+ char b : 8 ;
9
+ } __attribute__((gcc_struct )) t1 ;
10
+ static int a1 [(sizeof (t1 ) == 4 ) - 1 ];
11
+
12
+ #pragma ms_struct on
13
+ struct {
14
+ int a : 24 ;
15
+ char b : 8 ;
16
+ } __attribute__((gcc_struct )) t2 ;
17
+ static int a2 [(sizeof (t2 ) == 4 ) - 1 ];
18
+ #pragma ms_struct off
You can’t perform that action at this time.
0 commit comments