LLVM  14.0.0git
DIADataStream.cpp
Go to the documentation of this file.
1 //===- DIADataStream.cpp - DIA implementation of IPDBDataStream -*- 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 
11 
12 using namespace llvm;
13 using namespace llvm::pdb;
14 
15 DIADataStream::DIADataStream(CComPtr<IDiaEnumDebugStreamData> DiaStreamData)
16  : StreamData(DiaStreamData) {}
17 
19  LONG Count = 0;
20  return (S_OK == StreamData->get_Count(&Count)) ? Count : 0;
21 }
22 
23 std::string DIADataStream::getName() const {
24  return invokeBstrMethod(*StreamData, &IDiaEnumDebugStreamData::get_name);
25 }
26 
30  DWORD RecordSize = 0;
31  StreamData->Item(Index, 0, &RecordSize, nullptr);
32  if (RecordSize == 0)
34 
35  Record.resize(RecordSize);
36  if (S_OK != StreamData->Item(Index, RecordSize, &RecordSize, &Record[0]))
38  return Record;
39 }
40 
42  Record.clear();
43  DWORD RecordSize = 0;
44  ULONG CountFetched = 0;
45  StreamData->Next(1, 0, &RecordSize, nullptr, &CountFetched);
46  if (RecordSize == 0)
47  return false;
48 
49  Record.resize(RecordSize);
50  if (S_OK ==
51  StreamData->Next(1, RecordSize, &RecordSize, &Record[0], &CountFetched))
52  return false;
53  return true;
54 }
55 
56 void DIADataStream::reset() { StreamData->Reset(); }
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::pdb::DIADataStream::reset
void reset() override
Definition: DIADataStream.cpp:56
llvm::SmallVector< uint8_t, 32 >
llvm::Optional
Definition: APInt.h:33
DIADataStream.h
invokeBstrMethod
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
Definition: DIAUtils.h:16
llvm::pdb::DIADataStream::getNext
bool getNext(RecordType &Record) override
Definition: DIADataStream.cpp:41
llvm::pdb::DIADataStream::getName
std::string getName() const override
Definition: DIADataStream.cpp:23
DIAUtils.h
llvm::pdb::DIADataStream::DIADataStream
DIADataStream(CComPtr< IDiaEnumDebugStreamData > DiaStreamData)
Definition: DIADataStream.cpp:15
llvm::pdb::DIADataStream::getRecordCount
uint32_t getRecordCount() const override
Definition: DIADataStream.cpp:18
llvm::pdb
Definition: ConcreteSymbolEnumerator.h:20
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::AMDGPU::SDWA::DWORD
@ DWORD
Definition: SIDefines.h:653
llvm::Record
Definition: Record.h:1472
uint32_t
llvm::pdb::DIADataStream::getItemAtIndex
llvm::Optional< RecordType > getItemAtIndex(uint32_t Index) const override
Definition: DIADataStream.cpp:28