DxilDiaTable.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilDiaTable.cpp //
  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. #include "DxilDiaTable.h"
  12. #include "DxilDiaSession.h"
  13. #include "DxilDiaTableFrameData.h"
  14. #include "DxilDiaTableInjectedSources.h"
  15. #include "DxilDiaTableInputAssemblyFile.h"
  16. #include "DxilDiaTableLineNumbers.h"
  17. #include "DxilDiaTableSections.h"
  18. #include "DxilDiaTableSegmentMap.h"
  19. #include "DxilDiaTableSourceFiles.h"
  20. #include "DxilDiaTableSymbols.h"
  21. HRESULT dxil_dia::Table::Create(
  22. /* [in] */ Session *pSession,
  23. /* [in] */ Table::Kind kind,
  24. /* [out] */ IDiaTable **ppTable) {
  25. try {
  26. *ppTable = nullptr;
  27. IMalloc *pMalloc = pSession->GetMallocNoRef();
  28. switch (kind) {
  29. case Table::Kind::Symbols: *ppTable = CreateOnMalloc<SymbolsTable>(pMalloc, pSession); break;
  30. case Table::Kind::SourceFiles: *ppTable = CreateOnMalloc<SourceFilesTable>(pMalloc, pSession); break;
  31. case Table::Kind::LineNumbers: *ppTable = CreateOnMalloc<LineNumbersTable>(pMalloc, pSession); break;
  32. case Table::Kind::Sections: *ppTable = CreateOnMalloc<SectionsTable>(pMalloc, pSession); break;
  33. case Table::Kind::SegmentMap: *ppTable = CreateOnMalloc<SegmentMapTable>(pMalloc, pSession); break;
  34. case Table::Kind::InjectedSource: *ppTable = CreateOnMalloc<InjectedSourcesTable>(pMalloc, pSession); break;
  35. case Table::Kind::FrameData: *ppTable = CreateOnMalloc<FrameDataTable>(pMalloc, pSession); break;
  36. case Table::Kind::InputAssemblyFile: *ppTable = CreateOnMalloc<InputAssemblyFilesTable>(pMalloc, pSession); break;
  37. default: return E_FAIL;
  38. }
  39. if (*ppTable == nullptr)
  40. return E_OUTOFMEMORY;
  41. (*ppTable)->AddRef();
  42. return S_OK;
  43. } CATCH_CPP_RETURN_HRESULT();
  44. }