LLVM
17.0.0git
include
llvm
DebugInfo
PDB
DIA
DIAUtils.h
Go to the documentation of this file.
1
//===- DIAUtils.h - Utility functions for working with DIA ------*- 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
9
#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
10
#define LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
11
12
#include "
llvm/ADT/ArrayRef.h
"
13
#include "
llvm/Support/ConvertUTF.h
"
14
15
template
<
typename
Obj>
16
std::string
invokeBstrMethod
(Obj &Object,
17
HRESULT (__stdcall Obj::*Func)(BSTR *)) {
18
CComBSTR Str16;
19
HRESULT Result = (Object.*Func)(&Str16);
20
if
(S_OK != Result)
21
return
std::string();
22
23
std::string Str8;
24
llvm::ArrayRef<char>
StrBytes(
reinterpret_cast<
char
*
>
(Str16.m_str),
25
Str16.ByteLength());
26
llvm::convertUTF16ToUTF8String
(StrBytes, Str8);
27
return
Str8;
28
}
29
30
#endif // LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
invokeBstrMethod
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
Definition:
DIAUtils.h:16
llvm::convertUTF16ToUTF8String
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
Definition:
ConvertUTFWrapper.cpp:84
ArrayRef.h
llvm::ArrayRef< char >
ConvertUTF.h
Generated on Sat Jan 28 2023 08:47:05 for LLVM by
1.8.17