[Lldb-commits] [lldb] 07c1125 - [lldb] Fix bug in fallback logic for finding the resource directory.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 2 09:56:08 PDT 2020


Author: Jonas Devlieghere
Date: 2020-10-02T09:56:01-07:00
New Revision: 07c112574a324318a02ef29901a0d5aa1fd95144

URL: https://github.com/llvm/llvm-project/commit/07c112574a324318a02ef29901a0d5aa1fd95144
DIFF: https://github.com/llvm/llvm-project/commit/07c112574a324318a02ef29901a0d5aa1fd95144.diff

LOG: [lldb] Fix bug in fallback logic for finding the resource directory.

Both of the if-clauses modify the raw_path variable and only one of them
was resetting the variable for the fallback. Avoid future bugs like that
by always resetting the variable.

Differential revision: https://reviews.llvm.org/D88704

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
index 8abb7e420575..b76fa6fbf690 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -137,14 +137,12 @@ bool lldb_private::ComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
         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);


        


More information about the lldb-commits mailing list