mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
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
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
//===- ModuleDebugLineFragment.h --------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFILECHECKSUMFRAGMENT_H
|
|
#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFILECHECKSUMFRAGMENT_H
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/DebugInfo/CodeView/ModuleDebugFragment.h"
|
|
#include "llvm/Support/BinaryStreamArray.h"
|
|
#include "llvm/Support/BinaryStreamReader.h"
|
|
#include "llvm/Support/Endian.h"
|
|
|
|
namespace llvm {
|
|
namespace codeview {
|
|
|
|
struct FileChecksumEntry {
|
|
uint32_t FileNameOffset; // Byte offset of filename in global stringtable.
|
|
FileChecksumKind Kind; // The type of checksum.
|
|
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
|
|
};
|
|
}
|
|
}
|
|
|
|
namespace llvm {
|
|
template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
|
|
public:
|
|
typedef void ContextType;
|
|
|
|
static Error extract(BinaryStreamRef Stream, uint32_t &Len,
|
|
codeview::FileChecksumEntry &Item, void *Ctx);
|
|
};
|
|
}
|
|
|
|
namespace llvm {
|
|
namespace codeview {
|
|
class ModuleDebugFileChecksumFragment final : public ModuleDebugFragment {
|
|
typedef VarStreamArray<FileChecksumEntry> FileChecksumArray;
|
|
typedef FileChecksumArray::Iterator Iterator;
|
|
|
|
public:
|
|
ModuleDebugFileChecksumFragment()
|
|
: ModuleDebugFragment(ModuleDebugFragmentKind::FileChecksums) {}
|
|
|
|
static bool classof(const ModuleDebugFragment *S) {
|
|
return S->kind() == ModuleDebugFragmentKind::FileChecksums;
|
|
}
|
|
|
|
Error initialize(BinaryStreamReader Reader);
|
|
|
|
Iterator begin() const { return Checksums.begin(); }
|
|
Iterator end() const { return Checksums.end(); }
|
|
|
|
private:
|
|
FileChecksumArray Checksums;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|