File indexing completed on 2026-05-10 08:43:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
0010 #define LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H
0011
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/DebugInfo/PDB/DIA/DIASupport.h"
0014 #include "llvm/Support/ConvertUTF.h"
0015
0016 template <typename Obj>
0017 std::string invokeBstrMethod(Obj &Object,
0018 HRESULT (__stdcall Obj::*Func)(BSTR *)) {
0019 CComBSTR Str16;
0020 HRESULT Result = (Object.*Func)(&Str16);
0021 if (S_OK != Result)
0022 return std::string();
0023
0024 std::string Str8;
0025 llvm::ArrayRef<char> StrBytes(reinterpret_cast<char *>(Str16.m_str),
0026 Str16.ByteLength());
0027 llvm::convertUTF16ToUTF8String(StrBytes, Str8);
0028 return Str8;
0029 }
0030
0031 #endif