DxilDiaTableInjectedSources.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilDiaTableInjectedSources.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // DIA API implementation for DXIL modules. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. #include "dxc/Support/WinIncludes.h"
  13. #include <vector>
  14. #include "dia2.h"
  15. #include "dxc/Support/Global.h"
  16. #include "dxc/Support/microcom.h"
  17. #include "llvm/ADT/StringRef.h"
  18. #include "llvm/IR/Metadata.h"
  19. #include "DxilDia.h"
  20. #include "DxilDiaTable.h"
  21. namespace dxil_dia {
  22. class InjectedSource : public IDiaInjectedSource {
  23. private:
  24. DXC_MICROCOM_TM_REF_FIELDS()
  25. CComPtr<Session> m_pSession;
  26. DWORD m_index;
  27. public:
  28. DXC_MICROCOM_TM_ADDREF_RELEASE_IMPL()
  29. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) {
  30. return DoBasicQueryInterface<IDiaInjectedSource>(this, iid, ppvObject);
  31. }
  32. InjectedSource(IMalloc *pMalloc, Session *pSession, DWORD index)
  33. : m_pMalloc(pMalloc), m_pSession(pSession), m_index(index) {}
  34. llvm::MDTuple *NameContent();
  35. llvm::StringRef Name();
  36. llvm::StringRef Content();
  37. STDMETHODIMP get_crc(
  38. /* [retval][out] */ DWORD *pRetVal) override { return ENotImpl(); }
  39. STDMETHODIMP get_length(_Out_ ULONGLONG *pRetVal) override;
  40. STDMETHODIMP get_filename(BSTR *pRetVal) override;
  41. STDMETHODIMP get_objectFilename(BSTR *pRetVal) override;
  42. STDMETHODIMP get_virtualFilename(BSTR *pRetVal) override;
  43. STDMETHODIMP get_sourceCompression(
  44. /* [retval][out] */ DWORD *pRetVal) override { return ENotImpl(); }
  45. STDMETHODIMP get_source(
  46. /* [in] */ DWORD cbData,
  47. /* [out] */ DWORD *pcbData,
  48. /* [size_is][out] */ BYTE *pbData) override;
  49. };
  50. class InjectedSourcesTable : public impl::TableBase<IDiaEnumInjectedSources,
  51. IDiaInjectedSource> {
  52. public:
  53. InjectedSourcesTable(IMalloc *pMalloc, Session *pSession);
  54. HRESULT GetItem(DWORD index, IDiaInjectedSource **ppItem) override;
  55. void Init(llvm::StringRef filename);
  56. private:
  57. std::vector<unsigned> m_indexList;
  58. };
  59. } // namespace dxil_dia