diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-06-26 15:10:34 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-06-26 15:10:34 +0000 |
commit | d8db1e172cf320490c273380b847690007247b11 (patch) | |
tree | fe3db4c154521c9cfa684f8a2a2733f77a22911f /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 7b4658ff87432084900a9f19f6e0fa00fda3e4d2 (diff) | |
download | bcm5719-llvm-d8db1e172cf320490c273380b847690007247b11.tar.gz bcm5719-llvm-d8db1e172cf320490c273380b847690007247b11.zip |
Revert r273807 (and r273809, r273810), it caused PR28311
llvm-svn: 273815
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 46917f8e82f..e01ee0984ed 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -911,55 +911,9 @@ TypeIndex CodeViewDebug::lowerTypeArray(const DICompositeType *Ty) { TypeIndex IndexType = Asm->MAI->getPointerSize() == 8 ? TypeIndex(SimpleTypeKind::UInt64Quad) : TypeIndex(SimpleTypeKind::UInt32Long); - assert(ElementTypeRef.resolve()); - uint64_t ElementSize = ElementTypeRef.resolve()->getSizeInBits() / 8; - - bool UndefinedSubrange = false; - - // FIXME: - // There is a bug in the front-end where an array of a structure, which was - // declared as incomplete structure first, ends up not getting a size assigned - // to it. (PR28303) - // Example: - // struct A(*p)[3]; - // struct A { int f; } a[3]; - // - // This needs to be fixed in the front-end, but in the meantime we don't want - // to trigger an assertion because of this. - if (Ty->getSizeInBits() == 0) { - UndefinedSubrange = true; - } - - // Add subranges to array type. - DINodeArray Elements = Ty->getElements(); - for (int i = Elements.size() - 1; i >= 0; --i) { - const DINode *Element = Elements[i]; - assert(Element->getTag() == dwarf::DW_TAG_subrange_type); - - const DISubrange *Subrange = cast<DISubrange>(Element); - assert(Subrange->getLowerBound() == 0 && - "codeview doesn't support subranges with lower bounds"); - int64_t Count = Subrange->getCount(); - - // Variable Length Array (VLA) has Count equal to '-1'. - // Replace with Count '1', assume it is the minimum VLA length. - // FIXME: Make front-end support VLA subrange and emit LF_DIMVARLU. - if (Count == -1) { - Count = 1; - UndefinedSubrange = true; - } - - StringRef Name = (i == 0) ? Ty->getName() : ""; - // Update the element size and element type index for subsequent subranges. - ElementSize *= Count; - ElementTypeIndex = TypeTable.writeArray( - ArrayRecord(ElementTypeIndex, IndexType, ElementSize, Name)); - } - - (void)UndefinedSubrange; - assert(UndefinedSubrange || ElementSize == (Ty->getSizeInBits() / 8)); - - return ElementTypeIndex; + uint64_t Size = Ty->getSizeInBits() / 8; + ArrayRecord Record(ElementTypeIndex, IndexType, Size, Ty->getName()); + return TypeTable.writeArray(Record); } TypeIndex CodeViewDebug::lowerTypeBasic(const DIBasicType *Ty) { |