Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 1 | //===- Streamutil.h - PDB stream utilities ----------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H |
| 10 | #define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H |
| 11 | |
Zachary Turner | d1de2f4 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 12 | #include "llvm/ADT/Optional.h" |
Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/SmallVector.h" |
Zachary Turner | d1de2f4 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 14 | #include "llvm/ADT/StringRef.h" |
Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 15 | |
| 16 | #include <string> |
| 17 | |
| 18 | namespace llvm { |
| 19 | namespace pdb { |
| 20 | class PDBFile; |
Zachary Turner | d5cf5cf | 2018-03-30 17:16:50 +0000 | [diff] [blame] | 21 | enum class StreamPurpose { |
| 22 | NamedStream, |
| 23 | ModuleStream, |
| 24 | Symbols, |
| 25 | PDB, |
| 26 | DBI, |
| 27 | TPI, |
| 28 | IPI, |
| 29 | GlobalHash, |
| 30 | PublicHash, |
| 31 | TpiHash, |
| 32 | IpiHash, |
| 33 | Other |
| 34 | }; |
Zachary Turner | d1de2f4 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 35 | |
| 36 | struct StreamInfo { |
| 37 | public: |
| 38 | StreamInfo() {} |
| 39 | |
| 40 | uint32_t getModuleIndex() const { return *ModuleIndex; } |
| 41 | StreamPurpose getPurpose() const { return Purpose; } |
| 42 | StringRef getShortName() const { return Name; } |
| 43 | uint32_t getStreamIndex() const { return StreamIndex; } |
| 44 | std::string getLongName() const; |
| 45 | |
| 46 | static StreamInfo createStream(StreamPurpose Purpose, StringRef Name, |
| 47 | uint32_t StreamIndex); |
| 48 | static StreamInfo createModuleStream(StringRef Module, uint32_t StreamIndex, |
| 49 | uint32_t Modi); |
| 50 | |
| 51 | private: |
| 52 | StreamPurpose Purpose; |
| 53 | uint32_t StreamIndex; |
| 54 | std::string Name; |
| 55 | Optional<uint32_t> ModuleIndex; |
| 56 | }; |
Zachary Turner | a9d944f | 2017-07-10 19:16:49 +0000 | [diff] [blame] | 57 | |
Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 58 | void discoverStreamPurposes(PDBFile &File, |
Zachary Turner | d1de2f4 | 2017-08-21 14:53:25 +0000 | [diff] [blame] | 59 | SmallVectorImpl<StreamInfo> &Streams); |
Zachary Turner | 6ac232c | 2017-03-13 23:28:25 +0000 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| 63 | #endif |