Author: paperchalice
Date: 2023-06-06T08:11:01-07:00
New Revision: 6c02e365711cab47ed9abe9f091c25651a3efd74

URL: 
https://github.com/llvm/llvm-project/commit/6c02e365711cab47ed9abe9f091c25651a3efd74
DIFF: 
https://github.com/llvm/llvm-project/commit/6c02e365711cab47ed9abe9f091c25651a3efd74.diff

LOG: [lldb] fix dangling reference in `ClangHost.cpp`

The lifetime of clang_resource_path should be same as
kResourceDirSuffixes, because kResourceDirSuffixes doesn't own
clang_resource_path.

Differential Revision: https://reviews.llvm.org/D152225

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 3bb303c0e1931..6064c02c7fd67 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -52,7 +52,7 @@ static bool DefaultComputeClangResourceDirectory(FileSpec 
&lldb_shlib_spec,
   Log *log = GetLog(LLDBLog::Host);
   std::string raw_path = lldb_shlib_spec.GetPath();
   llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
-  const std::string clang_resource_path =
+  static const std::string clang_resource_path =
       clang::driver::Driver::GetResourcesPath("bin/lldb", CLANG_RESOURCE_DIR);
 
   static const llvm::StringRef kResourceDirSuffixes[] = {


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to