Recommit r310809 with a fix for the spill problem
[llvm-core.git] / tools / llvm-pdbutil / StreamUtil.h
blob443267ca3290844f6743307b3c6143a357e5b45c
1 //===- Streamutil.h - PDB stream utilities ----------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
11 #define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringRef.h"
17 #include <string>
19 namespace llvm {
20 namespace pdb {
21 class PDBFile;
22 enum class StreamPurpose { NamedStream, ModuleStream, Symbols, Other };
24 struct StreamInfo {
25 public:
26 StreamInfo() {}
28 uint32_t getModuleIndex() const { return *ModuleIndex; }
29 StreamPurpose getPurpose() const { return Purpose; }
30 StringRef getShortName() const { return Name; }
31 uint32_t getStreamIndex() const { return StreamIndex; }
32 std::string getLongName() const;
34 static StreamInfo createStream(StreamPurpose Purpose, StringRef Name,
35 uint32_t StreamIndex);
36 static StreamInfo createModuleStream(StringRef Module, uint32_t StreamIndex,
37 uint32_t Modi);
39 private:
40 StreamPurpose Purpose;
41 uint32_t StreamIndex;
42 std::string Name;
43 Optional<uint32_t> ModuleIndex;
46 void discoverStreamPurposes(PDBFile &File,
47 SmallVectorImpl<StreamInfo> &Streams);
51 #endif