aprantl added a comment.

> Do we currently have a way to end up in this state?

Not in llvm.org. This was prompted by a swift-lldb-crash where we can end up 
with no Swift context after a catastrophic error. I believe that in practice 
the clang runtimes are always available, but the API returns a nullable pointer 
so the call sites should take this into account:

  PersistentExpressionState *
  Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
    auto type_system_or_err = GetScratchTypeSystemForLanguage(language, true);
  
    if (auto err = type_system_or_err.takeError()) {
      LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET),
                     std::move(err),
                     "Unable to get persistent expression state for language 
{}",
                     Language::GetNameForLanguageType(language));
      return nullptr;
    }
  
    return type_system_or_err->GetPersistentExpressionState();
  }


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

https://reviews.llvm.org/D72413



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

Reply via email to