[Lldb-commits] [lldb] r373267 - [StackFrameList][DFS] Turn a few raw pointers into references, NFC

Vedant Kumar via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 30 14:20:14 PDT 2019


Author: vedantk
Date: Mon Sep 30 14:20:14 2019
New Revision: 373267

URL: http://llvm.org/viewvc/llvm-project?rev=373267&view=rev
Log:
[StackFrameList][DFS] Turn a few raw pointers into references, NFC

Modified:
    lldb/trunk/source/Symbol/Function.cpp
    lldb/trunk/source/Target/StackFrameList.cpp

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=373267&r1=373266&r2=373267&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Mon Sep 30 14:20:14 2019
@@ -173,6 +173,7 @@ void CallEdge::ParseSymbolFileAndResolve
 
 Function *CallEdge::GetCallee(ModuleList &images) {
   ParseSymbolFileAndResolve(images);
+  assert(resolved && "Did not resolve lazy callee");
   return lazy_callee.def;
 }
 

Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=373267&r1=373266&r2=373267&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Mon Sep 30 14:20:14 2019
@@ -286,15 +286,15 @@ static void FindInterveningFrames(Functi
 
     DFS(Function *end, ModuleList &images) : end(end), images(images) {}
 
-    void search(Function *first_callee, std::vector<Function *> &path) {
+    void search(Function &first_callee, std::vector<Function *> &path) {
       dfs(first_callee);
       if (!ambiguous)
         path = std::move(solution_path);
     }
 
-    void dfs(Function *callee) {
+    void dfs(Function &callee) {
       // Found a path to the target function.
-      if (callee == end) {
+      if (&callee == end) {
         if (solution_path.empty())
           solution_path = active_path;
         else
@@ -306,19 +306,19 @@ static void FindInterveningFrames(Functi
       // there's more than one way to reach a target. This errs on the side of
       // caution: it conservatively stops searching when some solutions are
       // still possible to save time in the average case.
-      if (!visited_nodes.insert(callee).second) {
+      if (!visited_nodes.insert(&callee).second) {
         ambiguous = true;
         return;
       }
 
       // Search the calls made from this callee.
-      active_path.push_back(callee);
-      for (CallEdge &edge : callee->GetTailCallingEdges()) {
+      active_path.push_back(&callee);
+      for (CallEdge &edge : callee.GetTailCallingEdges()) {
         Function *next_callee = edge.GetCallee(images);
         if (!next_callee)
           continue;
 
-        dfs(next_callee);
+        dfs(*next_callee);
         if (ambiguous)
           return;
       }
@@ -326,7 +326,7 @@ static void FindInterveningFrames(Functi
     }
   };
 
-  DFS(&end, images).search(first_callee, path);
+  DFS(&end, images).search(*first_callee, path);
 }
 
 /// Given that \p next_frame will be appended to the frame list, synthesize




More information about the lldb-commits mailing list