@@ -4184,35 +4184,36 @@ FileSpec TargetProperties::GetSaveJITObjectsDir() const {
4184
4184
}
4185
4185
4186
4186
void TargetProperties::CheckJITObjectsDir () {
4187
- const uint32_t idx = ePropertySaveObjectsDir;
4188
4187
FileSpec new_dir = GetSaveJITObjectsDir ();
4188
+ if (!new_dir)
4189
+ return ;
4190
+
4189
4191
const FileSystem &instance = FileSystem::Instance ();
4190
4192
bool exists = instance.Exists (new_dir);
4191
4193
bool is_directory = instance.IsDirectory (new_dir);
4192
4194
std::string path = new_dir.GetPath (true );
4193
4195
bool writable = llvm::sys::fs::can_write (path);
4194
4196
if (exists && is_directory && writable)
4195
4197
return ;
4196
- m_collection_sp->GetPropertyAtIndex (nullptr , true , idx)->GetValue ()
4198
+
4199
+ m_collection_sp->GetPropertyAtIndex (nullptr , true , ePropertySaveObjectsDir)
4200
+ ->GetValue ()
4197
4201
->Clear ();
4198
- StreamSP error_strm_sp;
4199
- if (m_target) {
4200
- // FIXME: How can I warn the user when setting this on the Debugger?
4201
- error_strm_sp = m_target->GetDebugger ().GetAsyncErrorStream ();
4202
- } else if (Debugger::GetNumDebuggers () == 1 ) {
4203
- error_strm_sp = Debugger::GetDebuggerAtIndex (0 )->GetAsyncErrorStream ();
4204
- }
4205
- if (error_strm_sp) {
4206
- error_strm_sp->Format (" JIT object dir '{0}' " , path);
4207
- if (!exists)
4208
- error_strm_sp->PutCString (" does not exist." );
4209
- else if (!is_directory)
4210
- error_strm_sp->PutCString (" is not a directory." );
4211
- else if (!writable)
4212
- error_strm_sp->PutCString (" is not writable." );
4213
- error_strm_sp->EOL ();
4214
- error_strm_sp->Flush ();
4215
- }
4202
+
4203
+ std::string buffer;
4204
+ llvm::raw_string_ostream os (buffer);
4205
+ os << " JIT object dir '" << path << " ' " ;
4206
+ if (!exists)
4207
+ os << " does not exist" ;
4208
+ else if (!is_directory)
4209
+ os << " is not a directory" ;
4210
+ else if (!writable)
4211
+ os << " is not writable" ;
4212
+
4213
+ llvm::Optional<lldb::user_id_t > debugger_id = llvm::None;
4214
+ if (m_target)
4215
+ debugger_id = m_target->GetDebugger ().GetID ();
4216
+ Debugger::ReportError (os.str (), debugger_id);
4216
4217
}
4217
4218
4218
4219
bool TargetProperties::GetEnableSyntheticValue () const {
0 commit comments