diff options
author | Greg Clayton <gclayton@apple.com> | 2016-10-31 16:46:02 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-10-31 16:46:02 +0000 |
commit | cddab279f6978fca9ae5a5676c7346f384579d2c (patch) | |
tree | 6624cdcb50838123e6cf69e73541ad40e33cacf4 /llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp | |
parent | 218770b827cac5e36e9739d0c47f4c67d05434ea (diff) | |
download | bcm5719-llvm-cddab279f6978fca9ae5a5676c7346f384579d2c.tar.gz bcm5719-llvm-cddab279f6978fca9ae5a5676c7346f384579d2c.zip |
Modify DWARFFormValue to remember the DWARFUnit that it was decoded with.
Modifying DWARFFormValue to remember the DWARFUnit that it was encoded with can simplify the usage of instances of this class. Previously users would have to try and pass in the same DWARFUnit that was used to decode the form value and there was a possibility that a different DWARFUnit might be supplied to the functions that extract values (strings, CU relative references, addresses) and cause problems. This fixes this potential issue by storing the DWARFUnit inside the DWARFFormValue so that this mistake can't be made. Instances of DWARFFormValue are not stored permanently and are used as temporary values, so the increase in size of an instance of DWARFFormValue isn't a big deal. This makes decoding form values more bullet proof and is a change that will be used by future modifications.
https://reviews.llvm.org/D26052
llvm-svn: 285594
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp index 880fc5c3fa2..55378e59b3c 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp @@ -158,13 +158,13 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS, else if (attr == DW_AT_decl_line || attr == DW_AT_call_line) OS << *formValue.getAsUnsignedConstant(); else - formValue.dump(OS, u); + formValue.dump(OS); // We have dumped the attribute raw value. For some attributes // having both the raw value and the pretty-printed value is // interesting. These attributes are handled below. if (attr == DW_AT_specification || attr == DW_AT_abstract_origin) { - Optional<uint64_t> Ref = formValue.getAsReference(u); + Optional<uint64_t> Ref = formValue.getAsReference(); if (Ref.hasValue()) { uint32_t RefOffset = Ref.getValue(); DWARFDebugInfoEntryMinimal DIE; @@ -264,7 +264,7 @@ const char *DWARFDebugInfoEntryMinimal::getAttributeValueAsString( DWARFFormValue FormValue; if (!getAttributeValue(U, Attr, FormValue)) return FailValue; - Optional<const char *> Result = FormValue.getAsCString(U); + Optional<const char *> Result = FormValue.getAsCString(); return Result.hasValue() ? Result.getValue() : FailValue; } @@ -274,7 +274,7 @@ uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsAddress( DWARFFormValue FormValue; if (!getAttributeValue(U, Attr, FormValue)) return FailValue; - Optional<uint64_t> Result = FormValue.getAsAddress(U); + Optional<uint64_t> Result = FormValue.getAsAddress(); return Result.hasValue() ? Result.getValue() : FailValue; } @@ -294,7 +294,7 @@ uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsReference( DWARFFormValue FormValue; if (!getAttributeValue(U, Attr, FormValue)) return FailValue; - Optional<uint64_t> Result = FormValue.getAsReference(U); + Optional<uint64_t> Result = FormValue.getAsReference(); return Result.hasValue() ? Result.getValue() : FailValue; } |