LLVM  8.0.1
DIASectionContrib.cpp
Go to the documentation of this file.
1 //===- DIASectionContrib.cpp - DIA impl. of IPDBSectionContrib ---- 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 
14 
15 using namespace llvm;
16 using namespace llvm::pdb;
17 
19  CComPtr<IDiaSectionContrib> DiaSection)
20  : Session(PDBSession), Section(DiaSection) {}
21 
22 std::unique_ptr<PDBSymbolCompiland> DIASectionContrib::getCompiland() const {
23  CComPtr<IDiaSymbol> Symbol;
24  if (FAILED(Section->get_compiland(&Symbol)))
25  return nullptr;
26 
27  auto RawSymbol = llvm::make_unique<DIARawSymbol>(Session, Symbol);
28  return PDBSymbol::createAs<PDBSymbolCompiland>(Session, std::move(RawSymbol));
29 }
30 
31 template <typename ArgType>
32 ArgType
33 PrivateGetDIAValue(IDiaSectionContrib *Section,
34  HRESULT (__stdcall IDiaSectionContrib::*Method)(ArgType *)) {
35  ArgType Value;
36  if (S_OK == (Section->*Method)(&Value))
37  return static_cast<ArgType>(Value);
38 
39  return ArgType();
40 }
41 
43  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressSection);
44 }
45 
47  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressOffset);
48 }
49 
51  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_virtualAddress);
52 }
53 
55  return PrivateGetDIAValue(Section,
56  &IDiaSectionContrib::get_relativeVirtualAddress);
57 }
58 
60  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_length);
61 }
62 
64  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notPaged);
65 }
66 
68  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code);
69 }
70 
72  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code16bit);
73 }
74 
76  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_initializedData);
77 }
78 
80  return PrivateGetDIAValue(Section,
81  &IDiaSectionContrib::get_uninitializedData);
82 }
83 
85  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_remove);
86 }
87 
89  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_comdat);
90 }
91 
93  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_discardable);
94 }
95 
97  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notCached);
98 }
99 
101  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_share);
102 }
103 
105  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_execute);
106 }
107 
109  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_read);
110 }
111 
113  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_write);
114 }
115 
117  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_dataCrc);
118 }
119 
121  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_relocationsCrc);
122 }
123 
125  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_compilandId);
126 }
bool hasCode() const override
This class represents lattice values for constants.
Definition: AllocatorList.h:24
uint32_t getRelocationsCrc32() const override
bool hasCode16Bit() const override
bool isExecutable() const override
bool hasComdat() const override
bool isRemoved() const override
bool isShared() const override
ArgType PrivateGetDIAValue(IDiaSectionContrib *Section, HRESULT(__stdcall IDiaSectionContrib::*Method)(ArgType *))
DIASectionContrib(const DIASession &PDBSession, CComPtr< IDiaSectionContrib > DiaSection)
bool isDiscardable() const override
bool isNotCached() const override
bool hasUninitializedData() const override
uint32_t getRelativeVirtualAddress() const override
std::unique_ptr< PDBSymbolCompiland > getCompiland() const override
bool isNotPaged() const override
bool isWritable() const override
bool isReadable() const override
uint32_t getLength() const override
uint64_t getVirtualAddress() const override
bool hasInitializedData() const override
LLVM Value Representation.
Definition: Value.h:73
uint32_t getCompilandId() const override
uint32_t getAddressOffset() const override
uint32_t getAddressSection() const override
uint32_t getDataCrc32() const override