summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-02-12 21:09:24 +0000
committerZachary Turner <zturner@google.com>2015-02-12 21:09:24 +0000
commitc074de041b92af6a8279ea84a3675ab79579ec20 (patch)
tree6dba14e46c1e40f84304087e8ded45dfa6ac04f6 /llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
parentcf7d164ec1c85e9f4d7a1508486342b67828e408 (diff)
downloadbcm5719-llvm-c074de041b92af6a8279ea84a3675ab79579ec20.tar.gz
bcm5719-llvm-c074de041b92af6a8279ea84a3675ab79579ec20.zip
Add concrete type overloads to PDBSymbol::findChildren().
Frequently you only want to iterate over children of a specific type (e.g. functions). Previously you would get back a generic interface that allowed iteration over the base symbol type, which you would have to dyn_cast<> each one of. With this patch, we allow the user to specify the concrete type as a template parameter, and it will return an iterator which returns instances of the concrete type directly. llvm-svn: 228960
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
index dfb684d1657..17473c17a45 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
@@ -27,35 +27,21 @@ void PDBSymbolFunc::dump(raw_ostream &OS, int Indent,
if (Level == PDB_DumpLevel::Compact) {
uint32_t FuncStart = getRelativeVirtualAddress();
uint32_t FuncEnd = FuncStart + getLength();
- auto DebugEndSymbol = findChildren(PDB_SymType::FuncDebugEnd);
OS << stream_indent(Indent);
OS << "[" << format_hex(FuncStart, 8);
- if (auto DebugStartEnum = findChildren(PDB_SymType::FuncDebugStart)) {
- if (auto StartSym = DebugStartEnum->getNext()) {
- auto DebugStart = dyn_cast<PDBSymbolFuncDebugStart>(StartSym.get());
- OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
- }
- }
+ if (auto DebugStart = findOneChild<PDBSymbolFuncDebugStart>())
+ OS << "+" << DebugStart->getRelativeVirtualAddress() - FuncStart;
OS << " - " << format_hex(FuncEnd, 8);
- if (auto DebugEndEnum = findChildren(PDB_SymType::FuncDebugEnd)) {
- if (auto DebugEndSym = DebugEndEnum->getNext()) {
- auto DebugEnd = dyn_cast<PDBSymbolFuncDebugEnd>(DebugEndSym.get());
+ if (auto DebugEnd = findOneChild<PDBSymbolFuncDebugEnd>())
OS << "-" << FuncEnd - DebugEnd->getRelativeVirtualAddress();
- }
- }
OS << "] ";
PDB_RegisterId Reg = getLocalBasePointerRegisterId();
if (Reg == PDB_RegisterId::VFrame)
OS << "(VFrame)";
- else if (hasFramePointer()) {
- if (Reg == PDB_RegisterId::EBP)
- OS << "(EBP)";
- else
- OS << "(" << (int)Reg << ")";
- } else {
+ else if (hasFramePointer())
+ OS << "(" << Reg << ")";
+ else
OS << "(FPO)";
- }
OS << " " << getName() << "\n";
}
- OS.flush();
}
OpenPOWER on IntegriCloud