LLVM  14.0.0git
DIASectionContrib.cpp
Go to the documentation of this file.
1 //===- DIASectionContrib.cpp - DIA impl. of IPDBSectionContrib ---- 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 
13 
14 using namespace llvm;
15 using namespace llvm::pdb;
16 
18  CComPtr<IDiaSectionContrib> DiaSection)
19  : Session(PDBSession), Section(DiaSection) {}
20 
21 std::unique_ptr<PDBSymbolCompiland> DIASectionContrib::getCompiland() const {
22  CComPtr<IDiaSymbol> Symbol;
23  if (FAILED(Section->get_compiland(&Symbol)))
24  return nullptr;
25 
26  auto RawSymbol = std::make_unique<DIARawSymbol>(Session, Symbol);
27  return PDBSymbol::createAs<PDBSymbolCompiland>(Session, std::move(RawSymbol));
28 }
29 
30 template <typename ArgType>
31 ArgType
32 PrivateGetDIAValue(IDiaSectionContrib *Section,
33  HRESULT (__stdcall IDiaSectionContrib::*Method)(ArgType *)) {
34  ArgType Value;
35  if (S_OK == (Section->*Method)(&Value))
36  return static_cast<ArgType>(Value);
37 
38  return ArgType();
39 }
40 
42  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressSection);
43 }
44 
46  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressOffset);
47 }
48 
50  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_virtualAddress);
51 }
52 
54  return PrivateGetDIAValue(Section,
55  &IDiaSectionContrib::get_relativeVirtualAddress);
56 }
57 
59  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_length);
60 }
61 
63  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notPaged);
64 }
65 
67  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code);
68 }
69 
71  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code16bit);
72 }
73 
75  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_initializedData);
76 }
77 
79  return PrivateGetDIAValue(Section,
80  &IDiaSectionContrib::get_uninitializedData);
81 }
82 
84  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_remove);
85 }
86 
88  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_comdat);
89 }
90 
92  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_discardable);
93 }
94 
96  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notCached);
97 }
98 
100  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_share);
101 }
102 
104  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_execute);
105 }
106 
108  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_read);
109 }
110 
112  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_write);
113 }
114 
116  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_dataCrc);
117 }
118 
120  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_relocationsCrc);
121 }
122 
124  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_compilandId);
125 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::pdb::DIASectionContrib::isReadable
bool isReadable() const override
Definition: DIASectionContrib.cpp:107
llvm::pdb::DIASectionContrib::getRelocationsCrc32
uint32_t getRelocationsCrc32() const override
Definition: DIASectionContrib.cpp:119
llvm::pdb::DIASession
Definition: DIASession.h:22
llvm::pdb::DIASectionContrib::getCompiland
std::unique_ptr< PDBSymbolCompiland > getCompiland() const override
Definition: DIASectionContrib.cpp:21
llvm::pdb::DIASectionContrib::hasCode16Bit
bool hasCode16Bit() const override
Definition: DIASectionContrib.cpp:70
PrivateGetDIAValue
ArgType PrivateGetDIAValue(IDiaSectionContrib *Section, HRESULT(__stdcall IDiaSectionContrib::*Method)(ArgType *))
Definition: DIASectionContrib.cpp:32
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
llvm::pdb::DIASectionContrib::isExecutable
bool isExecutable() const override
Definition: DIASectionContrib.cpp:103
llvm::pdb::DIASectionContrib::getCompilandId
uint32_t getCompilandId() const override
Definition: DIASectionContrib.cpp:123
DIASectionContrib.h
llvm::pdb::DIASectionContrib::getDataCrc32
uint32_t getDataCrc32() const override
Definition: DIASectionContrib.cpp:115
llvm::pdb::DIASectionContrib::getAddressSection
uint32_t getAddressSection() const override
Definition: DIASectionContrib.cpp:41
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
llvm::pdb::DIASectionContrib::hasCode
bool hasCode() const override
Definition: DIASectionContrib.cpp:66
llvm::pdb::DIASectionContrib::getVirtualAddress
uint64_t getVirtualAddress() const override
Definition: DIASectionContrib.cpp:49
llvm::pdb::DIASectionContrib::getAddressOffset
uint32_t getAddressOffset() const override
Definition: DIASectionContrib.cpp:45
llvm::pdb::DIASectionContrib::hasUninitializedData
bool hasUninitializedData() const override
Definition: DIASectionContrib.cpp:78
uint64_t
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
PDBSymbolCompiland.h
llvm::pdb::DIASectionContrib::isDiscardable
bool isDiscardable() const override
Definition: DIASectionContrib.cpp:91
llvm::pdb::DIASectionContrib::isShared
bool isShared() const override
Definition: DIASectionContrib.cpp:99
llvm::pdb::DIASectionContrib::getLength
uint32_t getLength() const override
Definition: DIASectionContrib.cpp:58
DIASession.h
uint32_t
llvm::pdb::DIASectionContrib::DIASectionContrib
DIASectionContrib(const DIASession &PDBSession, CComPtr< IDiaSectionContrib > DiaSection)
Definition: DIASectionContrib.cpp:17
llvm::pdb::DIASectionContrib::getRelativeVirtualAddress
uint32_t getRelativeVirtualAddress() const override
Definition: DIASectionContrib.cpp:53
DIARawSymbol.h
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::pdb::DIASectionContrib::hasComdat
bool hasComdat() const override
Definition: DIASectionContrib.cpp:87
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::pdb::DIASectionContrib::hasInitializedData
bool hasInitializedData() const override
Definition: DIASectionContrib.cpp:74
llvm::pdb::DIASectionContrib::isNotPaged
bool isNotPaged() const override
Definition: DIASectionContrib.cpp:62
llvm::pdb::DIASectionContrib::isRemoved
bool isRemoved() const override
Definition: DIASectionContrib.cpp:83
llvm::pdb::DIASectionContrib::isNotCached
bool isNotCached() const override
Definition: DIASectionContrib.cpp:95
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::pdb::DIASectionContrib::isWritable
bool isWritable() const override
Definition: DIASectionContrib.cpp:111