[Lldb-commits] [PATCH] D87076: [lldb/Interpreter] Fix language detection for the REPL InitFile

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 3 02:00:40 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbf8f6e89c8d6: [lldb/Interpreter] Fix language detection for the REPL InitFile (authored by mib).

Changed prior to commit:
  https://reviews.llvm.org/D87076?vs=289656&id=289662#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87076/new/

https://reviews.llvm.org/D87076

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp


Index: lldb/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2091,9 +2091,12 @@
   FileSystem::Instance().Resolve(init_file);
 }
 
-static void GetHomeREPLInitFile(llvm::SmallVectorImpl<char> &init_file,
-                                LanguageType language) {
-  if (language == LanguageType::eLanguageTypeUnknown)
+static void GetHomeREPLInitFile(llvm::SmallVectorImpl<char> &init_file) {
+  LanguageSet repl_languages = Language::GetLanguagesSupportingREPLs();
+  LanguageType language = eLanguageTypeUnknown;
+  if (auto main_repl_language = repl_languages.GetSingularLanguage())
+    language = *main_repl_language;
+  else
     return;
 
   std::string init_file_name =
@@ -2191,13 +2194,8 @@
 
   llvm::SmallString<128> init_file;
 
-  if (is_repl) {
-    LanguageType language = {};
-    TargetSP target_sp = GetDebugger().GetSelectedTarget();
-    if (target_sp)
-      language = target_sp->GetLanguage();
-    GetHomeREPLInitFile(init_file, language);
-  }
+  if (is_repl)
+    GetHomeREPLInitFile(init_file);
 
   if (init_file.empty())
     GetHomeInitFile(init_file);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87076.289662.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200903/d9959566/attachment.bin>


More information about the lldb-commits mailing list