Home | History | Annotate | Download | only in Native
      1 //===- DbiModuleDescriptor.h - PDB module information -----------*- 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_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H
     11 #define LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H
     12 
     13 #include "llvm/ADT/StringRef.h"
     14 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
     15 #include "llvm/Support/BinaryStreamArray.h"
     16 #include "llvm/Support/BinaryStreamRef.h"
     17 #include "llvm/Support/Error.h"
     18 #include <cstdint>
     19 #include <vector>
     20 
     21 namespace llvm {
     22 
     23 namespace pdb {
     24 
     25 class DbiModuleDescriptor {
     26   friend class DbiStreamBuilder;
     27 
     28 public:
     29   DbiModuleDescriptor();
     30   DbiModuleDescriptor(const DbiModuleDescriptor &Info);
     31   ~DbiModuleDescriptor();
     32 
     33   static Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info);
     34 
     35   bool hasECInfo() const;
     36   uint16_t getTypeServerIndex() const;
     37   uint16_t getModuleStreamIndex() const;
     38   uint32_t getSymbolDebugInfoByteSize() const;
     39   uint32_t getC11LineInfoByteSize() const;
     40   uint32_t getC13LineInfoByteSize() const;
     41   uint32_t getNumberOfFiles() const;
     42   uint32_t getSourceFileNameIndex() const;
     43   uint32_t getPdbFilePathNameIndex() const;
     44 
     45   StringRef getModuleName() const;
     46   StringRef getObjFileName() const;
     47 
     48   uint32_t getRecordLength() const;
     49 
     50 private:
     51   StringRef ModuleName;
     52   StringRef ObjFileName;
     53   const ModuleInfoHeader *Layout = nullptr;
     54 };
     55 
     56 } // end namespace pdb
     57 
     58 template <> struct VarStreamArrayExtractor<pdb::DbiModuleDescriptor> {
     59   Error operator()(BinaryStreamRef Stream, uint32_t &Length,
     60                    pdb::DbiModuleDescriptor &Info) {
     61     if (auto EC = pdb::DbiModuleDescriptor::initialize(Stream, Info))
     62       return EC;
     63     Length = Info.getRecordLength();
     64     return Error::success();
     65   }
     66 };
     67 
     68 } // end namespace llvm
     69 
     70 #endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULEDESCRIPTOR_H
     71