LLVM  8.0.1
DIAInjectedSource.cpp
Go to the documentation of this file.
1 //===- DIAInjectedSource.cpp - DIA impl for IPDBInjectedSource --*- 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"
15 
16 using namespace llvm;
17 using namespace llvm::pdb;
18 
19 DIAInjectedSource::DIAInjectedSource(CComPtr<IDiaInjectedSource> DiaSourceFile)
20  : SourceFile(DiaSourceFile) {}
21 
23  DWORD Crc;
24  return (S_OK == SourceFile->get_crc(&Crc)) ? Crc : 0;
25 }
26 
28  ULONGLONG Size;
29  return (S_OK == SourceFile->get_length(&Size)) ? Size : 0;
30 }
31 
32 std::string DIAInjectedSource::getFileName() const {
33  return invokeBstrMethod(*SourceFile, &IDiaInjectedSource::get_filename);
34 }
35 
37  return invokeBstrMethod(*SourceFile, &IDiaInjectedSource::get_objectFilename);
38 }
39 
41  return invokeBstrMethod(*SourceFile,
42  &IDiaInjectedSource::get_virtualFilename);
43 }
44 
46  DWORD Compression = 0;
47  if (S_OK != SourceFile->get_sourceCompression(&Compression))
49  return static_cast<PDB_SourceCompression>(Compression);
50 }
51 
52 std::string DIAInjectedSource::getCode() const {
53  DWORD DataSize;
54  if (S_OK != SourceFile->get_source(0, &DataSize, nullptr))
55  return "";
56 
57  std::vector<uint8_t> Buffer(DataSize);
58  if (S_OK != SourceFile->get_source(DataSize, &DataSize, Buffer.data()))
59  return "";
60  assert(Buffer.size() == DataSize);
61  return std::string(reinterpret_cast<const char *>(Buffer.data()),
62  Buffer.size());
63 }
This class represents lattice values for constants.
Definition: AllocatorList.h:24
std::string getObjectFileName() const override
std::string getFileName() const override
std::string getCode() const override
uint64_t getCodeByteSize() const override
uint32_t getCrc32() const override
PDB_SourceCompression
Definition: PDBTypes.h:149
DIAInjectedSource(CComPtr< IDiaInjectedSource > DiaSourceFile)
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
Definition: DIAUtils.h:17
PDB_SourceCompression getCompression() const override
std::string getVirtualFileName() const override
uint32_t Size
Definition: Profile.cpp:47
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())