LLVM  4.0.0
ModInfo.h
Go to the documentation of this file.
1 //===- ModInfo.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_MODINFO_H
11 #define LLVM_DEBUGINFO_PDB_RAW_MODINFO_H
12 
13 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/Error.h"
18 #include <cstdint>
19 #include <vector>
20 
21 namespace llvm {
22 
23 namespace pdb {
24 
25 class ModInfo {
26  friend class DbiStreamBuilder;
27 
28 public:
29  ModInfo();
30  ModInfo(const ModInfo &Info);
31  ~ModInfo();
32 
33  static Error initialize(msf::ReadableStreamRef Stream, ModInfo &Info);
34 
35  bool hasECInfo() const;
36  uint16_t getTypeServerIndex() const;
37  uint16_t getModuleStreamIndex() const;
41  uint32_t getNumberOfFiles() 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 struct ModuleInfoEx {
57  ModuleInfoEx(const ModInfo &Info) : Info(Info) {}
58  ModuleInfoEx(const ModuleInfoEx &Ex) = default;
59 
61  std::vector<StringRef> SourceFiles;
62 };
63 
64 } // end namespace pdb
65 
66 namespace msf {
67 
68 template <> struct VarStreamArrayExtractor<pdb::ModInfo> {
70  pdb::ModInfo &Info) const {
71  if (auto EC = pdb::ModInfo::initialize(Stream, Info))
72  return EC;
73  Length = Info.getRecordLength();
74  return Error::success();
75  }
76 };
77 
78 } // end namespace msf
79 
80 } // end namespace llvm
81 
82 #endif // LLVM_DEBUGINFO_PDB_RAW_MODINFO_H
StringRef getObjFileName() const
Definition: ModInfo.cpp:73
uint32_t getNumberOfFiles() const
Definition: ModInfo.cpp:61
uint32_t getC13LineInfoByteSize() const
Definition: ModInfo.cpp:59
static Error initialize(msf::ReadableStreamRef Stream, ModInfo &Info)
Definition: ModInfo.cpp:29
uint32_t getPdbFilePathNameIndex() const
Definition: ModInfo.cpp:67
std::vector< StringRef > SourceFiles
Definition: ModInfo.h:61
ModuleInfoEx(const ModInfo &Info)
Definition: ModInfo.h:57
The header preceeding each entry in the Module Info substream of the DBI stream.
Definition: RawTypes.h:215
uint32_t getRecordLength() const
Definition: ModInfo.cpp:75
uint32_t getLineInfoByteSize() const
Definition: ModInfo.cpp:57
uint16_t getTypeServerIndex() const
Definition: ModInfo.cpp:46
uint16_t getModuleStreamIndex() const
Definition: ModInfo.cpp:51
static ErrorSuccess success()
Create a success value.
Error operator()(ReadableStreamRef Stream, uint32_t &Length, pdb::ModInfo &Info) const
Definition: ModInfo.h:69
uint32_t getSymbolDebugInfoByteSize() const
Definition: ModInfo.cpp:53
uint32_t getSourceFileNameIndex() const
Definition: ModInfo.cpp:63
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic...
Definition: StreamArray.h:35
StringRef getModuleName() const
Definition: ModInfo.cpp:71
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
bool hasECInfo() const
Definition: ModInfo.cpp:42