LLVM  7.0.0
DIATable.cpp
Go to the documentation of this file.
1 //===- DIATable.cpp - DIA implementation of IPDBTable -----------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/ArrayRef.h"
13 
14 using namespace llvm;
15 using namespace llvm::pdb;
16 
17 DIATable::DIATable(CComPtr<IDiaTable> DiaTable)
18  : Table(DiaTable) {}
19 
21  LONG Count = 0;
22  return (S_OK == Table->get_Count(&Count)) ? Count : 0;
23 }
24 
25 std::string DIATable::getName() const {
26  CComBSTR Name16;
27  if (S_OK != Table->get_name(&Name16))
28  return std::string();
29 
30  std::string Name8;
31  llvm::ArrayRef<char> Name16Bytes(reinterpret_cast<char *>(Name16.m_str),
32  Name16.ByteLength());
33  if (!llvm::convertUTF16ToUTF8String(Name16Bytes, Name8))
34  return std::string();
35  return Name8;
36 }
37 
39  CComBSTR Name16;
40  if (S_OK != Table->get_name(&Name16))
42 
43  if (Name16 == DiaTable_Symbols)
45  if (Name16 == DiaTable_SrcFiles)
47  if (Name16 == DiaTable_Sections)
49  if (Name16 == DiaTable_LineNums)
51  if (Name16 == DiaTable_SegMap)
53  if (Name16 == DiaTable_InjSrc)
55  if (Name16 == DiaTable_FrameData)
57  if (Name16 == DiaTable_InputAssemblyFiles)
59  if (Name16 == DiaTable_Dbg)
60  return PDB_TableType::Dbg;
62 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
PDB_TableType getTableType() const override
Definition: DIATable.cpp:38
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
uint32_t getItemCount() const override
Definition: DIATable.cpp:20
std::string getName() const override
Definition: DIATable.cpp:25
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:81
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
DIATable(CComPtr< IDiaTable > DiaTable)
Definition: DIATable.cpp:17