1 //===- DIAUtils.h - Utility functions for working with DIA ------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
10 #define LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/Support/ConvertUTF.h"
15 template <typename Obj
>
16 std::string
invokeBstrMethod(Obj
&Object
,
17 HRESULT (__stdcall
Obj::*Func
)(BSTR
*)) {
19 HRESULT Result
= (Object
.*Func
)(&Str16
);
24 llvm::ArrayRef
<char> StrBytes(reinterpret_cast<char *>(Str16
.m_str
),
26 llvm::convertUTF16ToUTF8String(StrBytes
, Str8
);
30 #endif // LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H