LLVM 24.0.0git
NativeExeSymbol.cpp
Go to the documentation of this file.
1//===- NativeExeSymbol.cpp - native impl for PDBSymbolExe -------*- 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
10
18
19using namespace llvm;
20using namespace llvm::pdb;
21
24 if (DbiS)
25 return &DbiS.get();
26
27 consumeError(DbiS.takeError());
28 return nullptr;
29}
30
34
35std::unique_ptr<IPDBEnumSymbols>
37 switch (Type) {
39 return std::unique_ptr<IPDBEnumSymbols>(new NativeEnumModules(Session));
40 break;
41 }
43 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_ARRAY);
45 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_ENUM);
47 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_POINTER);
49 return Session.getSymbolCache().createTypeEnumerator({
50 codeview::LF_STRUCTURE,
51 codeview::LF_STRUCTURE2,
52 codeview::LF_CLASS,
53 codeview::LF_CLASS2,
54 codeview::LF_UNION,
55 codeview::LF_UNION2,
56 codeview::LF_INTERFACE,
57 codeview::LF_INTERFACE2,
58 });
60 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_VTSHAPE);
62 return Session.getSymbolCache().createTypeEnumerator(
63 {codeview::LF_PROCEDURE, codeview::LF_MFUNCTION});
65 return Session.getSymbolCache().createGlobalsEnumerator(codeview::S_UDT);
66
67 default:
68 break;
69 }
70 return nullptr;
71}
72
74 auto IS = Session.getPDBFile().getPDBInfoStream();
75 if (IS)
76 return IS->getAge();
77 consumeError(IS.takeError());
78 return 0;
79}
80
82 return std::string(Session.getPDBFile().getFilePath());
83}
84
86 auto IS = Session.getPDBFile().getPDBInfoStream();
87 if (IS)
88 return IS->getGuid();
89 consumeError(IS.takeError());
90 return codeview::GUID{{0}};
91}
92
94 auto Dbi = Session.getPDBFile().getPDBDbiStream();
95 if (Dbi)
96 return Dbi->hasCTypes();
97 consumeError(Dbi.takeError());
98 return false;
99}
100
102 auto Dbi = Session.getPDBFile().getPDBDbiStream();
103 if (Dbi)
104 return !Dbi->isStripped();
105 consumeError(Dbi.takeError());
106 return false;
107}
static DbiStream * getDbiStreamPtr(NativeSession &Session)
Tagged union holding either a T or a Error.
Definition Error.h:485
Error takeError()
Take ownership of the stored error.
Definition Error.h:612
reference get()
Returns a reference to the stored T value.
Definition Error.h:582
std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override
codeview::GUID getGuid() const override
uint32_t getAge() const override
bool hasCTypes() const override
bool hasPrivateSymbols() const override
NativeExeSymbol(NativeSession &Session, SymIndexId Id)
std::string getSymbolsFileName() const override
NativeRawSymbol(NativeSession &PDBSession, PDB_SymType Tag, SymIndexId SymbolId)
Expected< DbiStream & > getPDBDbiStream()
Definition PDBFile.cpp:287
uint32_t SymIndexId
Definition PDBTypes.h:26
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
Definition PDBTypes.h:243
This is an optimization pass for GlobalISel generic memory operations.
void consumeError(Error Err)
Consume a Error without doing anything.
Definition Error.h:1106
This represents the 'GUID' type from windows.h.
Definition GUID.h:22