@@ -4620,35 +4620,36 @@ FileSpec TargetProperties::GetSaveJITObjectsDir() const {
4620
4620
}
4621
4621
4622
4622
void TargetProperties::CheckJITObjectsDir () {
4623
- const uint32_t idx = ePropertySaveObjectsDir;
4624
4623
FileSpec new_dir = GetSaveJITObjectsDir ();
4624
+ if (!new_dir)
4625
+ return ;
4626
+
4625
4627
const FileSystem &instance = FileSystem::Instance ();
4626
4628
bool exists = instance.Exists (new_dir);
4627
4629
bool is_directory = instance.IsDirectory (new_dir);
4628
4630
std::string path = new_dir.GetPath (true );
4629
4631
bool writable = llvm::sys::fs::can_write (path);
4630
4632
if (exists && is_directory && writable)
4631
4633
return ;
4632
- m_collection_sp->GetPropertyAtIndex (nullptr , true , idx)->GetValue ()
4634
+
4635
+ m_collection_sp->GetPropertyAtIndex (nullptr , true , ePropertySaveObjectsDir)
4636
+ ->GetValue ()
4633
4637
->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);
4652
4653
}
4653
4654
4654
4655
bool TargetProperties::GetEnableSyntheticValue () const {
0 commit comments