Skip to content

Commit d18b2e2

Browse files
author
git apple-llvm automerger
committed
Merge commit 'c354f13e6995' from llvm.org/main into next
2 parents a1a494c + c354f13 commit d18b2e2

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

lldb/source/Target/Target.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4620,35 +4620,36 @@ FileSpec TargetProperties::GetSaveJITObjectsDir() const {
46204620
}
46214621

46224622
void TargetProperties::CheckJITObjectsDir() {
4623-
const uint32_t idx = ePropertySaveObjectsDir;
46244623
FileSpec new_dir = GetSaveJITObjectsDir();
4624+
if (!new_dir)
4625+
return;
4626+
46254627
const FileSystem &instance = FileSystem::Instance();
46264628
bool exists = instance.Exists(new_dir);
46274629
bool is_directory = instance.IsDirectory(new_dir);
46284630
std::string path = new_dir.GetPath(true);
46294631
bool writable = llvm::sys::fs::can_write(path);
46304632
if (exists && is_directory && writable)
46314633
return;
4632-
m_collection_sp->GetPropertyAtIndex(nullptr, true, idx)->GetValue()
4634+
4635+
m_collection_sp->GetPropertyAtIndex(nullptr, true, ePropertySaveObjectsDir)
4636+
->GetValue()
46334637
->Clear();
4634-
StreamSP error_strm_sp;
4635-
if (m_target) {
4636-
// FIXME: How can I warn the user when setting this on the Debugger?
4637-
error_strm_sp = m_target->GetDebugger().GetAsyncErrorStream();
4638-
} else if (Debugger::GetNumDebuggers() == 1) {
4639-
error_strm_sp = Debugger::GetDebuggerAtIndex(0)->GetAsyncErrorStream();
4640-
}
4641-
if (error_strm_sp) {
4642-
error_strm_sp->Format("JIT object dir '{0}' ", path);
4643-
if (!exists)
4644-
error_strm_sp->PutCString("does not exist.");
4645-
else if (!is_directory)
4646-
error_strm_sp->PutCString("is not a directory.");
4647-
else if (!writable)
4648-
error_strm_sp->PutCString("is not writable.");
4649-
error_strm_sp->EOL();
4650-
error_strm_sp->Flush();
4651-
}
4638+
4639+
std::string buffer;
4640+
llvm::raw_string_ostream os(buffer);
4641+
os << "JIT object dir '" << path << "' ";
4642+
if (!exists)
4643+
os << "does not exist";
4644+
else if (!is_directory)
4645+
os << "is not a directory";
4646+
else if (!writable)
4647+
os << "is not writable";
4648+
4649+
llvm::Optional<lldb::user_id_t> debugger_id = llvm::None;
4650+
if (m_target)
4651+
debugger_id = m_target->GetDebugger().GetID();
4652+
Debugger::ReportError(os.str(), debugger_id);
46524653
}
46534654

46544655
bool TargetProperties::GetEnableSyntheticValue() const {

0 commit comments

Comments
 (0)