LLVM  6.0.0svn
DbiModuleDescriptor.cpp
Go to the documentation of this file.
1 //===- DbiModuleDescriptor.cpp - PDB module information -------------------===//
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 
13 #include "llvm/Support/Endian.h"
14 #include "llvm/Support/Error.h"
16 #include <cstdint>
17 
18 using namespace llvm;
19 using namespace llvm::pdb;
20 using namespace llvm::support;
21 
23 
25  default;
26 
28 
30  DbiModuleDescriptor &Info) {
31  BinaryStreamReader Reader(Stream);
32  if (auto EC = Reader.readObject(Info.Layout))
33  return EC;
34 
35  if (auto EC = Reader.readCString(Info.ModuleName))
36  return EC;
37 
38  if (auto EC = Reader.readCString(Info.ObjFileName))
39  return EC;
40  return Error::success();
41 }
42 
44  return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;
45 }
46 
48  return (Layout->Flags & ModInfoFlags::TypeServerIndexMask) >>
50 }
51 
53  return Layout->ModDiStream;
54 }
55 
57  return Layout->SymBytes;
58 }
59 
61  return Layout->C11Bytes;
62 }
63 
65  return Layout->C13Bytes;
66 }
67 
69  return Layout->NumFiles;
70 }
71 
73  return Layout->SrcFileNameNI;
74 }
75 
77  return Layout->PdbFilePathNI;
78 }
79 
80 StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }
81 
82 StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }
83 
85  uint32_t M = ModuleName.str().size() + 1;
86  uint32_t O = ObjFileName.str().size() + 1;
87  uint32_t Size = sizeof(ModuleInfoHeader) + M + O;
88  Size = alignTo(Size, 4);
89  return Size;
90 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static const uint16_t HasECFlagMask
uint16_t fWritten : 1; // True if DbiModuleDescriptor is dirty uint16_t fECEnabled : 1; // Is EC symb...
Definition: RawTypes.h:215
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
Definition: MathExtras.h:677
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
static Error initialize(BinaryStreamRef Stream, DbiModuleDescriptor &Info)
The header preceeding each entry in the Module Info substream of the DBI stream.
Definition: RawTypes.h:223
static const uint16_t TypeServerIndexShift
Definition: RawTypes.h:218
static ErrorSuccess success()
Create a success value.
Definition: Error.h:313
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
static const uint16_t TypeServerIndexMask
Definition: RawTypes.h:217
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49