Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:44

0001 //===- DIAUtils.h - Utility functions for working with DIA ------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
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 // LLVM_DEBUGINFO_PDB_DIA_DIAUTILS_H