mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
[CodeView] Isolate Debug Info Fragments into standalone classes.
Previously parsing of these were all grouped together into a single master class that could parse any type of debug info fragment. With writing forthcoming, the complexity of each individual fragment is enough to warrant them having their own classes so that reading and writing of each fragment type can be grouped together, but isolated from the code for reading and writing other fragment types. In doing so, I found a place where parsing code was duplicated for the FileChecksums fragment, across llvm-readobj and the CodeView library, and one of the implementations had a bug. Now that the codepaths are merged, the bug is resolved. Differential Revision: https://reviews.llvm.org/D32547 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
//===- ModuleDebugFragment.cpp --------------------------------------*- C++
|
||||
//-*-===//
|
||||
//===- ModuleDebugFragment.cpp -----------------------------------*- C++-*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@@ -10,37 +9,6 @@
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"
|
||||
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
||||
ModuleDebugFragment::ModuleDebugFragment()
|
||||
: Kind(ModuleDebugFragmentKind::None) {}
|
||||
|
||||
ModuleDebugFragment::ModuleDebugFragment(ModuleDebugFragmentKind Kind,
|
||||
BinaryStreamRef Data)
|
||||
: Kind(Kind), Data(Data) {}
|
||||
|
||||
Error ModuleDebugFragment::initialize(BinaryStreamRef Stream,
|
||||
ModuleDebugFragment &Info) {
|
||||
const ModuleDebugFragmentHeader *Header;
|
||||
BinaryStreamReader Reader(Stream);
|
||||
if (auto EC = Reader.readObject(Header))
|
||||
return EC;
|
||||
|
||||
ModuleDebugFragmentKind Kind =
|
||||
static_cast<ModuleDebugFragmentKind>(uint32_t(Header->Kind));
|
||||
if (auto EC = Reader.readStreamRef(Info.Data, Header->Length))
|
||||
return EC;
|
||||
Info.Kind = Kind;
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
uint32_t ModuleDebugFragment::getRecordLength() const {
|
||||
return sizeof(ModuleDebugFragmentHeader) + Data.getLength();
|
||||
}
|
||||
|
||||
ModuleDebugFragmentKind ModuleDebugFragment::kind() const { return Kind; }
|
||||
|
||||
BinaryStreamRef ModuleDebugFragment::getRecordData() const { return Data; }
|
||||
ModuleDebugFragment::~ModuleDebugFragment() {}
|
||||
|
||||
Reference in New Issue
Block a user