1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

Fix uninitialized read error reported by MSAN.

The problem was that our Obj -> Yaml dumper had not been taught
to handle certain types of records.  This meant that when I
generated the test input files, the records were still there but
none of its fields were filled out.  So when it did the
Yaml -> Obj conversion as part of the test, it generated records
with garbage in them.

The patch here fixes the Obj <-> Yaml converter, and additionally
updates the test file with fresh Yaml generated by the fixed
converter.

llvm-svn: 322029
This commit is contained in:
Zachary Turner 2018-01-08 21:38:50 +00:00
parent e9bc465e2c
commit 4e0d96a656

View File

@ -40,6 +40,7 @@ using namespace llvm::CodeViewYAML::detail;
using namespace llvm::yaml;
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(TypeIndex)
LLVM_YAML_IS_SEQUENCE_VECTOR(LocalVariableAddrGap)
// We only need to declare these, the definitions are in CodeViewYAMLTypes.cpp
LLVM_YAML_DECLARE_SCALAR_TRAITS(APSInt, QuotingType::None)
@ -180,6 +181,24 @@ void ScalarEnumerationTraits<FrameCookieKind>::enumeration(
}
}
namespace llvm {
namespace yaml {
template <> struct MappingTraits<LocalVariableAddrRange> {
static void mapping(IO &io, LocalVariableAddrRange &Range) {
io.mapRequired("OffsetStart", Range.OffsetStart);
io.mapRequired("ISectStart", Range.ISectStart);
io.mapRequired("Range", Range.Range);
}
};
template <> struct MappingTraits<LocalVariableAddrGap> {
static void mapping(IO &io, LocalVariableAddrGap &Gap) {
io.mapRequired("GapStartOffset", Gap.GapStartOffset);
io.mapRequired("Range", Gap.Range);
}
};
} // namespace yaml
} // namespace llvm
namespace llvm {
namespace CodeViewYAML {
namespace detail {
@ -353,32 +372,50 @@ template <> void SymbolRecordImpl<LocalSym>::map(IO &IO) {
}
template <> void SymbolRecordImpl<DefRangeSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Program", Symbol.Program);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <> void SymbolRecordImpl<DefRangeSubfieldSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Program", Symbol.Program);
IO.mapRequired("OffsetInParent", Symbol.OffsetInParent);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <> void SymbolRecordImpl<DefRangeRegisterSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Register", Symbol.Hdr.Register);
IO.mapRequired("MayHaveNoName", Symbol.Hdr.MayHaveNoName);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <> void SymbolRecordImpl<DefRangeFramePointerRelSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Offset", Symbol.Offset);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <> void SymbolRecordImpl<DefRangeSubfieldRegisterSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Register", Symbol.Hdr.Register);
IO.mapRequired("MayHaveNoName", Symbol.Hdr.MayHaveNoName);
IO.mapRequired("OffsetInParent", Symbol.Hdr.OffsetInParent);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <>
void SymbolRecordImpl<DefRangeFramePointerRelFullScopeSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Register", Symbol.Offset);
}
template <> void SymbolRecordImpl<DefRangeRegisterRelSym>::map(IO &IO) {
// TODO: Print the subfields
IO.mapRequired("Register", Symbol.Hdr.Register);
IO.mapRequired("Flags", Symbol.Hdr.Flags);
IO.mapRequired("BasePointerOffset", Symbol.Hdr.BasePointerOffset);
IO.mapRequired("Range", Symbol.Range);
IO.mapRequired("Gaps", Symbol.Gaps);
}
template <> void SymbolRecordImpl<BlockSym>::map(IO &IO) {