Fix test failures introduced by PR #113697 (#116941)
[llvm-project.git] / llvm / tools / llvm-pdbutil / StreamUtil.h
blob9d6030c7ba9c4a5681737c0051ad69458d465a9c
1 //===- Streamutil.h - PDB stream utilities ----------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H
12 #include "llvm/ADT/SmallVector.h"
13 #include "llvm/ADT/StringRef.h"
15 #include <string>
16 #include <optional>
18 namespace llvm {
19 namespace pdb {
20 class PDBFile;
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
36 struct StreamInfo {
37 public:
38 StreamInfo() {}
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;
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);
51 private:
52 StreamPurpose Purpose;
53 uint32_t StreamIndex;
54 std::string Name;
55 std::optional<uint32_t> ModuleIndex;
58 void discoverStreamPurposes(PDBFile &File,
59 SmallVectorImpl<StreamInfo> &Streams);
63 #endif