diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-10-31 19:55:08 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-10-31 19:55:08 +0000 |
commit | 3f39bd28244dd06511d70be01745d46288a761a9 (patch) | |
tree | 4d0c8fe5855b8f79b1adcc59377aff593a0ebe8a | |
parent | b89bb4ebdb42c59ba488410e3ee3380fdca25f26 (diff) |
Revert "[DWARF] Now that Optional is standard layout, put it into an union instead of splatting it."
GCC doesn't like it. This reverts commit r317028.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317030 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h | 15 | ||||
-rw-r--r-- | lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h index de49be5c0b5..84b23398b8c 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h +++ b/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h @@ -33,8 +33,11 @@ public: assert(isImplicitConst()); } AttributeSpec(dwarf::Attribute A, dwarf::Form F, Optional<uint8_t> ByteSize) - : Attr(A), Form(F), ByteSize(ByteSize) { + : Attr(A), Form(F) { assert(!isImplicitConst()); + this->ByteSize.HasByteSize = ByteSize.hasValue(); + if (this->ByteSize.HasByteSize) + this->ByteSize.ByteSize = *ByteSize; } dwarf::Attribute Attr; @@ -45,17 +48,21 @@ public: /// attributes and as value for implicit_const ones, indicated by /// Form == DW_FORM_implicit_const. /// The following cases are distinguished: - /// * Form != DW_FORM_implicit_const and ByteSize has a value: + /// * Form != DW_FORM_implicit_const and HasByteSize is true: /// ByteSize contains the fixed size in bytes for the Form in this /// object. - /// * Form != DW_FORM_implicit_const and ByteSize is None: + /// * Form != DW_FORM_implicit_const and HasByteSize is false: /// byte size of Form either varies according to the DWARFUnit /// that it is contained in or the value size varies and must be /// decoded from the debug information in order to determine its size. /// * Form == DW_FORM_implicit_const: /// Value contains value for the implicit_const attribute. + struct ByteSizeStorage { + bool HasByteSize; + uint8_t ByteSize; + }; union { - Optional<uint8_t> ByteSize; + ByteSizeStorage ByteSize; int64_t Value; }; diff --git a/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp index 1fc54d2065e..a88dcfcf542 100644 --- a/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp +++ b/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp @@ -214,8 +214,8 @@ Optional<int64_t> DWARFAbbreviationDeclaration::AttributeSpec::getByteSize( const DWARFUnit &U) const { if (isImplicitConst()) return 0; - if (ByteSize) - return *ByteSize; + if (ByteSize.HasByteSize) + return ByteSize.ByteSize; Optional<int64_t> S; auto FixedByteSize = DWARFFormValue::getFixedByteSize(Form, U.getFormParams()); |