10b57cec5SDimitry Andric //===- Streamutil.h - PDB stream utilities ----------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric #ifndef LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H 100b57cec5SDimitry Andric #define LLVM_TOOLS_LLVMPDBDUMP_STREAMUTIL_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "llvm/ADT/SmallVector.h" 130b57cec5SDimitry Andric #include "llvm/ADT/StringRef.h" 140b57cec5SDimitry Andric 150b57cec5SDimitry Andric #include <string> 16*bdd1243dSDimitry Andric #include <optional> 170b57cec5SDimitry Andric 180b57cec5SDimitry Andric namespace llvm { 190b57cec5SDimitry Andric namespace pdb { 200b57cec5SDimitry Andric class PDBFile; 210b57cec5SDimitry Andric enum class StreamPurpose { 220b57cec5SDimitry Andric NamedStream, 230b57cec5SDimitry Andric ModuleStream, 240b57cec5SDimitry Andric Symbols, 250b57cec5SDimitry Andric PDB, 260b57cec5SDimitry Andric DBI, 270b57cec5SDimitry Andric TPI, 280b57cec5SDimitry Andric IPI, 290b57cec5SDimitry Andric GlobalHash, 300b57cec5SDimitry Andric PublicHash, 310b57cec5SDimitry Andric TpiHash, 320b57cec5SDimitry Andric IpiHash, 330b57cec5SDimitry Andric Other 340b57cec5SDimitry Andric }; 350b57cec5SDimitry Andric 360b57cec5SDimitry Andric struct StreamInfo { 370b57cec5SDimitry Andric public: StreamInfoStreamInfo380b57cec5SDimitry Andric StreamInfo() {} 390b57cec5SDimitry Andric getModuleIndexStreamInfo400b57cec5SDimitry Andric uint32_t getModuleIndex() const { return *ModuleIndex; } getPurposeStreamInfo410b57cec5SDimitry Andric StreamPurpose getPurpose() const { return Purpose; } getShortNameStreamInfo420b57cec5SDimitry Andric StringRef getShortName() const { return Name; } getStreamIndexStreamInfo430b57cec5SDimitry Andric uint32_t getStreamIndex() const { return StreamIndex; } 440b57cec5SDimitry Andric std::string getLongName() const; 450b57cec5SDimitry Andric 460b57cec5SDimitry Andric static StreamInfo createStream(StreamPurpose Purpose, StringRef Name, 470b57cec5SDimitry Andric uint32_t StreamIndex); 480b57cec5SDimitry Andric static StreamInfo createModuleStream(StringRef Module, uint32_t StreamIndex, 490b57cec5SDimitry Andric uint32_t Modi); 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric private: 520b57cec5SDimitry Andric StreamPurpose Purpose; 530b57cec5SDimitry Andric uint32_t StreamIndex; 540b57cec5SDimitry Andric std::string Name; 55*bdd1243dSDimitry Andric std::optional<uint32_t> ModuleIndex; 560b57cec5SDimitry Andric }; 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric void discoverStreamPurposes(PDBFile &File, 590b57cec5SDimitry Andric SmallVectorImpl<StreamInfo> &Streams); 600b57cec5SDimitry Andric } 610b57cec5SDimitry Andric } 620b57cec5SDimitry Andric 630b57cec5SDimitry Andric #endif 64