2017-03-14 07:28:25 +08:00
|
|
|
//===- Streamutil.h - PDB stream utilities ----------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
|
|
|
|
#define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
|
|
|
|
|
2017-08-21 22:53:25 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
2017-03-14 07:28:25 +08:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2017-08-21 22:53:25 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2017-03-14 07:28:25 +08:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace pdb {
|
|
|
|
class PDBFile;
|
2018-03-31 01:16:50 +08:00
|
|
|
enum class StreamPurpose {
|
|
|
|
NamedStream,
|
|
|
|
ModuleStream,
|
|
|
|
Symbols,
|
|
|
|
PDB,
|
|
|
|
DBI,
|
|
|
|
TPI,
|
|
|
|
IPI,
|
|
|
|
GlobalHash,
|
|
|
|
PublicHash,
|
|
|
|
TpiHash,
|
|
|
|
IpiHash,
|
|
|
|
Other
|
|
|
|
};
|
2017-08-21 22:53:25 +08:00
|
|
|
|
|
|
|
struct StreamInfo {
|
|
|
|
public:
|
|
|
|
StreamInfo() {}
|
|
|
|
|
|
|
|
uint32_t getModuleIndex() const { return *ModuleIndex; }
|
|
|
|
StreamPurpose getPurpose() const { return Purpose; }
|
|
|
|
StringRef getShortName() const { return Name; }
|
|
|
|
uint32_t getStreamIndex() const { return StreamIndex; }
|
|
|
|
std::string getLongName() const;
|
|
|
|
|
|
|
|
static StreamInfo createStream(StreamPurpose Purpose, StringRef Name,
|
|
|
|
uint32_t StreamIndex);
|
|
|
|
static StreamInfo createModuleStream(StringRef Module, uint32_t StreamIndex,
|
|
|
|
uint32_t Modi);
|
|
|
|
|
|
|
|
private:
|
|
|
|
StreamPurpose Purpose;
|
|
|
|
uint32_t StreamIndex;
|
|
|
|
std::string Name;
|
|
|
|
Optional<uint32_t> ModuleIndex;
|
|
|
|
};
|
2017-07-11 03:16:49 +08:00
|
|
|
|
2017-03-14 07:28:25 +08:00
|
|
|
void discoverStreamPurposes(PDBFile &File,
|
2017-08-21 22:53:25 +08:00
|
|
|
SmallVectorImpl<StreamInfo> &Streams);
|
2017-03-14 07:28:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|