1 //===- DebugTypes.h ---------------------------------------------*- 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 //===----------------------------------------------------------------------===// 8 9 #ifndef LLD_COFF_DEBUGTYPES_H 10 #define LLD_COFF_DEBUGTYPES_H 11 12 #include "llvm/Support/Error.h" 13 #include "llvm/Support/MemoryBuffer.h" 14 15 namespace llvm { 16 namespace codeview { 17 class PrecompRecord; 18 class TypeServer2Record; 19 } // namespace codeview 20 namespace pdb { 21 class NativeSession; 22 } 23 } // namespace llvm 24 25 namespace lld { 26 namespace coff { 27 28 class ObjFile; 29 30 class TpiSource { 31 public: 32 enum TpiKind { Regular, PCH, UsingPCH, PDB, UsingPDB }; 33 34 TpiSource(TpiKind k, const ObjFile *f); 35 virtual ~TpiSource() {} 36 37 const TpiKind kind; 38 const ObjFile *file; 39 }; 40 41 TpiSource *makeTpiSource(const ObjFile *f); 42 TpiSource *makeUseTypeServerSource(const ObjFile *f, 43 const llvm::codeview::TypeServer2Record *ts); 44 TpiSource *makePrecompSource(const ObjFile *f); 45 TpiSource *makeUsePrecompSource(const ObjFile *f, 46 const llvm::codeview::PrecompRecord *precomp); 47 48 void loadTypeServerSource(llvm::MemoryBufferRef m); 49 50 // Temporary interface to get the dependency 51 template <typename T> const T &retrieveDependencyInfo(const TpiSource *source); 52 53 // Temporary interface until we move PDBLinker::maybeMergeTypeServerPDB here 54 llvm::Expected<llvm::pdb::NativeSession *> 55 findTypeServerSource(const ObjFile *f); 56 57 } // namespace coff 58 } // namespace lld 59 60 #endif