1 //===- DIATable.cpp - DIA implementation of IPDBTable -----------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/DebugInfo/PDB/DIA/DIATable.h"
10 #include "llvm/DebugInfo/PDB/DIA/DIAUtils.h"
13 using namespace llvm::pdb
;
15 DIATable::DIATable(CComPtr
<IDiaTable
> DiaTable
) : Table(DiaTable
) {}
17 uint32_t DIATable::getItemCount() const {
19 return (S_OK
== Table
->get_Count(&Count
)) ? Count
: 0;
22 std::string
DIATable::getName() const {
23 return invokeBstrMethod(*Table
, &IDiaTable::get_name
);
26 PDB_TableType
DIATable::getTableType() const {
28 if (S_OK
!= Table
->get_name(&Name16
))
29 return PDB_TableType::TableInvalid
;
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
;