summaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/GSYM/InlineInfo.cpp')
-rw-r--r--llvm/lib/DebugInfo/GSYM/InlineInfo.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp b/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
index f775ab8fb65c..ecfb21501eda 100644
--- a/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
+++ b/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
@@ -264,3 +264,14 @@ llvm::Error InlineInfo::encode(FileWriter &O, uint64_t BaseAddr) const {
}
return Error::success();
}
+
+static uint64_t GetTotalNumChildren(const InlineInfo &II) {
+ uint64_t NumChildren = II.Children.size();
+ for (const auto &Child : II.Children)
+ NumChildren += GetTotalNumChildren(Child);
+ return NumChildren;
+}
+
+bool InlineInfo::operator<(const InlineInfo &RHS) const {
+ return GetTotalNumChildren(*this) < GetTotalNumChildren(RHS);
+}