]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-pdbutil/StreamUtil.h
Merge lldb trunk r321017 to contrib/llvm/tools/lldb.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-pdbutil / StreamUtil.h
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 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
11 #define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
12
13 #include "llvm/ADT/Optional.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringRef.h"
16
17 #include <string>
18
19 namespace llvm {
20 namespace pdb {
21 class PDBFile;
22 enum class StreamPurpose { NamedStream, ModuleStream, Symbols, Other };
23
24 struct StreamInfo {
25 public:
26   StreamInfo() {}
27
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;
33
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);
38
39 private:
40   StreamPurpose Purpose;
41   uint32_t StreamIndex;
42   std::string Name;
43   Optional<uint32_t> ModuleIndex;
44 };
45
46 void discoverStreamPurposes(PDBFile &File,
47                             SmallVectorImpl<StreamInfo> &Streams);
48 }
49 }
50
51 #endif