LLVM  7.0.0svn
NativeExeSymbol.cpp
Go to the documentation of this file.
1 //===- NativeExeSymbol.cpp - native impl for PDBSymbolExe -------*- 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 
12 #include "llvm/ADT/STLExtras.h"
17 
18 namespace llvm {
19 namespace pdb {
20 
22  : NativeRawSymbol(Session, SymbolId), File(Session.getPDBFile()) {}
23 
24 std::unique_ptr<NativeRawSymbol> NativeExeSymbol::clone() const {
25  return llvm::make_unique<NativeExeSymbol>(Session, SymbolId);
26 }
27 
28 std::unique_ptr<IPDBEnumSymbols>
30  switch (Type) {
32  auto Dbi = File.getPDBDbiStream();
33  if (Dbi) {
34  const DbiModuleList &Modules = Dbi->modules();
35  return std::unique_ptr<IPDBEnumSymbols>(
36  new NativeEnumModules(Session, Modules));
37  }
38  consumeError(Dbi.takeError());
39  break;
40  }
41  case PDB_SymType::Enum:
42  return Session.createTypeEnumerator(codeview::LF_ENUM);
43  default:
44  break;
45  }
46  return nullptr;
47 }
48 
50  auto IS = File.getPDBInfoStream();
51  if (IS)
52  return IS->getAge();
53  consumeError(IS.takeError());
54  return 0;
55 }
56 
58  return File.getFilePath();
59 }
60 
62  auto IS = File.getPDBInfoStream();
63  if (IS)
64  return IS->getGuid();
65  consumeError(IS.takeError());
66  return codeview::GUID{{0}};
67 }
68 
70  auto Dbi = File.getPDBDbiStream();
71  if (Dbi)
72  return Dbi->hasCTypes();
73  consumeError(Dbi.takeError());
74  return false;
75 }
76 
78  auto Dbi = File.getPDBDbiStream();
79  if (Dbi)
80  return !Dbi->isStripped();
81  consumeError(Dbi.takeError());
82  return false;
83 }
84 
85 } // namespace pdb
86 } // namespace llvm
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
bool hasCTypes() const override
bool hasPrivateSymbols() const override
std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override
This represents the &#39;GUID&#39; type from windows.h.
Definition: GUID.h:22
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
Definition: PDBTypes.h:179
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
codeview::GUID getGuid() const override
uint32_t getAge() const override
std::unique_ptr< NativeRawSymbol > clone() const override
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:962
Expected< DbiStream & > getPDBDbiStream()
Definition: PDBFile.cpp:287
std::unique_ptr< IPDBEnumSymbols > createTypeEnumerator(codeview::TypeLeafKind Kind)
NativeExeSymbol(NativeSession &Session, SymIndexId SymbolId)
StringRef getFilePath() const
Definition: PDBFile.cpp:48
Expected< InfoStream & > getPDBInfoStream()
Definition: PDBFile.cpp:274
std::string getSymbolsFileName() const override