[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / llvm / lib / DebugInfo / PDB / DIA / DIAFrameData.cpp
blob7975156b1abde66b1d6f4e8be5dc4fc8afdfed0a
1 //===- DIAFrameData.cpp - DIA impl. of IPDBFrameData -------------- 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 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/DIA/DIAFrameData.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
11 #include "llvm/DebugInfo/PDB/DIA/DIAUtils.h"
13 using namespace llvm::pdb;
15 DIAFrameData::DIAFrameData(CComPtr<IDiaFrameData> DiaFrameData)
16 : FrameData(DiaFrameData) {}
18 template <typename ArgType>
19 ArgType
20 PrivateGetDIAValue(IDiaFrameData *FrameData,
21 HRESULT (__stdcall IDiaFrameData::*Method)(ArgType *)) {
22 ArgType Value;
23 if (S_OK == (FrameData->*Method)(&Value))
24 return static_cast<ArgType>(Value);
26 return ArgType();
29 uint32_t DIAFrameData::getAddressOffset() const {
30 return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_addressOffset);
33 uint32_t DIAFrameData::getAddressSection() const {
34 return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_addressSection);
37 uint32_t DIAFrameData::getLengthBlock() const {
38 return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_lengthBlock);
41 std::string DIAFrameData::getProgram() const {
42 return invokeBstrMethod(*FrameData, &IDiaFrameData::get_program);
45 uint32_t DIAFrameData::getRelativeVirtualAddress() const {
46 return PrivateGetDIAValue(FrameData,
47 &IDiaFrameData::get_relativeVirtualAddress);
50 uint64_t DIAFrameData::getVirtualAddress() const {
51 return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_virtualAddress);