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
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
index d65a153..4b6122b 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
@@ -105,8 +105,8 @@
PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
-std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findChildren(PDB_SymType Type) const {
- return RawSymbol->findChildren(Type);
+std::unique_ptr<IPDBEnumSymbols> PDBSymbol::findAllChildren() const {
+ return RawSymbol->findChildren(PDB_SymType::None);
}
std::unique_ptr<IPDBEnumSymbols>
@@ -128,7 +128,7 @@
std::unique_ptr<IPDBEnumSymbols>
PDBSymbol::getChildStats(TagStats &Stats) const {
- std::unique_ptr<IPDBEnumSymbols> Result(findChildren(PDB_SymType::None));
+ std::unique_ptr<IPDBEnumSymbols> Result(findAllChildren());
Stats.clear();
while (auto Child = Result->getNext()) {
++Stats[Child->getSymTag()];