LLVM 20.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
32 : NativeRawSymbol(Session, PDB_SymType::Exe, SymbolId),
33 Dbi(getDbiStreamPtr(Session)) {}
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);
50 {codeview::LF_STRUCTURE, codeview::LF_CLASS, codeview::LF_UNION,
51 codeview::LF_INTERFACE});
53 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_VTSHAPE);
56 {codeview::LF_PROCEDURE, codeview::LF_MFUNCTION});
58 return Session.getSymbolCache().createGlobalsEnumerator(codeview::S_UDT);
59
60 default:
61 break;
62 }
63 return nullptr;
64}
65
68 if (IS)
69 return IS->getAge();
70 consumeError(IS.takeError());
71 return 0;
72}
73
75 return std::string(Session.getPDBFile().getFilePath());
76}
77
80 if (IS)
81 return IS->getGuid();
82 consumeError(IS.takeError());
83 return codeview::GUID{{0}};
84}
85
87 auto Dbi = Session.getPDBFile().getPDBDbiStream();
88 if (Dbi)
89 return Dbi->hasCTypes();
90 consumeError(Dbi.takeError());
91 return false;
92}
93
95 auto Dbi = Session.getPDBFile().getPDBDbiStream();
96 if (Dbi)
97 return !Dbi->isStripped();
98 consumeError(Dbi.takeError());
99 return false;
100}
static DbiStream * getDbiStreamPtr(NativeSession &Session)
Tagged union holding either a T or a Error.
Definition: Error.h:481
Error takeError()
Take ownership of the stored error.
Definition: Error.h:608
reference get()
Returns a reference to the stored T value.
Definition: Error.h:578
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
bool isStripped() const
Definition: DbiStream.cpp:170
bool hasCTypes() const
Definition: DbiStream.cpp:166
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
SymbolCache & getSymbolCache()
Expected< DbiStream & > getPDBDbiStream()
Definition: PDBFile.cpp:287
Expected< InfoStream & > getPDBInfoStream()
Definition: PDBFile.cpp:274
StringRef getFilePath() const
Definition: PDBFile.cpp:48
std::unique_ptr< IPDBEnumSymbols > createGlobalsEnumerator(codeview::SymbolKind Kind)
std::unique_ptr< IPDBEnumSymbols > createTypeEnumerator(codeview::TypeLeafKind Kind)
Definition: SymbolCache.cpp:89
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.
Definition: AddressRanges.h:18
void consumeError(Error Err)
Consume a Error without doing anything.
Definition: Error.h:1069
This represents the 'GUID' type from windows.h.
Definition: GUID.h:21