189bca9e5SAaron Smith //===- DIATable.cpp - DIA implementation of IPDBTable -----------*- C++ -*-===// 289bca9e5SAaron Smith // 3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 689bca9e5SAaron Smith // 789bca9e5SAaron Smith //===----------------------------------------------------------------------===// 889bca9e5SAaron Smith 989bca9e5SAaron Smith #include "llvm/DebugInfo/PDB/DIA/DIATable.h" 10757274f9SAaron Smith #include "llvm/DebugInfo/PDB/DIA/DIAUtils.h" 1189bca9e5SAaron Smith 1289bca9e5SAaron Smith using namespace llvm; 1389bca9e5SAaron Smith using namespace llvm::pdb; 1489bca9e5SAaron Smith DIATable(CComPtr<IDiaTable> DiaTable)15757274f9SAaron SmithDIATable::DIATable(CComPtr<IDiaTable> DiaTable) : Table(DiaTable) {} 1689bca9e5SAaron Smith getItemCount() const1789bca9e5SAaron Smithuint32_t DIATable::getItemCount() const { 1889bca9e5SAaron Smith LONG Count = 0; 1989bca9e5SAaron Smith return (S_OK == Table->get_Count(&Count)) ? Count : 0; 2089bca9e5SAaron Smith } 2189bca9e5SAaron Smith getName() const2289bca9e5SAaron Smithstd::string DIATable::getName() const { 23757274f9SAaron Smith return invokeBstrMethod(*Table, &IDiaTable::get_name); 2489bca9e5SAaron Smith } 2589bca9e5SAaron Smith getTableType() const2689bca9e5SAaron SmithPDB_TableType DIATable::getTableType() const { 2789bca9e5SAaron Smith CComBSTR Name16; 2889bca9e5SAaron Smith if (S_OK != Table->get_name(&Name16)) 2989bca9e5SAaron Smith return PDB_TableType::TableInvalid; 3089bca9e5SAaron Smith 3189bca9e5SAaron Smith if (Name16 == DiaTable_Symbols) 3289bca9e5SAaron Smith return PDB_TableType::Symbols; 3389bca9e5SAaron Smith if (Name16 == DiaTable_SrcFiles) 3489bca9e5SAaron Smith return PDB_TableType::SourceFiles; 3589bca9e5SAaron Smith if (Name16 == DiaTable_Sections) 3689bca9e5SAaron Smith return PDB_TableType::SectionContribs; 3789bca9e5SAaron Smith if (Name16 == DiaTable_LineNums) 3889bca9e5SAaron Smith return PDB_TableType::LineNumbers; 3989bca9e5SAaron Smith if (Name16 == DiaTable_SegMap) 4089bca9e5SAaron Smith return PDB_TableType::Segments; 4189bca9e5SAaron Smith if (Name16 == DiaTable_InjSrc) 4289bca9e5SAaron Smith return PDB_TableType::InjectedSources; 4389bca9e5SAaron Smith if (Name16 == DiaTable_FrameData) 4489bca9e5SAaron Smith return PDB_TableType::FrameData; 4589bca9e5SAaron Smith if (Name16 == DiaTable_InputAssemblyFiles) 4689bca9e5SAaron Smith return PDB_TableType::InputAssemblyFiles; 4789bca9e5SAaron Smith if (Name16 == DiaTable_Dbg) 4889bca9e5SAaron Smith return PDB_TableType::Dbg; 49b5d17d8dSReid Kleckner return PDB_TableType::TableInvalid; 5089bca9e5SAaron Smith } 51