[pdb] Make an abstract base class for PDBFile.
This will allow us to mock it out in a unit test to begin writing unit tests for the various PDB and codeview classes. llvm-svn: 271168
This commit is contained in:
parent
746addd261
commit
d28449e2ca
|
|
@ -0,0 +1,45 @@
|
|||
//===- IPDBFile.h - Abstract base class for a PDB file ----------*- 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_PDB_RAW_IPDBFILE_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
|
||||
struct IPDBFile {
|
||||
public:
|
||||
virtual ~IPDBFile() {}
|
||||
|
||||
virtual uint32_t getBlockSize() const = 0;
|
||||
virtual uint32_t getBlockCount() const = 0;
|
||||
virtual uint32_t getNumDirectoryBytes() const = 0;
|
||||
virtual uint32_t getBlockMapIndex() const = 0;
|
||||
virtual uint32_t getNumDirectoryBlocks() const = 0;
|
||||
virtual uint64_t getBlockMapOffset() const = 0;
|
||||
|
||||
virtual uint32_t getNumStreams() const = 0;
|
||||
virtual uint32_t getStreamByteSize(uint32_t StreamIndex) const = 0;
|
||||
virtual ArrayRef<uint32_t> getStreamBlockList(uint32_t StreamIndex) const = 0;
|
||||
|
||||
virtual StringRef getBlockData(uint32_t BlockIndex,
|
||||
uint32_t NumBytes) const = 0;
|
||||
|
||||
virtual ArrayRef<support::ulittle32_t> getDirectoryBlockArray() = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
#define LLVM_DEBUGINFO_PDB_RAW_PDBFILE_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBFile.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
|
@ -28,27 +29,28 @@ class PublicsStream;
|
|||
class SymbolStream;
|
||||
class TpiStream;
|
||||
|
||||
class PDBFile {
|
||||
class PDBFile : public IPDBFile {
|
||||
public:
|
||||
explicit PDBFile(std::unique_ptr<MemoryBuffer> MemBuffer);
|
||||
~PDBFile();
|
||||
~PDBFile() override;
|
||||
|
||||
uint32_t getBlockSize() const;
|
||||
uint32_t getUnknown0() const;
|
||||
uint32_t getBlockCount() const;
|
||||
uint32_t getNumDirectoryBytes() const;
|
||||
uint32_t getBlockMapIndex() const;
|
||||
uint32_t getUnknown1() const;
|
||||
uint32_t getNumDirectoryBlocks() const;
|
||||
uint64_t getBlockMapOffset() const;
|
||||
|
||||
uint32_t getNumStreams() const;
|
||||
uint32_t getStreamByteSize(uint32_t StreamIndex) const;
|
||||
ArrayRef<uint32_t> getStreamBlockList(uint32_t StreamIndex) const;
|
||||
uint32_t getBlockSize() const override;
|
||||
uint32_t getBlockCount() const override;
|
||||
uint32_t getNumDirectoryBytes() const override;
|
||||
uint32_t getBlockMapIndex() const override;
|
||||
uint32_t getNumDirectoryBlocks() const override;
|
||||
uint64_t getBlockMapOffset() const override;
|
||||
|
||||
StringRef getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const;
|
||||
uint32_t getNumStreams() const override;
|
||||
uint32_t getStreamByteSize(uint32_t StreamIndex) const override;
|
||||
ArrayRef<uint32_t> getStreamBlockList(uint32_t StreamIndex) const override;
|
||||
|
||||
ArrayRef<support::ulittle32_t> getDirectoryBlockArray();
|
||||
StringRef getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const override;
|
||||
|
||||
ArrayRef<support::ulittle32_t> getDirectoryBlockArray() override;
|
||||
|
||||
Error parseFileHeaders();
|
||||
Error parseStreamData();
|
||||
|
|
|
|||
Loading…
Reference in New Issue