[Lldb-commits] [PATCH] D88704: [lldb] Fix bug in fallback logic for finding the resource directory.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 1 14:31:39 PDT 2020


JDevlieghere created this revision.
JDevlieghere added a reviewer: teemperor.
JDevlieghere requested review of this revision.

Both of the if-clauses modify the `raw_path` variable and the `SharedFrameworks` variant wasn't properly resetting the variable. Avoid future bugs like that by always resetting the variable.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D88704

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -137,14 +137,12 @@
         FileSystem::Instance().Resolve(file_spec);
         return true;
       }
-      raw_path = lldb_shlib_spec.GetPath();
     }
-    raw_path.resize(rev_it - r_end);
-  } else {
-    raw_path.resize(rev_it - r_end);
   }
 
   // Fall back to the Clang resource directory inside the framework.
+  raw_path = lldb_shlib_spec.GetPath();
+  raw_path.resize(rev_it - r_end);
   raw_path.append("LLDB.framework/Resources/Clang");
   file_spec.GetDirectory().SetString(raw_path.c_str());
   FileSystem::Instance().Resolve(file_spec);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88704.295677.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201001/04232bee/attachment.bin>


More information about the lldb-commits mailing list