Zachary Turner | 435ba4a | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 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 | |
Zachary Turner | b6d8c58 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/Optional.h" |
Zachary Turner | 435ba4a | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 14 | #include "llvm/ADT/SmallVector.h" |
Zachary Turner | b6d8c58 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/StringRef.h" |
Zachary Turner | 435ba4a | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 16 | |
| 17 | #include <string> |
| 18 | |
| 19 | namespace llvm { |
| 20 | namespace pdb { |
| 21 | class PDBFile; |
Zachary Turner | 21ff13f | 2018-03-30 17:16:50 +0000 | [diff] [blame] | 22 | enum class StreamPurpose { |
| 23 | NamedStream, |
| 24 | ModuleStream, |
| 25 | Symbols, |
| 26 | PDB, |
| 27 | DBI, |
| 28 | TPI, |
| 29 | IPI, |
| 30 | GlobalHash, |
| 31 | PublicHash, |
| 32 | TpiHash, |
| 33 | IpiHash, |
| 34 | Other |
| 35 | }; |
Zachary Turner | b6d8c58 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 36 | |
| 37 | struct StreamInfo { |
| 38 | public: |
| 39 | StreamInfo() {} |
| 40 | |
| 41 | uint32_t getModuleIndex() const { return *ModuleIndex; } |
| 42 | StreamPurpose getPurpose() const { return Purpose; } |
| 43 | StringRef getShortName() const { return Name; } |
| 44 | uint32_t getStreamIndex() const { return StreamIndex; } |
| 45 | std::string getLongName() const; |
| 46 | |
| 47 | static StreamInfo createStream(StreamPurpose Purpose, StringRef Name, |
| 48 | uint32_t StreamIndex); |
| 49 | static StreamInfo createModuleStream(StringRef Module, uint32_t StreamIndex, |
| 50 | uint32_t Modi); |
| 51 | |
| 52 | private: |
| 53 | StreamPurpose Purpose; |
| 54 | uint32_t StreamIndex; |
| 55 | std::string Name; |
| 56 | Optional<uint32_t> ModuleIndex; |
| 57 | }; |
Zachary Turner | 8f32109 | 2017-07-10 19:16:49 +0000 | [diff] [blame] | 58 | |
Zachary Turner | 435ba4a | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 59 | void discoverStreamPurposes(PDBFile &File, |
Zachary Turner | b6d8c58 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 60 | SmallVectorImpl<StreamInfo> &Streams); |
Zachary Turner | 435ba4a | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | |
| 64 | #endif |