1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Re-add "Make FieldList records print as a YAML sequence"

This was originally submitted in r280549, and reverted in r280577
due to breaking one MSVC buildbot.  The issue is that MSVC 2013
doesn't synthesize move constructors.  So even though i was
writing std::move(A) it was copying it, leading to a bogus ArrayRef.
The solution here is to simply remove the std::vector<> from the
type, since it is unused and unnecessary.  This way the ArrayRef
continues to point into the original memory backing the CVType.

llvm-svn: 280769
This commit is contained in:
Zachary Turner 2016-09-06 23:45:47 +00:00
parent e2892c0c04
commit 420a134a9e
4 changed files with 1138 additions and 1089 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "CodeViewYaml.h"
#include "PdbYaml.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/EnumTables.h"
@ -25,6 +26,35 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(OneMethodRecord)
LLVM_YAML_IS_SEQUENCE_VECTOR(VFTableSlotKind)
LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef)
LLVM_YAML_IS_SEQUENCE_VECTOR(CVType)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::pdb::yaml::PdbTpiRecord)
namespace {
struct FieldListRecordSplitter : public TypeVisitorCallbacks {
public:
explicit FieldListRecordSplitter(
std::vector<llvm::pdb::yaml::PdbTpiRecord> &Records)
: Records(Records) {}
#define TYPE_RECORD(EnumName, EnumVal, Name)
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#define MEMBER_RECORD(EnumName, EnumVal, Name) \
Error visitKnownRecord(const CVType &CVT, Name##Record &Record) override { \
visitKnownRecordImpl(CVT); \
return Error::success(); \
}
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
private:
void visitKnownRecordImpl(const CVType &CVT) {
llvm::pdb::yaml::PdbTpiRecord R;
R.Record = CVT;
Records.push_back(std::move(R));
}
std::vector<llvm::pdb::yaml::PdbTpiRecord> &Records;
};
}
namespace llvm {
namespace yaml {
@ -518,3 +548,15 @@ llvm::codeview::yaml::YamlTypeDumperCallbacks::visitTypeBegin(
YamlIO.mapRequired("Kind", K);
return K;
}
void llvm::codeview::yaml::YamlTypeDumperCallbacks::visitKnownRecordImpl(
const char *Name, const CVType &Type, FieldListRecord &FieldList) {
std::vector<llvm::pdb::yaml::PdbTpiRecord> Records;
if (YamlIO.outputting()) {
FieldListRecordSplitter Splitter(Records);
CVTypeVisitor V(Splitter);
consumeError(V.visitFieldListMemberStream(FieldList.Data));
}
YamlIO.mapRequired(Name, Records);
}

View File

@ -27,7 +27,7 @@ public:
#define TYPE_RECORD(EnumName, EnumVal, Name) \
Error visitKnownRecord(const CVRecord<TypeLeafKind> &CVR, \
Name##Record &Record) override { \
YamlIO.mapRequired(#Name, Record); \
visitKnownRecordImpl(#Name, CVR, Record); \
return Error::success(); \
}
#define MEMBER_RECORD(EnumName, EnumVal, Name) \
@ -37,6 +37,14 @@ public:
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
private:
template <typename T>
void visitKnownRecordImpl(const char *Name, const CVType &Type, T &Record) {
YamlIO.mapRequired(Name, Record);
}
void visitKnownRecordImpl(const char *Name, const CVType &Type,
FieldListRecord &FieldList);
llvm::yaml::IO &YamlIO;
};
}

View File

@ -70,7 +70,6 @@ struct PdbDbiStream {
};
struct PdbTpiRecord {
std::vector<uint8_t> RecordData;
codeview::CVType Record;
};