LLVM  8.0.1
DIADataStream.cpp
Go to the documentation of this file.
1 //===- DIADataStream.cpp - DIA implementation of IPDBDataStream -*- 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 
12 
13 using namespace llvm;
14 using namespace llvm::pdb;
15 
16 DIADataStream::DIADataStream(CComPtr<IDiaEnumDebugStreamData> DiaStreamData)
17  : StreamData(DiaStreamData) {}
18 
20  LONG Count = 0;
21  return (S_OK == StreamData->get_Count(&Count)) ? Count : 0;
22 }
23 
24 std::string DIADataStream::getName() const {
25  return invokeBstrMethod(*StreamData, &IDiaEnumDebugStreamData::get_name);
26 }
27 
31  DWORD RecordSize = 0;
32  StreamData->Item(Index, 0, &RecordSize, nullptr);
33  if (RecordSize == 0)
35 
36  Record.resize(RecordSize);
37  if (S_OK != StreamData->Item(Index, RecordSize, &RecordSize, &Record[0]))
39  return Record;
40 }
41 
43  Record.clear();
44  DWORD RecordSize = 0;
45  ULONG CountFetched = 0;
46  StreamData->Next(1, 0, &RecordSize, nullptr, &CountFetched);
47  if (RecordSize == 0)
48  return false;
49 
50  Record.resize(RecordSize);
51  if (S_OK ==
52  StreamData->Next(1, RecordSize, &RecordSize, &Record[0], &CountFetched))
53  return false;
54  return true;
55 }
56 
57 void DIADataStream::reset() { StreamData->Reset(); }
DIADataStream(CComPtr< IDiaEnumDebugStreamData > DiaStreamData)
bool getNext(RecordType &Record) override
This class represents lattice values for constants.
Definition: AllocatorList.h:24
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
Definition: DIAUtils.h:17
std::string getName() const override
llvm::Optional< RecordType > getItemAtIndex(uint32_t Index) const override
uint32_t getRecordCount() const override
void resize(size_type N)
Definition: SmallVector.h:351