1 //===- DIATable.cpp - DIA implementation of IPDBTable -----------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/DebugInfo/PDB/DIA/DIATable.h" 10 #include "llvm/DebugInfo/PDB/DIA/DIAUtils.h" 11 12 using namespace llvm; 13 using namespace llvm::pdb; 14 DIATable(CComPtr<IDiaTable> DiaTable)15DIATable::DIATable(CComPtr<IDiaTable> DiaTable) : Table(DiaTable) {} 16 getItemCount() const17uint32_t DIATable::getItemCount() const { 18 LONG Count = 0; 19 return (S_OK == Table->get_Count(&Count)) ? Count : 0; 20 } 21 getName() const22std::string DIATable::getName() const { 23 return invokeBstrMethod(*Table, &IDiaTable::get_name); 24 } 25 getTableType() const26PDB_TableType DIATable::getTableType() const { 27 CComBSTR Name16; 28 if (S_OK != Table->get_name(&Name16)) 29 return PDB_TableType::TableInvalid; 30 31 if (Name16 == DiaTable_Symbols) 32 return PDB_TableType::Symbols; 33 if (Name16 == DiaTable_SrcFiles) 34 return PDB_TableType::SourceFiles; 35 if (Name16 == DiaTable_Sections) 36 return PDB_TableType::SectionContribs; 37 if (Name16 == DiaTable_LineNums) 38 return PDB_TableType::LineNumbers; 39 if (Name16 == DiaTable_SegMap) 40 return PDB_TableType::Segments; 41 if (Name16 == DiaTable_InjSrc) 42 return PDB_TableType::InjectedSources; 43 if (Name16 == DiaTable_FrameData) 44 return PDB_TableType::FrameData; 45 if (Name16 == DiaTable_InputAssemblyFiles) 46 return PDB_TableType::InputAssemblyFiles; 47 if (Name16 == DiaTable_Dbg) 48 return PDB_TableType::Dbg; 49 return PDB_TableType::TableInvalid; 50 } 51