OSDN Git Service

[CodeView] Unions are always sealed
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 6 Jul 2016 21:07:42 +0000 (21:07 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 6 Jul 2016 21:07:42 +0000 (21:07 +0000)
It is impossible to inherit from a union.  We are missing a way to
represent this in IR for classes/structs...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274675 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
test/DebugInfo/COFF/types-data-members.ll

index fe63b70..cb43108 100644 (file)
@@ -1536,7 +1536,7 @@ TypeIndex CodeViewDebug::lowerTypeUnion(const DICompositeType *Ty) {
 }
 
 TypeIndex CodeViewDebug::lowerCompleteTypeUnion(const DICompositeType *Ty) {
-  ClassOptions CO = getCommonClassOptions(Ty);
+  ClassOptions CO = ClassOptions::Sealed | getCommonClassOptions(Ty);
   TypeIndex FieldTI;
   unsigned FieldCount;
   bool ContainsNestedClass;
index 70a5097..759a5e5 100644 (file)
 ; CHECK:   Union (0x100B) {
 ; CHECK:     TypeLeafKind: LF_UNION (0x1506)
 ; CHECK:     MemberCount: 2
-; CHECK:     Properties [ (0x200)
+; CHECK:     Properties [ (0x600)
 ; CHECK:       HasUniqueName (0x200)
+; CHECK:       Sealed (0x400)
 ; CHECK:     ]
 ; CHECK:     FieldList: <field list> (0x100A)
 ; CHECK:     SizeOf: 4