================ @@ -465,18 +465,24 @@ ClangExpressionParser::ClangExpressionParser( // A value of 0 means no limit for both LLDB and Clang. m_compiler->getDiagnostics().setErrorLimit(target_sp->GetExprErrorLimit()); - auto target_info = TargetInfo::CreateTargetInfo( - m_compiler->getDiagnostics(), m_compiler->getInvocation().TargetOpts); - if (log) { - LLDB_LOGF(log, "Target datalayout string: '%s'", - target_info->getDataLayoutString()); - LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str()); - LLDB_LOGF(log, "Target vector alignment: %d", - target_info->getMaxVectorAlign()); - } - m_compiler->setTarget(target_info); + if (auto *target_info = TargetInfo::CreateTargetInfo( + m_compiler->getDiagnostics(), + m_compiler->getInvocation().TargetOpts)) { + if (log) { + LLDB_LOGF(log, "Target datalayout string: '%s'", + target_info->getDataLayoutString()); + LLDB_LOGF(log, "Target ABI: '%s'", target_info->getABI().str().c_str()); + LLDB_LOGF(log, "Target vector alignment: %d", + target_info->getMaxVectorAlign()); + } + m_compiler->setTarget(target_info); + } else { + if (log) + LLDB_LOGF(log, "Failed to create TargetInfo for '%s'", + m_compiler->getTargetOpts().Triple.c_str()); - assert(m_compiler->hasTarget()); + lldbassert(false && "Failed to create TargetInfo."); ---------------- adrian-prantl wrote:
Based on that there used to be an assert here, should this return? Same comment as in the previous review — ideally this would return an llvm::Error here if it weren't a constructor. https://github.com/llvm/llvm-project/pull/101697 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits