[Lldb-commits] [lldb] [lldb] Fixing edge cases in "command source" (PR #126526)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 10 08:28:35 PST 2025


================
@@ -784,14 +784,12 @@ class CommandObjectSourceList : public CommandObjectParsed {
 
       if (sc.block == nullptr) {
         // Not an inlined function
-        sc.function->GetStartLineSourceInfo(start_file, start_line);
-        if (start_line == 0) {
-          result.AppendErrorWithFormat("Could not find line information for "
-                                       "start of function: \"%s\".\n",
-                                       source_info.function.GetCString());
-          return 0;
-        }
-        sc.function->GetEndLineSourceInfo(end_file, end_line);
+        auto expected_info = sc.function->GetSourceInfo();
+        if (!expected_info)
+          result.AppendError(llvm::toString(expected_info.takeError()));
----------------
JDevlieghere wrote:

Was this supposed to retain the `return 0;`? Now you're dereferencing `expected_info` even if it contains an error. 

https://github.com/llvm/llvm-project/pull/126526


More information about the lldb-commits mailing list