Index: lldb/trunk/include/lldb/Target/Process.h =================================================================== --- lldb/trunk/include/lldb/Target/Process.h +++ lldb/trunk/include/lldb/Target/Process.h @@ -319,7 +319,7 @@ NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { - m_match_info.GetExecutableFile().SetFile(process_name, false, + m_match_info.GetExecutableFile().SetFile(process_name, FileSpec::Style::native); } Index: lldb/trunk/include/lldb/Utility/FileSpec.h =================================================================== --- lldb/trunk/include/lldb/Utility/FileSpec.h +++ lldb/trunk/include/lldb/Utility/FileSpec.h @@ -70,23 +70,19 @@ /// /// Takes a path to a file which can be just a filename, or a full path. If /// \a path is not nullptr or empty, this function will call - /// FileSpec::SetFile (const char *path, bool resolve). + /// FileSpec::SetFile (const char *path). /// /// @param[in] path /// The full or partial path to a file. /// - /// @param[in] resolve_path - /// If \b true, then we resolve the path, removing stray ../.. and so - /// forth, - /// if \b false we trust the path is in canonical form already. + /// @param[in] style + /// The style of the path /// - /// @see FileSpec::SetFile (const char *path, bool resolve) + /// @see FileSpec::SetFile (const char *path) //------------------------------------------------------------------ - explicit FileSpec(llvm::StringRef path, bool resolve_path, - Style style = Style::native); + explicit FileSpec(llvm::StringRef path, Style style = Style::native); - explicit FileSpec(llvm::StringRef path, bool resolve_path, - const llvm::Triple &Triple); + explicit FileSpec(llvm::StringRef path, const llvm::Triple &Triple); //------------------------------------------------------------------ /// Copy constructor @@ -272,13 +268,6 @@ //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ - /// Canonicalize this file path (basically running the static - /// FileSpec::Resolve method on it). Useful if you asked us not to resolve - /// the file path when you set the file. - //------------------------------------------------------------------ - bool ResolvePath(); - Style GetPathStyle() const; //------------------------------------------------------------------ @@ -342,7 +331,7 @@ bool IsAbsolute() const; /// Temporary helper for FileSystem change. - void SetPath(llvm::StringRef p) { SetFile(p, false); } + void SetPath(llvm::StringRef p) { SetFile(p); } //------------------------------------------------------------------ /// Extract the full path to the file. @@ -446,10 +435,9 @@ /// If \b true, then we will try to resolve links the path using /// the static FileSpec::Resolve. //------------------------------------------------------------------ - void SetFile(llvm::StringRef path, bool resolve_path, Style style); + void SetFile(llvm::StringRef path, Style style); - void SetFile(llvm::StringRef path, bool resolve_path, - const llvm::Triple &Triple); + void SetFile(llvm::StringRef path, const llvm::Triple &Triple); bool IsResolved() const { return m_is_resolved; } @@ -468,16 +456,6 @@ //------------------------------------------------------------------ void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; } - //------------------------------------------------------------------ - /// Resolves user name and links in \a path, and overwrites the input - /// argument with the resolved path. - /// - /// @param[in] path - /// Input path to be resolved, in the form of a llvm::SmallString or - /// similar. - //------------------------------------------------------------------ - static void Resolve(llvm::SmallVectorImpl &path); - FileSpec CopyByAppendingPathComponent(llvm::StringRef component) const; FileSpec CopyByRemovingLastPathComponent() const; @@ -502,7 +480,7 @@ //------------------------------------------------------------------ // Convenience method for setting the file without changing the style. //------------------------------------------------------------------ - void SetFile(llvm::StringRef path, bool resolve_path); + void SetFile(llvm::StringRef path); //------------------------------------------------------------------ // Member variables Index: lldb/trunk/source/API/SBAttachInfo.cpp =================================================================== --- lldb/trunk/source/API/SBAttachInfo.cpp +++ lldb/trunk/source/API/SBAttachInfo.cpp @@ -26,16 +26,14 @@ SBAttachInfo::SBAttachInfo(const char *path, bool wait_for) : m_opaque_sp(new ProcessAttachInfo()) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false, - FileSpec::Style::native); + m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native); m_opaque_sp->SetWaitForLaunch(wait_for); } SBAttachInfo::SBAttachInfo(const char *path, bool wait_for, bool async) : m_opaque_sp(new ProcessAttachInfo()) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false, - FileSpec::Style::native); + m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native); m_opaque_sp->SetWaitForLaunch(wait_for); m_opaque_sp->SetAsync(async); } @@ -79,8 +77,7 @@ void SBAttachInfo::SetExecutable(const char *path) { if (path && path[0]) - m_opaque_sp->GetExecutableFile().SetFile(path, false, - FileSpec::Style::native); + m_opaque_sp->GetExecutableFile().SetFile(path, FileSpec::Style::native); else m_opaque_sp->GetExecutableFile().Clear(); } Index: lldb/trunk/source/API/SBDebugger.cpp =================================================================== --- lldb/trunk/source/API/SBDebugger.cpp +++ lldb/trunk/source/API/SBDebugger.cpp @@ -735,7 +735,7 @@ m_opaque_sp->GetPlatformList().GetSelectedPlatform().get(), arch_name); TargetSP target_sp( m_opaque_sp->GetTargetList().FindTargetWithExecutableAndArchitecture( - FileSpec(filename, false), arch_name ? &arch : nullptr)); + FileSpec(filename), arch_name ? &arch : nullptr)); sb_target.SetSP(target_sp); } return sb_target; Index: lldb/trunk/source/API/SBFileSpec.cpp =================================================================== --- lldb/trunk/source/API/SBFileSpec.cpp +++ lldb/trunk/source/API/SBFileSpec.cpp @@ -32,11 +32,15 @@ : m_opaque_ap(new lldb_private::FileSpec(fspec)) {} // Deprecated!!! -SBFileSpec::SBFileSpec(const char *path) - : m_opaque_ap(new FileSpec(path, true)) {} +SBFileSpec::SBFileSpec(const char *path) : m_opaque_ap(new FileSpec(path)) { + FileSystem::Instance().Resolve(*m_opaque_ap); +} SBFileSpec::SBFileSpec(const char *path, bool resolve) - : m_opaque_ap(new FileSpec(path, resolve)) {} + : m_opaque_ap(new FileSpec(path)) { + if (resolve) + FileSystem::Instance().Resolve(*m_opaque_ap); +} SBFileSpec::~SBFileSpec() {} @@ -68,7 +72,7 @@ int SBFileSpec::ResolvePath(const char *src_path, char *dst_path, size_t dst_len) { llvm::SmallString<64> result(src_path); - lldb_private::FileSpec::Resolve(result); + FileSystem::Instance().Resolve(result); ::snprintf(dst_path, dst_len, "%s", result.c_str()); return std::min(dst_len - 1, result.size()); } Index: lldb/trunk/source/API/SBHostOS.cpp =================================================================== --- lldb/trunk/source/API/SBHostOS.cpp +++ lldb/trunk/source/API/SBHostOS.cpp @@ -11,8 +11,9 @@ #include "Plugins/ScriptInterpreter/Python/lldb-python.h" #endif -#include "lldb/API/SBHostOS.h" #include "lldb/API/SBError.h" +#include "lldb/API/SBHostOS.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/HostNativeThread.h" @@ -86,7 +87,8 @@ llvm::SmallString<64> home_dir_path; llvm::sys::path::home_directory(home_dir_path); - FileSpec homedir(home_dir_path.c_str(), true); + FileSpec homedir(home_dir_path.c_str()); + FileSystem::Instance().Resolve(homedir); sb_fspec.SetFileSpec(homedir); return sb_fspec; Index: lldb/trunk/source/API/SBLaunchInfo.cpp =================================================================== --- lldb/trunk/source/API/SBLaunchInfo.cpp +++ lldb/trunk/source/API/SBLaunchInfo.cpp @@ -128,7 +128,7 @@ } void SBLaunchInfo::SetWorkingDirectory(const char *working_dir) { - m_opaque_sp->SetWorkingDirectory(FileSpec{working_dir, false}); + m_opaque_sp->SetWorkingDirectory(FileSpec(working_dir)); } uint32_t SBLaunchInfo::GetLaunchFlags() { @@ -155,7 +155,7 @@ } void SBLaunchInfo::SetShell(const char *path) { - m_opaque_sp->SetShell(FileSpec(path, false)); + m_opaque_sp->SetShell(FileSpec(path)); } bool SBLaunchInfo::GetShellExpandArguments() { @@ -184,8 +184,7 @@ bool SBLaunchInfo::AddOpenFileAction(int fd, const char *path, bool read, bool write) { - return m_opaque_sp->AppendOpenFileAction(fd, FileSpec{path, false}, read, - write); + return m_opaque_sp->AppendOpenFileAction(fd, FileSpec(path), read, write); } bool SBLaunchInfo::AddSuppressFileAction(int fd, bool read, bool write) { Index: lldb/trunk/source/API/SBModuleSpec.cpp =================================================================== --- lldb/trunk/source/API/SBModuleSpec.cpp +++ lldb/trunk/source/API/SBModuleSpec.cpp @@ -114,7 +114,8 @@ SBModuleSpecList SBModuleSpecList::GetModuleSpecifications(const char *path) { SBModuleSpecList specs; - FileSpec file_spec(path, true); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); Host::ResolveExecutableInBundle(file_spec); ObjectFile::GetModuleSpecifications(file_spec, 0, 0, *specs.m_opaque_ap); return specs; Index: lldb/trunk/source/API/SBPlatform.cpp =================================================================== --- lldb/trunk/source/API/SBPlatform.cpp +++ lldb/trunk/source/API/SBPlatform.cpp @@ -244,9 +244,9 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) { if (path) - platform_sp->SetWorkingDirectory(FileSpec{path, false}); + platform_sp->SetWorkingDirectory(FileSpec(path)); else - platform_sp->SetWorkingDirectory(FileSpec{}); + platform_sp->SetWorkingDirectory(FileSpec()); return true; } return false; @@ -406,7 +406,7 @@ if (working_dir) shell_command.SetWorkingDirectory(working_dir); } - return platform_sp->RunShellCommand(command, FileSpec{working_dir, false}, + return platform_sp->RunShellCommand(command, FileSpec(working_dir), &shell_command.m_opaque_ptr->m_status, &shell_command.m_opaque_ptr->m_signo, &shell_command.m_opaque_ptr->m_output, @@ -449,7 +449,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) { sb_error.ref() = - platform_sp->MakeDirectory(FileSpec{path, false}, file_permissions); + platform_sp->MakeDirectory(FileSpec(path), file_permissions); } else { sb_error.SetErrorString("invalid platform"); } @@ -460,7 +460,7 @@ PlatformSP platform_sp(GetSP()); if (platform_sp) { uint32_t file_permissions = 0; - platform_sp->GetFilePermissions(FileSpec{path, false}, file_permissions); + platform_sp->GetFilePermissions(FileSpec(path), file_permissions); return file_permissions; } return 0; @@ -471,8 +471,8 @@ SBError sb_error; PlatformSP platform_sp(GetSP()); if (platform_sp) { - sb_error.ref() = platform_sp->SetFilePermissions(FileSpec{path, false}, - file_permissions); + sb_error.ref() = + platform_sp->SetFilePermissions(FileSpec(path), file_permissions); } else { sb_error.SetErrorString("invalid platform"); } Index: lldb/trunk/source/API/SBProcess.cpp =================================================================== --- lldb/trunk/source/API/SBProcess.cpp +++ lldb/trunk/source/API/SBProcess.cpp @@ -130,10 +130,9 @@ if (process_sp->GetState() == eStateConnected) { if (stop_at_entry) launch_flags |= eLaunchFlagStopAtEntry; - ProcessLaunchInfo launch_info( - FileSpec{stdin_path, false}, FileSpec{stdout_path, false}, - FileSpec{stderr_path, false}, FileSpec{working_directory, false}, - launch_flags); + ProcessLaunchInfo launch_info(FileSpec(stdin_path), FileSpec(stdout_path), + FileSpec(stderr_path), + FileSpec(working_directory), launch_flags); Module *exe_module = process_sp->GetTarget().GetExecutableModulePointer(); if (exe_module) launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true); @@ -1351,7 +1350,7 @@ return error; } - FileSpec core_file(file_name, false); + FileSpec core_file(file_name); error.ref() = PluginManager::SaveCore(process_sp, core_file); return error; } Index: lldb/trunk/source/API/SBTarget.cpp =================================================================== --- lldb/trunk/source/API/SBTarget.cpp +++ lldb/trunk/source/API/SBTarget.cpp @@ -226,7 +226,8 @@ SBProcess sb_process; TargetSP target_sp(GetSP()); if (target_sp) { - FileSpec filespec(core_file, true); + FileSpec filespec(core_file); + FileSystem::Instance().Resolve(filespec); ProcessSP process_sp(target_sp->CreateProcess( target_sp->GetDebugger().GetListener(), "", &filespec)); if (process_sp) { @@ -325,10 +326,9 @@ if (getenv("LLDB_LAUNCH_FLAG_DISABLE_STDIO")) launch_flags |= eLaunchFlagDisableSTDIO; - ProcessLaunchInfo launch_info( - FileSpec{stdin_path, false}, FileSpec{stdout_path, false}, - FileSpec{stderr_path, false}, FileSpec{working_directory, false}, - launch_flags); + ProcessLaunchInfo launch_info(FileSpec(stdin_path), FileSpec(stdout_path), + FileSpec(stderr_path), + FileSpec(working_directory), launch_flags); Module *exe_module = target_sp->GetExecutableModulePointer(); if (exe_module) @@ -516,8 +516,7 @@ if (name && target_sp) { ProcessAttachInfo attach_info; - attach_info.GetExecutableFile().SetFile(name, false, - FileSpec::Style::native); + attach_info.GetExecutableFile().SetFile(name, FileSpec::Style::native); attach_info.SetWaitForLaunch(wait_for); if (listener.IsValid()) attach_info.SetListener(listener.GetSP()); @@ -766,7 +765,7 @@ const lldb::addr_t offset = 0; if (module_name && module_name[0]) { FileSpecList module_spec_list; - module_spec_list.Append(FileSpec(module_name, false)); + module_spec_list.Append(FileSpec(module_name)); sb_bp = target_sp->CreateBreakpoint( &module_spec_list, NULL, symbol_name, eFunctionNameTypeAuto, eLanguageTypeUnknown, offset, skip_prologue, internal, hardware); @@ -894,7 +893,7 @@ SBFileSpecList module_spec_list; SBFileSpecList comp_unit_list; if (module_name && module_name[0]) { - module_spec_list.Append(FileSpec(module_name, false)); + module_spec_list.Append(FileSpec(module_name)); } return BreakpointCreateByRegex(symbol_name_regex, eLanguageTypeUnknown, module_spec_list, comp_unit_list); @@ -995,7 +994,7 @@ SBFileSpecList module_spec_list; if (module_name && module_name[0]) { - module_spec_list.Append(FileSpec(module_name, false)); + module_spec_list.Append(FileSpec(module_name)); } SBFileSpecList source_file_list; @@ -1549,7 +1548,7 @@ if (target_sp) { ModuleSpec module_spec; if (path) - module_spec.GetFileSpec().SetFile(path, false, FileSpec::Style::native); + module_spec.GetFileSpec().SetFile(path, FileSpec::Style::native); if (uuid_cstr) module_spec.GetUUID().SetFromStringRef(uuid_cstr); @@ -1561,8 +1560,7 @@ module_spec.GetArchitecture() = target_sp->GetArchitecture(); if (symfile) - module_spec.GetSymbolFileSpec().SetFile(symfile, false, - FileSpec::Style::native); + module_spec.GetSymbolFileSpec().SetFile(symfile, FileSpec::Style::native); sb_module.SetSP(target_sp->GetSharedModule(module_spec)); } Index: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp @@ -66,7 +66,7 @@ error.SetErrorString("BRA::CFSD: Couldn't read module name entry."); return nullptr; } - module_filespec.SetFile(module_name, false, FileSpec::Style::native); + module_filespec.SetFile(module_name, FileSpec::Style::native); } return new BreakpointResolverAddress(bkpt, address, module_filespec); } Index: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -92,7 +92,7 @@ return nullptr; } - FileSpec file_spec(filename, false); + FileSpec file_spec(filename); return new BreakpointResolverFileLine(bkpt, file_spec, line_no, column, offset, check_inlines, skip_prologue, Index: lldb/trunk/source/Commands/CommandCompletions.cpp =================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp +++ lldb/trunk/source/Commands/CommandCompletions.cpp @@ -361,7 +361,7 @@ CompletionRequest &request) : CommandCompletions::Completer(interpreter, request), m_include_support_files(include_support_files), m_matching_files() { - FileSpec partial_spec(m_request.GetCursorArgumentPrefix(), false); + FileSpec partial_spec(m_request.GetCursorArgumentPrefix()); m_file_name = partial_spec.GetFilename().GetCString(); m_dir_name = partial_spec.GetDirectory().GetCString(); } @@ -501,7 +501,7 @@ CommandCompletions::ModuleCompleter::ModuleCompleter( CommandInterpreter &interpreter, CompletionRequest &request) : CommandCompletions::Completer(interpreter, request) { - FileSpec partial_spec(m_request.GetCursorArgumentPrefix(), false); + FileSpec partial_spec(m_request.GetCursorArgumentPrefix()); m_file_name = partial_spec.GetFilename().GetCString(); m_dir_name = partial_spec.GetDirectory().GetCString(); } Index: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp @@ -438,7 +438,7 @@ } break; case 'f': - m_filenames.AppendIfUnique(FileSpec(option_arg, false)); + m_filenames.AppendIfUnique(FileSpec(option_arg)); break; case 'F': @@ -557,7 +557,7 @@ break; case 's': - m_modules.AppendIfUnique(FileSpec(option_arg, false)); + m_modules.AppendIfUnique(FileSpec(option_arg)); break; case 'S': @@ -2370,7 +2370,8 @@ std::unique_lock lock; target->GetBreakpointList().GetListMutex(lock); - FileSpec input_spec(m_options.m_filename, true); + FileSpec input_spec(m_options.m_filename); + FileSystem::Instance().Resolve(input_spec); BreakpointIDList new_bps; Status error = target->CreateBreakpointsFromFile( input_spec, m_options.m_names, new_bps); @@ -2504,8 +2505,10 @@ return false; } } - Status error = target->SerializeBreakpointsToFile( - FileSpec(m_options.m_filename, true), valid_bp_ids, m_options.m_append); + FileSpec file_spec(m_options.m_filename); + FileSystem::Instance().Resolve(file_spec); + Status error = target->SerializeBreakpointsToFile(file_spec, valid_bp_ids, + m_options.m_append); if (!error.Success()) { result.AppendErrorWithFormat("error serializing breakpoints: %s.", error.AsCString()); Index: lldb/trunk/source/Commands/CommandObjectCommands.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp @@ -308,7 +308,8 @@ return false; } - FileSpec cmd_file(command[0].ref, true); + FileSpec cmd_file(command[0].ref); + FileSystem::Instance().Resolve(cmd_file); ExecutionContext *exe_ctx = nullptr; // Just use the default context. // If any options were set, then use them Index: lldb/trunk/source/Commands/CommandObjectLog.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp +++ lldb/trunk/source/Commands/CommandObjectLog.cpp @@ -101,7 +101,8 @@ switch (short_option) { case 'f': - log_file.SetFile(option_arg, true, FileSpec::Style::native); + log_file.SetFile(option_arg, FileSpec::Style::native); + FileSystem::Instance().Resolve(log_file); break; case 't': log_options |= LLDB_LOG_OPTION_THREADSAFE; Index: lldb/trunk/source/Commands/CommandObjectMemory.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp @@ -1209,7 +1209,8 @@ switch (short_option) { case 'i': - m_infile.SetFile(option_value, true, FileSpec::Style::native); + m_infile.SetFile(option_value, FileSpec::Style::native); + FileSystem::Instance().Resolve(m_infile); if (!FileSystem::Instance().Exists(m_infile)) { m_infile.Clear(); error.SetErrorStringWithFormat("input file does not exist: '%s'", Index: lldb/trunk/source/Commands/CommandObjectPlatform.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectPlatform.cpp +++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp @@ -491,8 +491,7 @@ else mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX | lldb::eFilePermissionsWorldRX; - Status error = - platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode); + Status error = platform_sp->MakeDirectory(FileSpec(cmd_line), mode); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); } else { @@ -545,7 +544,7 @@ perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW | lldb::eFilePermissionsWorldRead; lldb::user_id_t fd = platform_sp->OpenFile( - FileSpec(cmd_line, false), + FileSpec(cmd_line), File::eOpenOptionRead | File::eOpenOptionWrite | File::eOpenOptionAppend | File::eOpenOptionCanCreate, perms, error); @@ -883,8 +882,8 @@ if (platform_sp) { const char *remote_file_path = args.GetArgumentAtIndex(0); const char *local_file_path = args.GetArgumentAtIndex(1); - Status error = platform_sp->GetFile(FileSpec(remote_file_path, false), - FileSpec(local_file_path, false)); + Status error = platform_sp->GetFile(FileSpec(remote_file_path), + FileSpec(local_file_path)); if (error.Success()) { result.AppendMessageWithFormat( "successfully get-file from %s (remote) to %s (host)\n", @@ -949,8 +948,7 @@ m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); if (platform_sp) { std::string remote_file_path(args.GetArgumentAtIndex(0)); - user_id_t size = - platform_sp->GetFileSize(FileSpec(remote_file_path, false)); + user_id_t size = platform_sp->GetFileSize(FileSpec(remote_file_path)); if (size != UINT64_MAX) { result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64 "\n", @@ -987,8 +985,9 @@ const char *src = args.GetArgumentAtIndex(0); const char *dst = args.GetArgumentAtIndex(1); - FileSpec src_fs(src, true); - FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString(), false); + FileSpec src_fs(src); + FileSystem::Instance().Resolve(src_fs); + FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString()); PlatformSP platform_sp( m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform()); @@ -1336,31 +1335,31 @@ case 'n': match_info.GetProcessInfo().GetExecutableFile().SetFile( - option_arg, false, FileSpec::Style::native); + option_arg, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Equals); break; case 'e': match_info.GetProcessInfo().GetExecutableFile().SetFile( - option_arg, false, FileSpec::Style::native); + option_arg, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::EndsWith); break; case 's': match_info.GetProcessInfo().GetExecutableFile().SetFile( - option_arg, false, FileSpec::Style::native); + option_arg, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); break; case 'c': match_info.GetProcessInfo().GetExecutableFile().SetFile( - option_arg, false, FileSpec::Style::native); + option_arg, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Contains); break; case 'r': match_info.GetProcessInfo().GetExecutableFile().SetFile( - option_arg, false, FileSpec::Style::native); + option_arg, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::RegularExpression); break; @@ -1529,7 +1528,7 @@ break; case 'n': - attach_info.GetExecutableFile().SetFile(option_arg, false, + attach_info.GetExecutableFile().SetFile(option_arg, FileSpec::Style::native); break; @@ -1576,7 +1575,7 @@ ProcessInstanceInfoMatch match_info; if (partial_name) { match_info.GetProcessInfo().GetExecutableFile().SetFile( - partial_name, false, FileSpec::Style::native); + partial_name, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); } platform_sp->FindProcesses(match_info, process_infos); @@ -1816,8 +1815,9 @@ return false; } // TODO: move the bulk of this code over to the platform itself - FileSpec src(args.GetArgumentAtIndex(0), true); - FileSpec dst(args.GetArgumentAtIndex(1), false); + FileSpec src(args.GetArgumentAtIndex(0)); + FileSystem::Instance().Resolve(src); + FileSpec dst(args.GetArgumentAtIndex(1)); if (!FileSystem::Instance().Exists(src)) { result.AppendError("source location does not exist or is not accessible"); result.SetStatus(eReturnStatusFailed); Index: lldb/trunk/source/Commands/CommandObjectPlugin.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectPlugin.cpp +++ lldb/trunk/source/Commands/CommandObjectPlugin.cpp @@ -63,7 +63,8 @@ Status error; - FileSpec dylib_fspec(command[0].ref, true); + FileSpec dylib_fspec(command[0].ref); + FileSystem::Instance().Resolve(dylib_fspec); if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error)) result.SetStatus(eReturnStatusSuccessFinishResult); Index: lldb/trunk/source/Commands/CommandObjectProcess.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp @@ -352,7 +352,7 @@ break; case 'n': - attach_info.GetExecutableFile().SetFile(option_arg, false, + attach_info.GetExecutableFile().SetFile(option_arg, FileSpec::Style::native); break; @@ -403,7 +403,7 @@ ProcessInstanceInfoMatch match_info; if (partial_name) { match_info.GetProcessInfo().GetExecutableFile().SetFile( - partial_name, false, FileSpec::Style::native); + partial_name, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); } platform_sp->FindProcesses(match_info, process_infos); @@ -975,7 +975,7 @@ case 'i': do_install = true; if (!option_arg.empty()) - install_path.SetFile(option_arg, false, FileSpec::Style::native); + install_path.SetFile(option_arg, FileSpec::Style::native); break; default: error.SetErrorStringWithFormat("invalid short option character '%c'", @@ -1023,18 +1023,20 @@ uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN; if (!m_options.do_install) { - FileSpec image_spec(image_path, false); + FileSpec image_spec(image_path); platform->ResolveRemotePath(image_spec, image_spec); image_token = platform->LoadImage(process, FileSpec(), image_spec, error); } else if (m_options.install_path) { - FileSpec image_spec(image_path, true); + FileSpec image_spec(image_path); + FileSystem::Instance().Resolve(image_spec); platform->ResolveRemotePath(m_options.install_path, m_options.install_path); image_token = platform->LoadImage(process, image_spec, m_options.install_path, error); } else { - FileSpec image_spec(image_path, true); + FileSpec image_spec(image_path); + FileSystem::Instance().Resolve(image_spec); image_token = platform->LoadImage(process, image_spec, FileSpec(), error); } @@ -1281,7 +1283,7 @@ ProcessSP process_sp = m_exe_ctx.GetProcessSP(); if (process_sp) { if (command.GetArgumentCount() == 1) { - FileSpec output_file(command.GetArgumentAtIndex(0), false); + FileSpec output_file(command.GetArgumentAtIndex(0)); Status error = PluginManager::SaveCore(process_sp, output_file); if (error.Success()) { result.SetStatus(eReturnStatusSuccessFinishResult); Index: lldb/trunk/source/Commands/CommandObjectSettings.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectSettings.cpp +++ lldb/trunk/source/Commands/CommandObjectSettings.cpp @@ -403,7 +403,9 @@ protected: bool DoExecute(Args &args, CommandReturnObject &result) override { - std::string path(FileSpec(m_options.m_filename, true).GetPath()); + FileSpec file_spec(m_options.m_filename); + FileSystem::Instance().Resolve(file_spec); + std::string path(file_spec.GetPath()); uint32_t options = File::OpenOptions::eOpenOptionWrite | File::OpenOptions::eOpenOptionCanCreate; if (m_options.m_append) @@ -506,7 +508,8 @@ protected: bool DoExecute(Args &command, CommandReturnObject &result) override { - FileSpec file(m_options.m_filename, true); + FileSpec file(m_options.m_filename); + FileSystem::Instance().Resolve(file); ExecutionContext clean_ctx; CommandInterpreterRunOptions options; options.SetAddToHistory(false); Index: lldb/trunk/source/Commands/CommandObjectSource.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp +++ lldb/trunk/source/Commands/CommandObjectSource.cpp @@ -517,7 +517,7 @@ // Dump the line entries found in the file specified in the option. bool DumpLinesForFile(CommandReturnObject &result) { - FileSpec file_spec(m_options.file_name, false); + FileSpec file_spec(m_options.file_name); const char *filename = m_options.file_name.c_str(); Target *target = m_exe_ctx.GetTargetPtr(); const ModuleList &module_list = @@ -596,7 +596,7 @@ m_module_list.Clear(); if (!m_options.modules.empty()) { for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) { - FileSpec module_file_spec(m_options.modules[i], false); + FileSpec module_file_spec(m_options.modules[i]); if (module_file_spec) { ModuleSpec module_spec(module_file_spec); if (target->GetImages().FindModules(module_spec, m_module_list) == 0) @@ -921,7 +921,7 @@ if (num_modules > 0) { ModuleList matching_modules; for (size_t i = 0; i < num_modules; ++i) { - FileSpec module_file_spec(m_options.modules[i], false); + FileSpec module_file_spec(m_options.modules[i]); if (module_file_spec) { ModuleSpec module_spec(module_file_spec); matching_modules.Clear(); @@ -946,7 +946,7 @@ if (num_modules > 0) { ModuleList matching_modules; for (size_t i = 0; i < num_modules; ++i) { - FileSpec module_file_spec(m_options.modules[i], false); + FileSpec module_file_spec(m_options.modules[i]); if (module_file_spec) { ModuleSpec module_spec(module_file_spec); matching_modules.Clear(); @@ -1203,7 +1203,7 @@ if (!m_options.modules.empty()) { ModuleList matching_modules; for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) { - FileSpec module_file_spec(m_options.modules[i], false); + FileSpec module_file_spec(m_options.modules[i]); if (module_file_spec) { ModuleSpec module_spec(module_file_spec); matching_modules.Clear(); Index: lldb/trunk/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp @@ -313,8 +313,10 @@ Timer scoped_timer(func_cat, "(lldb) target create '%s'", file_path); FileSpec file_spec; - if (file_path) - file_spec.SetFile(file_path, true, FileSpec::Style::native); + if (file_path) { + file_spec.SetFile(file_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(file_spec); + } bool must_set_platform_path = false; @@ -1793,7 +1795,7 @@ static size_t FindModulesByName(Target *target, const char *module_name, ModuleList &module_list, bool check_global_list) { - FileSpec module_file_spec(module_name, false); + FileSpec module_file_spec(module_name); ModuleSpec module_spec(module_file_spec); const size_t initial_size = module_list.GetSize(); @@ -2352,7 +2354,7 @@ for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx) { - FileSpec file_spec(arg_cstr, false); + FileSpec file_spec(arg_cstr); const ModuleList &target_modules = target->GetImages(); std::lock_guard guard(target_modules.GetMutex()); @@ -2532,7 +2534,7 @@ if (entry.ref.empty()) continue; - FileSpec file_spec(entry.ref, true); + FileSpec file_spec(entry.ref); if (FileSystem::Instance().Exists(file_spec)) { ModuleSpec module_spec(file_spec); if (m_uuid_option_group.GetOptionValue().OptionWasSet()) @@ -3616,7 +3618,7 @@ break; case 'f': - m_file.SetFile(option_arg, false, FileSpec::Style::native); + m_file.SetFile(option_arg, FileSpec::Style::native); m_type = eLookupTypeFileLine; break; @@ -4348,8 +4350,9 @@ for (auto &entry : args.entries()) { if (!entry.ref.empty()) { - module_spec.GetSymbolFileSpec().SetFile(entry.ref, true, - FileSpec::Style::native); + auto &symbol_file_spec = module_spec.GetSymbolFileSpec(); + symbol_file_spec.SetFile(entry.ref, FileSpec::Style::native); + FileSystem::Instance().Resolve(symbol_file_spec); if (file_option_set) { module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue(); Index: lldb/trunk/source/Commands/CommandObjectThread.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp +++ lldb/trunk/source/Commands/CommandObjectThread.cpp @@ -1729,7 +1729,7 @@ switch (short_option) { case 'f': - m_filenames.AppendIfUnique(FileSpec(option_arg, false)); + m_filenames.AppendIfUnique(FileSpec(option_arg)); if (m_filenames.GetSize() > 1) return Status("only one source file expected."); break; Index: lldb/trunk/source/Core/Debugger.cpp =================================================================== --- lldb/trunk/source/Core/Debugger.cpp +++ lldb/trunk/source/Core/Debugger.cpp @@ -625,8 +625,8 @@ // file type information. if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { - FileSpec plugin_file_spec(path, false); - plugin_file_spec.ResolvePath(); + FileSpec plugin_file_spec(path); + FileSystem::Instance().Resolve(plugin_file_spec); if (plugin_file_spec.GetFileNameExtension() != g_dylibext && plugin_file_spec.GetFileNameExtension() != g_solibext) { Index: lldb/trunk/source/Core/DynamicLoader.cpp =================================================================== --- lldb/trunk/source/Core/DynamicLoader.cpp +++ lldb/trunk/source/Core/DynamicLoader.cpp @@ -195,9 +195,8 @@ if (error.Success() && memory_info.GetMapped() && memory_info.GetRange().GetRangeBase() == base_addr && !(memory_info.GetName().IsEmpty())) { - ModuleSpec new_module_spec( - FileSpec(memory_info.GetName().AsCString(), false), - target.GetArchitecture()); + ModuleSpec new_module_spec(FileSpec(memory_info.GetName().AsCString()), + target.GetArchitecture()); if ((module_sp = modules.FindFirstModule(new_module_spec))) { UpdateLoadedSections(module_sp, link_map_addr, base_addr, false); Index: lldb/trunk/source/Core/Module.cpp =================================================================== --- lldb/trunk/source/Core/Module.cpp +++ lldb/trunk/source/Core/Module.cpp @@ -569,7 +569,7 @@ uint32_t Module::ResolveSymbolContextForFilePath( const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) { - FileSpec file_spec(file_path, false); + FileSpec file_spec(file_path); return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines, resolve_scope, sc_list); } Index: lldb/trunk/source/Core/ModuleList.cpp =================================================================== --- lldb/trunk/source/Core/ModuleList.cpp +++ lldb/trunk/source/Core/ModuleList.cpp @@ -690,7 +690,7 @@ uint32_t ModuleList::ResolveSymbolContextForFilePath( const char *file_path, uint32_t line, bool check_inlines, SymbolContextItem resolve_scope, SymbolContextList &sc_list) const { - FileSpec file_spec(file_path, false); + FileSpec file_spec(file_path); return ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines, resolve_scope, sc_list); } @@ -857,8 +857,7 @@ const auto num_directories = module_search_paths_ptr->GetSize(); for (size_t idx = 0; idx < num_directories; ++idx) { auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx); - if (!search_path_spec.ResolvePath()) - continue; + FileSystem::Instance().Resolve(search_path_spec); namespace fs = llvm::sys::fs; if (!fs::is_directory(search_path_spec.GetPath())) continue; Index: lldb/trunk/source/Core/PluginManager.cpp =================================================================== --- lldb/trunk/source/Core/PluginManager.cpp +++ lldb/trunk/source/Core/PluginManager.cpp @@ -103,8 +103,8 @@ // file type information. if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { - FileSpec plugin_file_spec(path, false); - plugin_file_spec.ResolvePath(); + FileSpec plugin_file_spec(path); + FileSystem::Instance().Resolve(plugin_file_spec); if (PluginIsLoaded(plugin_file_spec)) return FileSystem::eEnumerateDirectoryResultNext; Index: lldb/trunk/source/Core/SearchFilter.cpp =================================================================== --- lldb/trunk/source/Core/SearchFilter.cpp +++ lldb/trunk/source/Core/SearchFilter.cpp @@ -524,7 +524,7 @@ error.SetErrorString("SFBM::CFSD: filter module item not a string."); return nullptr; } - FileSpec module_spec(module, false); + FileSpec module_spec(module); return std::make_shared(target.shared_from_this(), module_spec); @@ -680,7 +680,7 @@ "SFBM::CFSD: filter module item %zu not a string.", i); return nullptr; } - modules.Append(FileSpec(module, false)); + modules.Append(FileSpec(module)); } } @@ -745,7 +745,7 @@ "SFBM::CFSD: filter module item %zu not a string.", i); return result_sp; } - modules.Append(FileSpec(module, false)); + modules.Append(FileSpec(module)); } } @@ -767,7 +767,7 @@ "SFBM::CFSD: filter cu item %zu not a string.", i); return nullptr; } - cus.Append(FileSpec(cu, false)); + cus.Append(FileSpec(cu)); } return std::make_shared( Index: lldb/trunk/source/Expression/REPL.cpp =================================================================== --- lldb/trunk/source/Expression/REPL.cpp +++ lldb/trunk/source/Expression/REPL.cpp @@ -66,7 +66,7 @@ tmpdir_file_spec.GetFilename().SetCString(file_basename.AsCString()); m_repl_source_path = tmpdir_file_spec.GetPath(); } else { - tmpdir_file_spec = FileSpec("/tmp", false); + tmpdir_file_spec = FileSpec("/tmp"); tmpdir_file_spec.AppendPathComponent(file_basename.AsCString()); } @@ -429,7 +429,7 @@ // Now set the default file and line to the REPL source file m_target.GetSourceManager().SetDefaultFileAndLine( - FileSpec(m_repl_source_path, false), new_default_line); + FileSpec(m_repl_source_path), new_default_line); } static_cast(io_handler) .SetBaseLineNumber(m_code.GetSize() + 1); Index: lldb/trunk/source/Host/common/Editline.cpp =================================================================== --- lldb/trunk/source/Host/common/Editline.cpp +++ lldb/trunk/source/Host/common/Editline.cpp @@ -13,6 +13,7 @@ #include "lldb/Host/ConnectionFileDescriptor.h" #include "lldb/Host/Editline.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/LLDBAssert.h" @@ -172,7 +173,8 @@ const char *GetHistoryFilePath() { if (m_path.empty() && m_history && !m_prefix.empty()) { - FileSpec parent_path{"~/.lldb", true}; + FileSpec parent_path("~/.lldb"); + FileSystem::Instance().Resolve(parent_path); char history_path[PATH_MAX]; if (!llvm::sys::fs::create_directory(parent_path.GetPath())) { snprintf(history_path, sizeof(history_path), "~/.lldb/%s-history", @@ -181,7 +183,9 @@ snprintf(history_path, sizeof(history_path), "~/%s-widehistory", m_prefix.c_str()); } - m_path = FileSpec(history_path, true).GetPath(); + auto file_spec = FileSpec(history_path); + FileSystem::Instance().Resolve(file_spec); + m_path = file_spec.GetPath(); } if (m_path.empty()) return NULL; Index: lldb/trunk/source/Host/common/File.cpp =================================================================== --- lldb/trunk/source/Host/common/File.cpp +++ lldb/trunk/source/Host/common/File.cpp @@ -315,7 +315,7 @@ if (::fcntl(GetDescriptor(), F_GETPATH, path) == -1) error.SetErrorToErrno(); else - file_spec.SetFile(path, false, FileSpec::Style::native); + file_spec.SetFile(path, FileSpec::Style::native); } else { error.SetErrorString("invalid file handle"); } @@ -330,7 +330,7 @@ error.SetErrorToErrno(); else { path[len] = '\0'; - file_spec.SetFile(path, false, FileSpec::Style::native); + file_spec.SetFile(path, FileSpec::Style::native); } } #else Index: lldb/trunk/source/Host/common/FileSystem.cpp =================================================================== --- lldb/trunk/source/Host/common/FileSystem.cpp +++ lldb/trunk/source/Host/common/FileSystem.cpp @@ -141,7 +141,7 @@ if (EC) return EC; - FileSpec new_file_spec(path, false, file_spec.GetPathStyle()); + FileSpec new_file_spec(path, file_spec.GetPathStyle()); file_spec = new_file_spec; return {}; } @@ -179,6 +179,7 @@ // Update the FileSpec with the resolved path. file_spec.SetPath(path); + file_spec.SetIsResolved(true); } bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { @@ -206,7 +207,7 @@ return false; // Make sure that the result exists. - FileSpec result(*error_or_path, false); + FileSpec result(*error_or_path); if (!Exists(result)) return false; Index: lldb/trunk/source/Host/common/Host.cpp =================================================================== --- lldb/trunk/source/Host/common/Host.cpp +++ lldb/trunk/source/Host/common/Host.cpp @@ -420,8 +420,10 @@ #if !defined(__ANDROID__) Dl_info info; if (::dladdr(host_addr, &info)) { - if (info.dli_fname) - module_filespec.SetFile(info.dli_fname, true, FileSpec::Style::native); + if (info.dli_fname) { + module_filespec.SetFile(info.dli_fname, FileSpec::Style::native); + FileSystem::Instance().Resolve(module_filespec); + } } #endif return module_filespec; @@ -511,7 +513,7 @@ } } - FileSpec output_file_spec{output_file_path.c_str(), false}; + FileSpec output_file_spec(output_file_path.c_str()); launch_info.AppendSuppressFileAction(STDIN_FILENO, true, false); if (output_file_spec) { Index: lldb/trunk/source/Host/common/HostInfoBase.cpp =================================================================== --- lldb/trunk/source/Host/common/HostInfoBase.cpp +++ lldb/trunk/source/Host/common/HostInfoBase.cpp @@ -256,7 +256,8 @@ bool HostInfoBase::ComputeTempFileBaseDirectory(FileSpec &file_spec) { llvm::SmallVector tmpdir; llvm::sys::path::system_temp_directory(/*ErasedOnReboot*/ true, tmpdir); - file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size()), true); + file_spec = FileSpec(std::string(tmpdir.data(), tmpdir.size())); + FileSystem::Instance().Resolve(file_spec); return true; } Index: lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp =================================================================== --- lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp +++ lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp @@ -35,7 +35,7 @@ llvm::sys::fs::file_status stats; status(exe_spec.GetPath(), stats); if (!exists(stats)) { - exe_spec.ResolvePath(); + FileSystem::Instance().Resolve(exe_spec); status(exe_spec.GetPath(), stats); } if (!exists(stats)) { Index: lldb/trunk/source/Host/common/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -264,20 +264,34 @@ FileSystem::Instance().ResolveSymbolicLink(module_file_spec, module_file_spec); const ConstString &file_dir = module_file_spec.GetDirectory(); - debug_file_search_paths.AppendIfUnique( - FileSpec(file_dir.AsCString("."), true)); + { + FileSpec file_spec(file_dir.AsCString(".")); + FileSystem::Instance().Resolve(file_spec); + debug_file_search_paths.AppendIfUnique(file_spec); + } // Add current working directory. - debug_file_search_paths.AppendIfUnique(FileSpec(".", true)); + { + FileSpec file_spec("."); + FileSystem::Instance().Resolve(file_spec); + debug_file_search_paths.AppendIfUnique(file_spec); + } #ifndef _WIN32 #if defined(__NetBSD__) // Add /usr/libdata/debug directory. - debug_file_search_paths.AppendIfUnique( - FileSpec("/usr/libdata/debug", true)); + { + FileSpec file_spec("/usr/libdata/debug"); + FileSystem::Instance().Resolve(file_spec); + debug_file_search_paths.AppendIfUnique(file_spec); + } #else // Add /usr/lib/debug directory. - debug_file_search_paths.AppendIfUnique(FileSpec("/usr/lib/debug", true)); + { + FileSpec file_spec("/usr/lib/debug"); + FileSystem::Instance().Resolve(file_spec); + debug_file_search_paths.AppendIfUnique(file_spec); + } #endif #endif // _WIN32 @@ -296,7 +310,7 @@ size_t num_directories = debug_file_search_paths.GetSize(); for (size_t idx = 0; idx < num_directories; ++idx) { FileSpec dirspec = debug_file_search_paths.GetFileSpecAtIndex(idx); - dirspec.ResolvePath(); + FileSystem::Instance().Resolve(dirspec); if (!llvm::sys::fs::is_directory(dirspec.GetPath())) continue; @@ -315,7 +329,8 @@ const uint32_t num_files = files.size(); for (size_t idx_file = 0; idx_file < num_files; ++idx_file) { const std::string &filename = files[idx_file]; - FileSpec file_spec(filename, true); + FileSpec file_spec(filename); + FileSystem::Instance().Resolve(file_spec); if (llvm::sys::fs::equivalent(file_spec.GetPath(), module_file_spec.GetPath())) Index: lldb/trunk/source/Host/linux/Host.cpp =================================================================== --- lldb/trunk/source/Host/linux/Host.cpp +++ lldb/trunk/source/Host/linux/Host.cpp @@ -190,8 +190,7 @@ return false; process_info.SetProcessID(pid); - process_info.GetExecutableFile().SetFile(PathRef, false, - FileSpec::Style::native); + process_info.GetExecutableFile().SetFile(PathRef, FileSpec::Style::native); llvm::StringRef Rest = Environ->getBuffer(); while (!Rest.empty()) { Index: lldb/trunk/source/Host/linux/HostInfoLinux.cpp =================================================================== --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp @@ -171,7 +171,7 @@ ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1); if (len > 0) { exe_path[len] = 0; - g_program_filespec.SetFile(exe_path, false, FileSpec::Style::native); + g_program_filespec.SetFile(exe_path, FileSpec::Style::native); } } @@ -187,7 +187,8 @@ } bool HostInfoLinux::ComputeSystemPluginsDirectory(FileSpec &file_spec) { - FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins", true); + FileSpec temp_file("/usr/lib" LLDB_LIBDIR_SUFFIX "/lldb/plugins"); + FileSystem::Instance().Resolve(temp_file); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); return true; } Index: lldb/trunk/source/Host/macosx/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/macosx/Symbols.cpp +++ lldb/trunk/source/Host/macosx/Symbols.cpp @@ -105,7 +105,9 @@ "UUID %s -- looking for the dSYM", path, uuid->GetAsString().c_str()); } - FileSpec dsym_filespec(path, path[0] == '~'); + FileSpec dsym_filespec(path); + if (path[0] == '~') + FileSystem::Instance().Resolve(dsym_filespec); if (llvm::sys::fs::is_directory(dsym_filespec.GetPath())) { dsym_filespec = @@ -146,7 +148,9 @@ path, uuid->GetAsString().c_str()); } ++items_found; - FileSpec exec_filespec(path, path[0] == '~'); + FileSpec exec_filespec(path); + if (path[0] == '~') + FileSystem::Instance().Resolve(exec_filespec); if (FileSystem::Instance().Exists(exec_filespec)) { success = true; return_module_spec.GetFileSpec() = exec_filespec; @@ -167,7 +171,8 @@ "bundle with name with name %s", path); } - FileSpec file_spec(path, true); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); ModuleSpecList module_specs; ModuleSpec matched_module_spec; using namespace llvm::sys::fs; @@ -182,7 +187,8 @@ if (::CFURLGetFileSystemRepresentation(bundle_exe_url.get(), true, (UInt8 *)path, sizeof(path) - 1)) { - FileSpec bundle_exe_file_spec(path, true); + FileSpec bundle_exe_file_spec(path); + FileSystem::Instance().Resolve(bundle_exe_file_spec); if (ObjectFile::GetModuleSpecifications( bundle_exe_file_spec, 0, 0, module_specs) && module_specs.FindMatchingModuleSpec( @@ -307,8 +313,8 @@ (CFDictionaryRef)uuid_dict, CFSTR("DBGSymbolRichExecutable")); if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { if (CFCString::FileSystemRepresentation(cf_str, str)) { - module_spec.GetFileSpec().SetFile(str.c_str(), true, - FileSpec::Style::native); + module_spec.GetFileSpec().SetFile(str.c_str(), FileSpec::Style::native); + FileSystem::Instance().Resolve(module_spec.GetFileSpec()); if (log) { log->Printf( "From dsymForUUID plist: Symbol rich executable is at '%s'", @@ -321,8 +327,9 @@ CFSTR("DBGDSYMPath")); if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) { if (CFCString::FileSystemRepresentation(cf_str, str)) { - module_spec.GetSymbolFileSpec().SetFile(str.c_str(), true, + module_spec.GetSymbolFileSpec().SetFile(str.c_str(), FileSpec::Style::native); + FileSystem::Instance().Resolve(module_spec.GetFileSpec()); success = true; if (log) { log->Printf("From dsymForUUID plist: dSYM is at '%s'", str.c_str()); @@ -401,7 +408,8 @@ DBGSourcePath = original_DBGSourcePath_value; } if (DBGSourcePath[0] == '~') { - FileSpec resolved_source_path(DBGSourcePath.c_str(), true); + FileSpec resolved_source_path(DBGSourcePath.c_str()); + FileSystem::Instance().Resolve(resolved_source_path); DBGSourcePath = resolved_source_path.GetPath(); } // With version 2 of DBGSourcePathRemapping, we can chop off the @@ -412,8 +420,8 @@ ConstString(DBGBuildSourcePath.c_str()), ConstString(DBGSourcePath.c_str()), true); if (do_truncate_remapping_names) { - FileSpec build_path(DBGBuildSourcePath.c_str(), false); - FileSpec source_path(DBGSourcePath.c_str(), false); + FileSpec build_path(DBGBuildSourcePath.c_str()); + FileSpec source_path(DBGSourcePath.c_str()); build_path.RemoveLastPathComponent(); build_path.RemoveLastPathComponent(); source_path.RemoveLastPathComponent(); @@ -449,7 +457,8 @@ if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) { if (DBGSourcePath[0] == '~') { - FileSpec resolved_source_path(DBGSourcePath.c_str(), true); + FileSpec resolved_source_path(DBGSourcePath.c_str()); + FileSystem::Instance().Resolve(resolved_source_path); DBGSourcePath = resolved_source_path.GetPath(); } module_spec.GetSourceMappingList().Append( @@ -505,14 +514,15 @@ getenv("LLDB_APPLE_DSYMFORUUID_EXECUTABLE"); FileSpec dsym_for_uuid_exe_spec; if (dsym_for_uuid_exe_path_cstr) { - dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true, + dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, FileSpec::Style::native); + FileSystem::Instance().Resolve(dsym_for_uuid_exe_spec); g_dsym_for_uuid_exe_exists = FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } if (!g_dsym_for_uuid_exe_exists) { - dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false, + dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", FileSpec::Style::native); g_dsym_for_uuid_exe_exists = FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); @@ -528,7 +538,7 @@ tilde_rc && tilde_rc->pw_dir) { std::string dsymforuuid_path(tilde_rc->pw_dir); dsymforuuid_path += "/bin/dsymForUUID"; - dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false, + dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), FileSpec::Style::native); g_dsym_for_uuid_exe_exists = FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); @@ -537,8 +547,9 @@ } } if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL) { - dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true, + dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, FileSpec::Style::native); + FileSystem::Instance().Resolve(dsym_for_uuid_exe_spec); g_dsym_for_uuid_exe_exists = FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } Index: lldb/trunk/source/Host/macosx/objcxx/Host.mm =================================================================== --- lldb/trunk/source/Host/macosx/objcxx/Host.mm +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm @@ -106,7 +106,7 @@ if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); if (bundle.GetPath(path, sizeof(path))) { - bundle_directory.SetFile(path, false, FileSpec::Style::native); + bundle_directory.SetFile(path, FileSpec::Style::native); return true; } } @@ -126,7 +126,7 @@ if (url.get()) { if (::CFURLGetFileSystemRepresentation(url.get(), YES, (UInt8 *)path, sizeof(path))) { - file.SetFile(path, false, FileSpec::Style::native); + file.SetFile(path, FileSpec::Style::native); return true; } } @@ -542,8 +542,7 @@ triple_arch == llvm::Triple::x86_64); const char *cstr = data.GetCStr(&offset); if (cstr) { - process_info.GetExecutableFile().SetFile(cstr, false, - FileSpec::Style::native); + process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); if (match_info_ptr == NULL || NameMatches( @@ -1279,7 +1278,7 @@ llvm::sys::fs::file_status stats; status(exe_spec.GetPath(), stats); if (!exists(stats)) { - exe_spec.ResolvePath(); + FileSystem::Instance().Resolve(exe_spec); status(exe_spec.GetPath(), stats); } if (!exists(stats)) { @@ -1362,7 +1361,7 @@ "cwd does not exist; cannot launch with shell argument expansion"); return error; } else { - FileSpec working_dir(wd, false); + FileSpec working_dir(wd); free(wd); launch_info.SetWorkingDirectory(working_dir); } Index: lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm =================================================================== --- lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Host/HostInfo.h" #include "lldb/Host/macosx/HostInfoMacOSX.h" +#include "lldb/Host/FileSystem.h" +#include "lldb/Host/HostInfo.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Log.h" @@ -96,14 +97,13 @@ uint32_t len = sizeof(program_fullpath); int err = _NSGetExecutablePath(program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(program_fullpath, false, - FileSpec::Style::native); + g_program_filespec.SetFile(program_fullpath, FileSpec::Style::native); else if (err == -1) { char *large_program_fullpath = (char *)::malloc(len + 1); err = _NSGetExecutablePath(large_program_fullpath, &len); if (err == 0) - g_program_filespec.SetFile(large_program_fullpath, false, + g_program_filespec.SetFile(large_program_fullpath, FileSpec::Style::native); ::free(large_program_fullpath); @@ -139,7 +139,8 @@ // as in the case of a python script, the executable is python, not // the lldb driver. raw_path.append("/../bin"); - FileSpec support_dir_spec(raw_path, true); + FileSpec support_dir_spec(raw_path); + FileSystem::Instance().Resolve(support_dir_spec); if (!llvm::sys::fs::is_directory(support_dir_spec.GetPath())) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) @@ -203,7 +204,8 @@ } bool HostInfoMacOSX::ComputeUserPluginsDirectory(FileSpec &file_spec) { - FileSpec temp_file("~/Library/Application Support/LLDB/PlugIns", true); + FileSpec temp_file("~/Library/Application Support/LLDB/PlugIns"); + FileSystem::Instance().Resolve(temp_file); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); return true; } Index: lldb/trunk/source/Host/posix/FileSystem.cpp =================================================================== --- lldb/trunk/source/Host/posix/FileSystem.cpp +++ lldb/trunk/source/Host/posix/FileSystem.cpp @@ -47,7 +47,7 @@ error.SetErrorToErrno(); else { buf[count] = '\0'; // Success - dst.SetFile(buf, false, FileSpec::Style::native); + dst.SetFile(buf, FileSpec::Style::native); } return error; } @@ -65,7 +65,7 @@ return err; } - dst = FileSpec(real_path, false); + dst = FileSpec(real_path); return Status(); } Index: lldb/trunk/source/Host/posix/HostInfoPosix.cpp =================================================================== --- lldb/trunk/source/Host/posix/HostInfoPosix.cpp +++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp @@ -119,7 +119,7 @@ uint32_t HostInfoPosix::GetEffectiveGroupID() { return getegid(); } -FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh", false); } +FileSpec HostInfoPosix::GetDefaultShell() { return FileSpec("/bin/sh"); } bool HostInfoPosix::ComputePathRelativeToLibrary(FileSpec &file_spec, llvm::StringRef dir) { @@ -163,7 +163,7 @@ } bool HostInfoPosix::ComputeHeaderDirectory(FileSpec &file_spec) { - FileSpec temp_file("/opt/local/include/lldb", false); + FileSpec temp_file("/opt/local/include/lldb"); file_spec.GetDirectory().SetCString(temp_file.GetPath().c_str()); return true; } Index: lldb/trunk/source/Host/posix/HostProcessPosix.cpp =================================================================== --- lldb/trunk/source/Host/posix/HostProcessPosix.cpp +++ lldb/trunk/source/Host/posix/HostProcessPosix.cpp @@ -62,7 +62,7 @@ return error; } - error = FileSystem::Instance().Readlink(FileSpec{link_path, false}, file_spec); + error = FileSystem::Instance().Readlink(FileSpec(link_path), file_spec); if (!error.Success()) return error; Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -2087,12 +2087,13 @@ LoadCWDlldbinitFile should_load = target->TargetProperties::GetLoadCWDlldbinitFile(); if (should_load == eLoadCWDlldbinitWarn) { - FileSpec dot_lldb(".lldbinit", true); + FileSpec dot_lldb(".lldbinit"); + FileSystem::Instance().Resolve(dot_lldb); llvm::SmallString<64> home_dir_path; llvm::sys::path::home_directory(home_dir_path); - FileSpec homedir_dot_lldb(home_dir_path.c_str(), false); + FileSpec homedir_dot_lldb(home_dir_path.c_str()); homedir_dot_lldb.AppendPathComponent(".lldbinit"); - homedir_dot_lldb.ResolvePath(); + FileSystem::Instance().Resolve(homedir_dot_lldb); if (FileSystem::Instance().Exists(dot_lldb) && dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) { result.AppendErrorWithFormat( @@ -2111,7 +2112,8 @@ return; } } else if (should_load == eLoadCWDlldbinitTrue) { - init_file.SetFile("./.lldbinit", true, FileSpec::Style::native); + init_file.SetFile("./.lldbinit", FileSpec::Style::native); + FileSystem::Instance().Resolve(init_file); } } } else { @@ -2123,7 +2125,7 @@ // init files. llvm::SmallString<64> home_dir_path; llvm::sys::path::home_directory(home_dir_path); - FileSpec profilePath(home_dir_path.c_str(), false); + FileSpec profilePath(home_dir_path.c_str()); profilePath.AppendPathComponent(".lldbinit"); std::string init_file_path = profilePath.GetPath(); @@ -2135,15 +2137,15 @@ char program_init_file_name[PATH_MAX]; ::snprintf(program_init_file_name, sizeof(program_init_file_name), "%s-%s", init_file_path.c_str(), program_name); - init_file.SetFile(program_init_file_name, true, - FileSpec::Style::native); + init_file.SetFile(program_init_file_name, FileSpec::Style::native); + FileSystem::Instance().Resolve(init_file); if (!FileSystem::Instance().Exists(init_file)) init_file.Clear(); } } if (!init_file && !m_skip_lldbinit_files) - init_file.SetFile(init_file_path, false, FileSpec::Style::native); + init_file.SetFile(init_file_path, FileSpec::Style::native); } // If the file exists, tell HandleCommand to 'source' it; this will do the Index: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp +++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp @@ -75,7 +75,9 @@ // or whitespace. value = value.trim("\"' \t"); m_value_was_set = true; - m_current_value.SetFile(value.str(), m_resolve, FileSpec::Style::native); + m_current_value.SetFile(value.str(), FileSpec::Style::native); + if (m_resolve) + FileSystem::Instance().Resolve(m_current_value); m_data_sp.reset(); m_data_mod_time = llvm::sys::TimePoint<>(); NotifyValueChanged(); Index: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp +++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -69,7 +69,7 @@ count); } else { for (size_t i = 1; i < argc; ++i, ++idx) { - FileSpec file(args.GetArgumentAtIndex(i), false); + FileSpec file(args.GetArgumentAtIndex(i)); if (idx < count) m_current_value.Replace(idx, file); else @@ -91,7 +91,7 @@ if (argc > 0) { m_value_was_set = true; for (size_t i = 0; i < argc; ++i) { - FileSpec file(args.GetArgumentAtIndex(i), false); + FileSpec file(args.GetArgumentAtIndex(i)); m_current_value.Append(file); } NotifyValueChanged(); @@ -115,7 +115,7 @@ if (op == eVarSetOperationInsertAfter) ++idx; for (size_t i = 1; i < argc; ++i, ++idx) { - FileSpec file(args.GetArgumentAtIndex(i), false); + FileSpec file(args.GetArgumentAtIndex(i)); m_current_value.Insert(idx, file); } NotifyValueChanged(); Index: lldb/trunk/source/Interpreter/Options.cpp =================================================================== --- lldb/trunk/source/Interpreter/Options.cpp +++ lldb/trunk/source/Interpreter/Options.cpp @@ -831,7 +831,7 @@ const char *module_name = request.GetParsedLine().GetArgumentAtIndex(cur_arg_pos); if (module_name) { - FileSpec module_spec(module_name, false); + FileSpec module_spec(module_name); lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget(); // Search filters require a target... Index: lldb/trunk/source/Interpreter/Property.cpp =================================================================== --- lldb/trunk/source/Interpreter/Property.cpp +++ lldb/trunk/source/Interpreter/Property.cpp @@ -102,8 +102,10 @@ // "definition.default_uint_value" represents if the // "definition.default_cstr_value" should be resolved or not const bool resolve = definition.default_uint_value != 0; - m_value_sp.reset(new OptionValueFileSpec( - FileSpec(definition.default_cstr_value, resolve), resolve)); + FileSpec file_spec = FileSpec(definition.default_cstr_value); + if (resolve) + FileSystem::Instance().Resolve(file_spec); + m_value_sp.reset(new OptionValueFileSpec(file_spec, resolve)); break; } Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -435,8 +435,8 @@ if (header.filetype == llvm::MachO::MH_EXECUTE && (header.flags & llvm::MachO::MH_DYLDLINK) == 0) { // Create a full module to get the UUID - ModuleSP memory_module_sp = process->ReadModuleFromMemory( - FileSpec("temp_mach_kernel", false), addr); + ModuleSP memory_module_sp = + process->ReadModuleFromMemory(FileSpec("temp_mach_kernel"), addr); if (!memory_module_sp.get()) return UUID(); @@ -646,8 +646,7 @@ if (m_load_address == LLDB_INVALID_ADDRESS) return false; - FileSpec file_spec; - file_spec.SetFile(m_name.c_str(), false, FileSpec::Style::native); + FileSpec file_spec(m_name.c_str()); llvm::MachO::mach_header mh; size_t size_to_read = 512; @@ -807,7 +806,7 @@ PlatformDarwinKernel::GetPluginNameStatic()); if (platform_name == g_platform_name) { ModuleSpec kext_bundle_module_spec(module_spec); - FileSpec kext_filespec(m_name.c_str(), false); + FileSpec kext_filespec(m_name.c_str()); kext_bundle_module_spec.GetFileSpec() = kext_filespec; platform_sp->GetSharedModule( kext_bundle_module_spec, process, m_module_sp, Index: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -367,7 +367,8 @@ E = m_rendezvous.loaded_end(); for (I = m_rendezvous.loaded_begin(); I != E; ++I) { - FileSpec file(I->path, true); + FileSpec file(I->path); + FileSystem::Instance().Resolve(file); ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { @@ -391,7 +392,8 @@ E = m_rendezvous.unloaded_end(); for (I = m_rendezvous.unloaded_begin(); I != E; ++I) { - FileSpec file(I->path, true); + FileSpec file(I->path); + FileSystem::Instance().Resolve(file); ModuleSpec module_spec(file); ModuleSP module_sp = loaded_modules.FindFirstModule(module_spec); @@ -485,7 +487,7 @@ for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) { const char *module_path = I->path.c_str(); - FileSpec file(module_path, false); + FileSpec file(module_path); ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -374,7 +374,7 @@ image_infos[i].mod_date = image->GetValueForKey("mod_date")->GetAsInteger()->GetValue(); image_infos[i].file_spec.SetFile( - image->GetValueForKey("pathname")->GetAsString()->GetValue(), false, + image->GetValueForKey("pathname")->GetAsString()->GetValue(), FileSpec::Style::native); StructuredData::Dictionary *mh = Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -693,9 +693,7 @@ error); // don't resolve the path if (error.Success()) { - const bool resolve_path = false; - image_infos[i].file_spec.SetFile(raw_path, resolve_path, - FileSpec::Style::native); + image_infos[i].file_spec.SetFile(raw_path, FileSpec::Style::native); } } return true; @@ -894,7 +892,8 @@ const lldb::offset_t name_offset = load_cmd_offset + data.GetU32(&offset); const char *path = data.PeekCStr(name_offset); - lc_id_dylinker->SetFile(path, true, FileSpec::Style::native); + lc_id_dylinker->SetFile(path, FileSpec::Style::native); + FileSystem::Instance().Resolve(*lc_id_dylinker); } break; Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -243,7 +243,7 @@ entry.base_addr = base_addr; entry.dyn_addr = dyn_addr; - entry.file_spec.SetFile(name, false, FileSpec::Style::native); + entry.file_spec.SetFile(name, FileSpec::Style::native); UpdateBaseAddrIfNecessary(entry, name); @@ -517,7 +517,7 @@ return false; std::string file_path = ReadStringFromMemory(entry.path_addr); - entry.file_spec.SetFile(file_path, false, FileSpec::Style::native); + entry.file_spec.SetFile(file_path, FileSpec::Style::native); UpdateBaseAddrIfNecessary(entry, file_path); Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -512,7 +512,7 @@ if (m_vdso_base == LLDB_INVALID_ADDRESS) return; - FileSpec file("[vdso]", false); + FileSpec file("[vdso]"); MemoryRegionInfo info; Status status = m_process->GetMemoryRegionInfo(m_vdso_base, info); @@ -543,7 +543,7 @@ return nullptr; } - FileSpec file(info.GetName().GetCString(), false); + FileSpec file(info.GetName().GetCString()); ModuleSpec module_spec(file, target.GetArchitecture()); if (ModuleSP module_sp = target.GetSharedModule(module_spec)) { Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -18,6 +18,7 @@ #include "llvm/Support/Threading.h" // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #if !defined(_WIN32) #include "lldb/Host/posix/HostInfoPosix.h" @@ -84,7 +85,8 @@ "Developer/Toolchains/XcodeDefault.xctoolchain", swift_clang_resource_dir); if (!verify || VerifyClangPath(clang_path)) { - file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native); + file_spec.SetFile(clang_path.c_str(), FileSpec::Style::native); + FileSystem::Instance().Resolve(file_spec); return true; } } else if (parent != r_end && *parent == "PrivateFrameworks" && @@ -98,7 +100,8 @@ raw_path.resize(parent - r_end); llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir); if (!verify || VerifyClangPath(clang_path)) { - file_spec.SetFile(clang_path.c_str(), true, FileSpec::Style::native); + file_spec.SetFile(clang_path.c_str(), FileSpec::Style::native); + FileSystem::Instance().Resolve(file_spec); return true; } raw_path = lldb_shlib_spec.GetPath(); @@ -110,7 +113,8 @@ // Fall back to the Clang resource directory inside the framework. raw_path.append("LLDB.framework/Resources/Clang"); - file_spec.SetFile(raw_path.c_str(), true, FileSpec::Style::native); + file_spec.SetFile(raw_path.c_str(), FileSpec::Style::native); + FileSystem::Instance().Resolve(file_spec); return true; } Index: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp =================================================================== --- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -315,7 +315,7 @@ char jit_name[64]; snprintf(jit_name, 64, "JIT(0x%" PRIx64 ")", symbolfile_addr); module_sp = m_process->ReadModuleFromMemory( - FileSpec(jit_name, false), symbolfile_addr, symbolfile_size); + FileSpec(jit_name), symbolfile_addr, symbolfile_size); if (module_sp && module_sp->GetObjectFile()) { // load the symbol table right away Index: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -483,8 +483,8 @@ // Limit the number of modules that are searched for these breakpoints for // Apple binaries. FileSpecList filter_modules; - filter_modules.Append(FileSpec("libc++abi.dylib", false)); - filter_modules.Append(FileSpec("libSystem.B.dylib", false)); + filter_modules.Append(FileSpec("libc++abi.dylib")); + filter_modules.Append(FileSpec("libSystem.B.dylib")); return target.GetSearchFilterForModuleList(&filter_modules); } else { return LanguageRuntime::CreateExceptionSearchFilter(); Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -455,7 +455,7 @@ if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) { FileSpecList filter_modules; - filter_modules.Append(FileSpec("libobjc.A.dylib", false)); + filter_modules.Append(FileSpec("libobjc.A.dylib")); return target.GetSearchFilterForModuleList(&filter_modules); } else { return LanguageRuntime::CreateExceptionSearchFilter(); Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2529,7 +2529,8 @@ "Allocation information not available"); // Check we can read from file - FileSpec file(path, true); + FileSpec file(path); + FileSystem::Instance().Resolve(file); if (!FileSystem::Instance().Exists(file)) { strm.Printf("Error: File %s does not exist", path); strm.EOL(); @@ -2753,7 +2754,8 @@ "Allocation information not available"); // Check we can create writable file - FileSpec file_spec(path, true); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); File file(file_spec, File::eOpenOptionWrite | File::eOpenOptionCanCreate | File::eOpenOptionTruncate); if (!file) { @@ -4651,7 +4653,8 @@ switch (short_option) { case 'f': - m_outfile.SetFile(option_arg, true, FileSpec::Style::native); + m_outfile.SetFile(option_arg, FileSpec::Style::native); + FileSystem::Instance().Resolve(m_outfile); if (FileSystem::Instance().Exists(m_outfile)) { m_outfile.Clear(); err.SetErrorStringWithFormat("file already exists: '%s'", Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -955,7 +955,7 @@ FileSpecList file_spec_list; if (!m_gnu_debuglink_file.empty()) { - FileSpec file_spec(m_gnu_debuglink_file, false); + FileSpec file_spec(m_gnu_debuglink_file); file_spec_list.Append(file_spec); } return file_spec_list; @@ -1109,7 +1109,9 @@ uint32_t str_index = static_cast(symbol.d_val); const char *lib_name = dynstr_data.PeekCStr(str_index); - m_filespec_ap->Append(FileSpec(lib_name, true)); + FileSpec file_spec(lib_name); + FileSystem::Instance().Resolve(file_spec); + m_filespec_ap->Append(file_spec); } } Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -2183,7 +2183,7 @@ uint32_t name_offset = cmd_offset + m_data.GetU32(&offset); const char *path = m_data.PeekCStr(name_offset); if (path) { - FileSpec file_spec(path, false); + FileSpec file_spec(path); // Strip the path if there is @rpath, @executable, etc so we just use // the basename if (path[0] == '@') @@ -4017,9 +4017,9 @@ // string in the DW_AT_comp_dir, and the second is the // directory for the source file so you end up with a path // that looks like "/tmp/src//tmp/src/" - FileSpec so_dir(so_path, false); + FileSpec so_dir(so_path); if (!FileSystem::Instance().Exists(so_dir)) { - so_dir.SetFile(&full_so_path[double_slash_pos + 1], false, + so_dir.SetFile(&full_so_path[double_slash_pos + 1], FileSpec::Style::native); if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path @@ -5084,9 +5084,6 @@ std::vector rpath_paths; std::vector rpath_relative_paths; std::vector at_exec_relative_paths; - const bool resolve_path = false; // Don't resolve the dependent file paths - // since they may not reside on this - // system uint32_t i; for (i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; @@ -5115,7 +5112,7 @@ at_exec_relative_paths.push_back(path + strlen("@executable_path")); } else { - FileSpec file_spec(path, resolve_path); + FileSpec file_spec(path); if (files.AppendIfUnique(file_spec)) count++; } @@ -5130,8 +5127,8 @@ } FileSpec this_file_spec(m_file); - this_file_spec.ResolvePath(); - + FileSystem::Instance().Resolve(this_file_spec); + if (!rpath_paths.empty()) { // Fixup all LC_RPATH values to be absolute paths std::string loader_path("@loader_path"); @@ -5152,7 +5149,8 @@ path += rpath_relative_path; // It is OK to resolve this path because we must find a file on disk // for us to accept it anyway if it is rpath relative. - FileSpec file_spec(path, true); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); if (FileSystem::Instance().Exists(file_spec) && files.AppendIfUnique(file_spec)) { count++; Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -193,7 +193,7 @@ if (IsHost() || !m_remote_platform_sp) return PlatformLinux::GetFile(source, destination); - FileSpec source_spec(source.GetPath(false), false, FileSpec::Style::posix); + FileSpec source_spec(source.GetPath(false), FileSpec::Style::posix); if (source_spec.IsRelative()) source_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( source_spec.GetCString(false)); @@ -237,8 +237,7 @@ if (IsHost() || !m_remote_platform_sp) return PlatformLinux::PutFile(source, destination, uid, gid); - FileSpec destination_spec(destination.GetPath(false), false, - FileSpec::Style::posix); + FileSpec destination_spec(destination.GetPath(false), FileSpec::Style::posix); if (destination_spec.IsRelative()) destination_spec = GetRemoteWorkingDirectory().CopyByAppendingPathComponent( destination_spec.GetCString(false)); @@ -343,7 +342,7 @@ log->Printf("Failed to remove temp directory: %s", error.AsCString()); }); - FileSpec symfile_platform_filespec(tmpdir, false); + FileSpec symfile_platform_filespec(tmpdir); symfile_platform_filespec.AppendPathComponent("symbolized.oat"); // Execute oatdump on the remote device to generate a file with symtab Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -229,9 +229,8 @@ cs_path.Printf( "%s/Library/PrivateFrameworks/CoreSimulator.framework/CoreSimulator", developer_dir); - const bool resolve_path = true; - m_core_simulator_framework_path = - FileSpec(cs_path.GetData(), resolve_path); + m_core_simulator_framework_path = FileSpec(cs_path.GetData()); + FileSystem::Instance().Resolve(*m_core_simulator_framework_path); } } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -251,7 +251,7 @@ EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) { if (ft == llvm::sys::fs::file_type::directory_file) { - FileSpec file_spec(path, false); + FileSpec file_spec(path); const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "AppleTVSimulator", strlen("AppleTVSimulator")) == @@ -316,12 +316,14 @@ platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true, FileSpec::Style::native); + local_file.SetFile(platform_file_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -251,7 +251,7 @@ EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) { if (ft == llvm::sys::fs::file_type::directory_file) { - FileSpec file_spec(path, false); + FileSpec file_spec(path); const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "AppleWatchSimulator", @@ -316,12 +316,14 @@ platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true, FileSpec::Style::native); + local_file.SetFile(platform_file_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -130,9 +130,10 @@ "%s/../Python/%s.py", symfile_spec.GetDirectory().GetCString(), original_module_basename.c_str()); - FileSpec script_fspec(path_string.GetString(), true); - FileSpec orig_script_fspec(original_path_string.GetString(), - true); + FileSpec script_fspec(path_string.GetString()); + FileSystem::Instance().Resolve(script_fspec); + FileSpec orig_script_fspec(original_path_string.GetString()); + FileSystem::Instance().Resolve(orig_script_fspec); // if we did some replacements of reserved characters, and a // file with the untampered name exists, then warn the user @@ -261,7 +262,7 @@ if (!cache_path.empty()) { std::string module_path(module_spec.GetFileSpec().GetPath()); cache_path.append(module_path); - FileSpec module_cache_spec(cache_path, false); + FileSpec module_cache_spec(cache_path); // if rsync is supported, always bring in the file - rsync will be very // efficient when files are the same on the local and remote end of the @@ -412,7 +413,7 @@ snprintf(new_path + search_path_len, sizeof(new_path) - search_path_len, "/%s", platform_path + bundle_directory_len); - FileSpec new_file_spec(new_path, false); + FileSpec new_file_spec(new_path); if (FileSystem::Instance().Exists(new_file_spec)) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = new_file_spec; @@ -1167,7 +1168,7 @@ if (xcode_select_prefix_dir) xcode_dir_path.append(xcode_select_prefix_dir); xcode_dir_path.append("/usr/share/xcode-select/xcode_dir_path"); - temp_file_spec.SetFile(xcode_dir_path, false, FileSpec::Style::native); + temp_file_spec.SetFile(xcode_dir_path, FileSpec::Style::native); auto dir_buffer = DataBufferLLVM::CreateFromPath(temp_file_spec.GetPath()); if (dir_buffer && dir_buffer->GetByteSize() > 0) { @@ -1183,7 +1184,7 @@ } if (!developer_dir_path_valid) { - FileSpec xcode_select_cmd("/usr/bin/xcode-select", false); + FileSpec xcode_select_cmd("/usr/bin/xcode-select"); if (FileSystem::Instance().Exists(xcode_select_cmd)) { int exit_status = -1; int signo = -1; @@ -1206,7 +1207,7 @@ } developer_dir_path[i] = '\0'; - FileSpec devel_dir(developer_dir_path, false); + FileSpec devel_dir(developer_dir_path); if (llvm::sys::fs::is_directory(devel_dir.GetPath())) { developer_dir_path_valid = true; } @@ -1215,8 +1216,7 @@ } if (developer_dir_path_valid) { - temp_file_spec.SetFile(developer_dir_path, false, - FileSpec::Style::native); + temp_file_spec.SetFile(developer_dir_path, FileSpec::Style::native); if (FileSystem::Instance().Exists(temp_file_spec)) { m_developer_directory.assign(developer_dir_path); return m_developer_directory.c_str(); @@ -1247,7 +1247,7 @@ FileSpecList bp_modules; for (size_t i = 0; i < llvm::array_lengthof(g_bp_modules); i++) { const char *bp_module = g_bp_modules[i]; - bp_modules.Append(FileSpec(bp_module, false)); + bp_modules.Append(FileSpec(bp_module)); } bool internal = true; @@ -1307,7 +1307,7 @@ size_t pos = path_to_shlib.rfind(substr); if (pos != std::string::npos) { path_to_shlib.erase(pos + strlen(substr)); - FileSpec ret(path_to_shlib, false); + FileSpec ret(path_to_shlib); FileSpec xcode_binary_path = ret; xcode_binary_path.AppendPathComponent("MacOS"); @@ -1348,8 +1348,9 @@ if (!g_xcode_filespec) { const char *developer_dir_env_var = getenv("DEVELOPER_DIR"); if (developer_dir_env_var && developer_dir_env_var[0]) { - g_xcode_filespec = - CheckPathForXcode(FileSpec(developer_dir_env_var, true)); + FileSpec developer_dir_spec = FileSpec(developer_dir_env_var); + FileSystem::Instance().Resolve(developer_dir_spec); + g_xcode_filespec = CheckPathForXcode(developer_dir_spec); } // Fall back to using "xcrun" to find the selected Xcode @@ -1373,7 +1374,7 @@ } output.append("/.."); - g_xcode_filespec = CheckPathForXcode(FileSpec(output, false)); + g_xcode_filespec = CheckPathForXcode(FileSpec(output)); } } } @@ -1421,7 +1422,7 @@ void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path) { SDKEnumeratorInfo *enumerator_info = static_cast(baton); - FileSpec spec(path, false); + FileSpec spec(path); if (SDKSupportsModules(enumerator_info->sdk_type, spec)) { enumerator_info->found_path = spec; return FileSystem::EnumerateDirectoryResult::eEnumerateDirectoryResultNext; Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -377,12 +377,15 @@ GetUserSpecifiedDirectoriesToSearch(); // Add simple directory /Applications/Xcode.app/Contents/Developer/../Symbols - FileSpec possible_dir(developer_dir + "/../Symbols", true); + FileSpec possible_dir(developer_dir + "/../Symbols"); + FileSystem::Instance().Resolve(possible_dir); if (llvm::sys::fs::is_directory(possible_dir.GetPath())) m_search_directories.push_back(possible_dir); // Add simple directory of the current working directory - m_search_directories_no_recursing.push_back(FileSpec(".", true)); + FileSpec cwd("."); + FileSystem::Instance().Resolve(cwd); + m_search_directories_no_recursing.push_back(cwd); } void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() { @@ -392,7 +395,7 @@ const uint32_t user_dirs_count = user_dirs.GetSize(); for (uint32_t i = 0; i < user_dirs_count; i++) { FileSpec dir = user_dirs.GetFileSpecAtIndex(i); - dir.ResolvePath(); + FileSystem::Instance().Resolve(dir); if (llvm::sys::fs::is_directory(dir.GetPath())) { m_search_directories.push_back(dir); } @@ -408,14 +411,14 @@ // /AppleInternal/Developer/KDKs/*.kdk/... nullptr}; for (int i = 0; subdirs[i] != nullptr; i++) { - FileSpec testdir(dir + subdirs[i], true); + FileSpec testdir(dir + subdirs[i]); + FileSystem::Instance().Resolve(testdir); if (llvm::sys::fs::is_directory(testdir.GetPath())) thisp->m_search_directories.push_back(testdir); } // Look for kernel binaries in the top level directory, without any recursion - thisp->m_search_directories_no_recursing.push_back( - FileSpec(dir + "/", false)); + thisp->m_search_directories_no_recursing.push_back(FileSpec(dir + "/")); } // Given a directory path dir, look for any subdirs named *.kdk and *.sdk @@ -437,7 +440,7 @@ static ConstString g_kdk_suffix = ConstString(".kdk"); PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton; - FileSpec file_spec(path, false); + FileSpec file_spec(path); if (ft == llvm::sys::fs::file_type::directory_file && (file_spec.GetFileNameExtension() == g_sdk_suffix || file_spec.GetFileNameExtension() == g_kdk_suffix)) { @@ -499,7 +502,7 @@ static ConstString g_dsym_suffix = ConstString(".dSYM"); static ConstString g_bundle_suffix = ConstString("Bundle"); - FileSpec file_spec(path, false); + FileSpec file_spec(path); ConstString file_spec_extension = file_spec.GetFileNameExtension(); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); @@ -537,12 +540,12 @@ file_spec_extension == g_kext_suffix) { AddKextToMap(thisp, file_spec); // Look to see if there is a PlugIns subdir with more kexts - FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns", false); + FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns"); std::string search_here_too; if (llvm::sys::fs::is_directory(contents_plugins.GetPath())) { search_here_too = contents_plugins.GetPath(); } else { - FileSpec plugins(file_spec.GetPath() + "/PlugIns", false); + FileSpec plugins(file_spec.GetPath() + "/PlugIns"); if (llvm::sys::fs::is_directory(plugins.GetPath())) { search_here_too = plugins.GetPath(); } @@ -628,7 +631,8 @@ kext_bundle_filepath.GetPath() + "/Contents/MacOS/"; deep_bundle_str += executable_name.AsCString(); deep_bundle_str += ".dSYM"; - dsym_fspec.SetFile(deep_bundle_str, true, FileSpec::Style::native); + dsym_fspec.SetFile(deep_bundle_str, FileSpec::Style::native); + FileSystem::Instance().Resolve(dsym_fspec); if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { return true; } @@ -638,7 +642,8 @@ std::string shallow_bundle_str = kext_bundle_filepath.GetPath() + "/"; shallow_bundle_str += executable_name.AsCString(); shallow_bundle_str += ".dSYM"; - dsym_fspec.SetFile(shallow_bundle_str, true, FileSpec::Style::native); + dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native); + FileSystem::Instance().Resolve(dsym_fspec); if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { return true; } @@ -796,7 +801,7 @@ break; if (llvm::sys::fs::is_regular_file(*status) && llvm::sys::fs::can_execute(it->path())) - executables.emplace_back(it->path(), false); + executables.emplace_back(it->path()); } return executables; } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -218,13 +218,13 @@ "SDKs/MacOSX%u.%u.sdk", xcode_contents_path.c_str(), versions[0], versions[1]); - fspec.SetFile(sdk_path.GetString(), false, FileSpec::Style::native); + fspec.SetFile(sdk_path.GetString(), FileSpec::Style::native); if (FileSystem::Instance().Exists(fspec)) return ConstString(sdk_path.GetString()); } if (!default_xcode_sdk.empty()) { - fspec.SetFile(default_xcode_sdk, false, FileSpec::Style::native); + fspec.SetFile(default_xcode_sdk, FileSpec::Style::native); if (FileSystem::Instance().Exists(fspec)) return ConstString(default_xcode_sdk); } @@ -268,7 +268,7 @@ std::string cache_path(GetLocalCacheDirectory()); std::string module_path(platform_file.GetPath()); cache_path.append(module_path); - FileSpec module_cache_spec(cache_path, false); + FileSpec module_cache_spec(cache_path); if (FileSystem::Instance().Exists(module_cache_spec)) { local_file = module_cache_spec; return Status(); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -144,8 +144,7 @@ PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback( void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) { ((PlatformRemoteDarwinDevice::SDKDirectoryInfoCollection *)baton) - ->push_back( - PlatformRemoteDarwinDevice::SDKDirectoryInfo(FileSpec(path, false))); + ->push_back(PlatformRemoteDarwinDevice::SDKDirectoryInfo(FileSpec(path))); return FileSystem::eEnumerateDirectoryResultNext; } @@ -155,7 +154,8 @@ if (m_sdk_directory_infos.empty()) { // A --sysroot option was supplied - add it to our list of SDKs to check if (m_sdk_sysroot) { - FileSpec sdk_sysroot_fspec(m_sdk_sysroot.GetCString(), true); + FileSpec sdk_sysroot_fspec(m_sdk_sysroot.GetCString()); + FileSystem::Instance().Resolve(sdk_sysroot_fspec); const SDKDirectoryInfo sdk_sysroot_directory_info(sdk_sysroot_fspec); m_sdk_directory_infos.push_back(sdk_sysroot_directory_info); if (log) { @@ -207,7 +207,8 @@ const uint32_t num_installed = m_sdk_directory_infos.size(); std::string local_sdk_cache_str = "~/Library/Developer/Xcode/"; local_sdk_cache_str += dirname; - FileSpec local_sdk_cache(local_sdk_cache_str.c_str(), true); + FileSpec local_sdk_cache(local_sdk_cache_str.c_str()); + FileSystem::Instance().Resolve(local_sdk_cache); if (FileSystem::Instance().Exists(local_sdk_cache)) { if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " @@ -420,11 +421,11 @@ const char *paths_to_try[] = {"Symbols", "", "Symbols.Internal", nullptr}; for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - local_file.SetFile(sdkroot_path, false, FileSpec::Style::native); + local_file.SetFile(sdkroot_path, FileSpec::Style::native); if (paths_to_try[i][0] != '\0') local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); - local_file.ResolvePath(); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) { if (log) log->Printf("Found a copy of %s in the SDK dir %s/%s", @@ -453,7 +454,8 @@ ::snprintf(resolved_path, sizeof(resolved_path), "%s/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s", @@ -465,7 +467,8 @@ ::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols.Internal/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf( @@ -477,7 +480,8 @@ ::snprintf(resolved_path, sizeof(resolved_path), "%s/Symbols/%s", os_version_dir, platform_file_path); - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols", Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -257,7 +257,7 @@ EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) { if (ft == llvm::sys::fs::file_type::directory_file) { - FileSpec file_spec(path, false); + FileSpec file_spec(path); const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "iPhoneSimulator", strlen("iPhoneSimulator")) == 0) { @@ -321,12 +321,14 @@ platform_file_path); // First try in the SDK and see if the file is in there - local_file.SetFile(resolved_path, true, FileSpec::Style::native); + local_file.SetFile(resolved_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself - local_file.SetFile(platform_file_path, true, FileSpec::Style::native); + local_file.SetFile(platform_file_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(local_file); if (FileSystem::Instance().Exists(local_file)) return error; } Index: lldb/trunk/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ lldb/trunk/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -409,7 +409,7 @@ // Check in case our file action open wants to open the slave const char *slave_path = launch_info.GetPTY().GetSlaveName(NULL, 0); if (slave_path) { - FileSpec slave_spec(slave_path, false); + FileSpec slave_spec(slave_path); if (file_spec == slave_spec) { int slave_fd = launch_info.GetPTY().GetSlaveFileDescriptor(); if (slave_fd == PseudoTerminal::invalid_fd) Index: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -130,8 +130,9 @@ // on the current path variables if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); - resolved_module_spec.GetFileSpec().SetFile(exe_path, true, + resolved_module_spec.GetFileSpec().SetFile(exe_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(resolved_module_spec.GetFileSpec()); } if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) @@ -1284,8 +1285,7 @@ std::string name_string; process->ReadCStringFromMemory(buffer_addr, name_string, utility_error); if (utility_error.Success()) - loaded_image->SetFile(name_string, false, - llvm::sys::path::Style::posix); + loaded_image->SetFile(name_string, llvm::sys::path::Style::posix); } return process->AddImageToken(token); } Index: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -194,8 +194,9 @@ // variables if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); - resolved_module_spec.GetFileSpec().SetFile(exe_path, true, + resolved_module_spec.GetFileSpec().SetFile(exe_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(resolved_module_spec.GetFileSpec()); } if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -391,8 +391,7 @@ FileSpec stdout_file_spec{}; FileSpec stderr_file_spec{}; - const FileSpec dbg_pts_file_spec{launch_info.GetPTY().GetSlaveName(NULL, 0), - false}; + const FileSpec dbg_pts_file_spec{launch_info.GetPTY().GetSlaveName(NULL, 0)}; file_action = launch_info.GetFileActionForFD(STDIN_FILENO); stdin_file_spec = Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1418,8 +1418,9 @@ m_supports_mem_region = LazyBool::eLazyBoolNo; return parse_error; } - m_mem_region_cache.emplace_back( - info, FileSpec(info.GetName().GetCString(), true)); + FileSpec file_spec(info.GetName().GetCString()); + FileSystem::Instance().Resolve(file_spec); + m_mem_region_cache.emplace_back(info, file_spec); } if (m_mem_region_cache.empty()) { @@ -1723,7 +1724,8 @@ if (error.Fail()) return error; - FileSpec module_file_spec(module_path, true); + FileSpec module_file_spec(module_path); + FileSystem::Instance().Resolve(module_file_spec); file_spec.Clear(); for (const auto &it : m_mem_region_cache) { @@ -1743,7 +1745,7 @@ if (error.Fail()) return error; - FileSpec file(file_name, false); + FileSpec file(file_name); for (const auto &it : m_mem_region_cache) { if (it.second == file) { load_addr = it.first.GetRange().GetRangeBase(); Index: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -249,8 +249,7 @@ ModuleSpec exe_module_spec; exe_module_spec.GetArchitecture() = arch; exe_module_spec.GetFileSpec().SetFile( - m_nt_file_entries[0].path.GetCString(), false, - FileSpec::Style::native); + m_nt_file_entries[0].path.GetCString(), FileSpec::Style::native); if (exe_module_spec.GetFileSpec()) { exe_module_sp = GetTarget().GetSharedModule(exe_module_spec); if (exe_module_sp) Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -998,7 +998,7 @@ // debugserver to use and use it if we do. const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH"); if (env_debugserver_path) { - debugserver_file_spec.SetFile(env_debugserver_path, false, + debugserver_file_spec.SetFile(env_debugserver_path, FileSpec::Style::native); if (log) log->Printf("GDBRemoteCommunication::%s() gdb-remote stub exe path set " Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1818,7 +1818,7 @@ return false; std::string cwd; response.GetHexByteString(cwd); - working_dir.SetFile(cwd, false, GetHostArchitecture().GetTriple()); + working_dir.SetFile(cwd, GetHostArchitecture().GetTriple()); return !cwd.empty(); } return false; @@ -1928,8 +1928,7 @@ // characters in a process name std::string name; extractor.GetHexByteString(name); - process_info.GetExecutableFile().SetFile(name, false, - FileSpec::Style::native); + process_info.GetExecutableFile().SetFile(name, FileSpec::Style::native); } else if (name.equals("cputype")) { value.getAsInteger(0, cpu); } else if (name.equals("cpusubtype")) { @@ -3562,7 +3561,7 @@ StringExtractor extractor(value); std::string path; extractor.GetHexByteString(path); - module_spec.GetFileSpec() = FileSpec(path, false, arch_spec.GetTriple()); + module_spec.GetFileSpec() = FileSpec(path, arch_spec.GetTriple()); } } @@ -3598,8 +3597,7 @@ if (!dict->GetValueForKeyAsString("file_path", string)) return llvm::None; - result.GetFileSpec() = - FileSpec(string, false, result.GetArchitecture().GetTriple()); + result.GetFileSpec() = FileSpec(string, result.GetArchitecture().GetTriple()); return result; } Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -353,7 +353,7 @@ std::string file; extractor.GetHexByteString(file); match_info.GetProcessInfo().GetExecutableFile().SetFile( - file, false, FileSpec::Style::native); + file, FileSpec::Style::native); } else if (key.equals("name_match")) { NameMatch name_match = llvm::StringSwitch(value) .Case("equals", NameMatch::Equals) @@ -520,7 +520,8 @@ if (packet.GetChar() == ',') { mode_t mode = packet.GetHexMaxU32(false, 0600); Status error; - const FileSpec path_spec{path, true}; + FileSpec path_spec(path); + FileSystem::Instance().Resolve(path_spec); int fd = ::open(path_spec.GetCString(), flags, mode); const int save_errno = fd == -1 ? errno : 0; StreamString response; @@ -660,7 +661,9 @@ packet.GetHexByteString(path); if (!path.empty()) { Status error; - const uint32_t mode = File::GetPermissions(FileSpec{path, true}, error); + FileSpec file_spec(path); + FileSystem::Instance().Resolve(file_spec); + const uint32_t mode = File::GetPermissions(file_spec, error); StreamString response; response.Printf("F%u", mode); if (mode == 0 || error.Fail()) @@ -698,7 +701,11 @@ packet.GetHexByteStringTerminatedBy(dst, ','); packet.GetChar(); // Skip ',' char packet.GetHexByteString(src); - Status error = FileSystem::Instance().Symlink(FileSpec{src, true}, FileSpec{dst, false}); + + FileSpec src_spec(src); + FileSystem::Instance().Resolve(src_spec); + Status error = FileSystem::Instance().Symlink(src_spec, FileSpec(dst)); + StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetString()); @@ -731,9 +738,11 @@ packet.GetHexByteString(working_dir); int status, signo; std::string output; - Status err = Host::RunShellCommand( - path.c_str(), FileSpec{working_dir, true}, &status, &signo, &output, - std::chrono::seconds(10)); + FileSpec working_spec(working_dir); + FileSystem::Instance().Resolve(working_spec); + Status err = + Host::RunShellCommand(path.c_str(), working_spec, &status, &signo, + &output, std::chrono::seconds(10)); StreamGDBRemote response; if (err.Fail()) { response.PutCString("F,"); @@ -884,7 +893,7 @@ packet.GetHexByteString(path); const bool read = true; const bool write = false; - if (file_action.Open(STDIN_FILENO, FileSpec{path, false}, read, write)) { + if (file_action.Open(STDIN_FILENO, FileSpec(path), read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse(); } @@ -900,7 +909,7 @@ packet.GetHexByteString(path); const bool read = false; const bool write = true; - if (file_action.Open(STDOUT_FILENO, FileSpec{path, false}, read, write)) { + if (file_action.Open(STDOUT_FILENO, FileSpec(path), read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse(); } @@ -916,7 +925,7 @@ packet.GetHexByteString(path); const bool read = false; const bool write = true; - if (file_action.Open(STDERR_FILENO, FileSpec{path, false}, read, write)) { + if (file_action.Open(STDERR_FILENO, FileSpec(path), read, write)) { m_process_launch_info.AppendFileAction(file_action); return SendOKResponse(); } @@ -1024,7 +1033,7 @@ if (success) { if (arg_idx == 0) m_process_launch_info.GetExecutableFile().SetFile( - arg, false, FileSpec::Style::native); + arg, FileSpec::Style::native); m_process_launch_info.GetArguments().AppendArgument(arg); if (log) log->Printf("LLGSPacketHandler::%s added arg %d: \"%s\"", @@ -1263,7 +1272,9 @@ #ifdef __ANDROID__ return HostInfoAndroid::ResolveLibraryPath(module_path, arch); #else - return FileSpec(module_path, true); + FileSpec file_spec(module_path); + FileSystem::Instance().Resolve(file_spec); + return file_spec; #endif } @@ -1272,7 +1283,9 @@ llvm::StringRef triple) { ArchSpec arch(triple); - const FileSpec req_module_path_spec(module_path, true); + FileSpec req_module_path_spec(module_path); + FileSystem::Instance().Resolve(req_module_path_spec); + const FileSpec module_path_spec = FindModuleFile(req_module_path_spec.GetPath(), arch); const ModuleSpec module_spec(module_path_spec, arch); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -1333,7 +1333,7 @@ packet.SetFilePos(::strlen("QSetWorkingDir:")); std::string path; packet.GetHexByteString(path); - m_process_launch_info.SetWorkingDirectory(FileSpec{path, true}); + m_process_launch_info.SetWorkingDirectory(FileSpec(path)); return SendOKResponse(); } Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -532,7 +532,7 @@ const char *domainsocket_dir_env = ::getenv("LLDB_DEBUGSERVER_DOMAINSOCKET_DIR"); if (domainsocket_dir_env != nullptr) - g_domainsocket_dir = FileSpec(domainsocket_dir_env, false); + g_domainsocket_dir = FileSpec(domainsocket_dir_env); else g_domainsocket_dir = HostInfo::GetProcessTempDir(); }); @@ -550,7 +550,7 @@ socket_path_spec.AppendPathComponent(socket_name.c_str()); llvm::sys::fs::createUniqueFile(socket_path_spec.GetCString(), socket_path); - return FileSpec(socket_path.c_str(), false); + return FileSpec(socket_path.c_str()); } void GDBRemoteCommunicationServerPlatform::SetPortOffset(uint16_t port_offset) { Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -442,7 +442,7 @@ if (!FileSystem::Instance().Exists(target_definition_fspec)) { // If the filename doesn't exist, it may be a ~ not having been expanded - // try to resolve it. - target_definition_fspec.ResolvePath(); + FileSystem::Instance().Resolve(target_definition_fspec); } if (target_definition_fspec) { // See if we can get register definitions from a python file @@ -825,13 +825,13 @@ if (disable_stdio) { // set to /dev/null unless redirected to a file above if (!stdin_file_spec) - stdin_file_spec.SetFile(FileSystem::DEV_NULL, false, + stdin_file_spec.SetFile(FileSystem::DEV_NULL, FileSpec::Style::native); if (!stdout_file_spec) - stdout_file_spec.SetFile(FileSystem::DEV_NULL, false, + stdout_file_spec.SetFile(FileSystem::DEV_NULL, FileSpec::Style::native); if (!stderr_file_spec) - stderr_file_spec.SetFile(FileSystem::DEV_NULL, false, + stderr_file_spec.SetFile(FileSystem::DEV_NULL, FileSpec::Style::native); } else if (platform_sp && platform_sp->IsHost()) { // If the debugserver is local and we aren't disabling STDIO, lets use @@ -840,7 +840,7 @@ // does a lot of output. if ((!stdin_file_spec || !stdout_file_spec || !stderr_file_spec) && pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY, NULL, 0)) { - FileSpec slave_name{pty.GetSlaveName(NULL, 0), false}; + FileSpec slave_name{pty.GetSlaveName(NULL, 0)}; if (!stdin_file_spec) stdin_file_spec = slave_name; @@ -4768,7 +4768,8 @@ if (!modInfo.get_link_map(link_map)) link_map = LLDB_INVALID_ADDRESS; - FileSpec file(mod_name, true); + FileSpec file(mod_name); + FileSystem::Instance().Resolve(file); lldb::ModuleSP module_sp = LoadModuleAtAddress(file, link_map, mod_base, mod_base_is_offset); Index: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -346,8 +346,8 @@ } const auto uuid = m_minidump_parser.GetModuleUUID(module); - const auto file_spec = - FileSpec(name.getValue(), true, GetArchitecture().GetTriple()); + auto file_spec = FileSpec(name.getValue(), GetArchitecture().GetTriple()); + FileSystem::Instance().Resolve(file_spec); ModuleSpec module_spec(file_spec, uuid); Status error; lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error); Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -2749,7 +2749,8 @@ lldb::DebuggerSP debugger_sp = m_interpreter.GetDebugger().shared_from_this(); { - FileSpec target_file(pathname, true); + FileSpec target_file(pathname); + FileSystem::Instance().Resolve(target_file); std::string basename(target_file.GetFilename().GetCString()); StreamString command_stream; Index: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp =================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -1677,7 +1677,7 @@ // Build up the module list. FileSpecList module_spec_list; auto module_file_spec = - FileSpec(GetGlobalProperties()->GetLoggingModuleName(), false); + FileSpec(GetGlobalProperties()->GetLoggingModuleName()); module_spec_list.Append(module_file_spec); // We aren't specifying a source file set. Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -547,7 +547,7 @@ for (uint32_t file_idx = 1; prologue.GetFile(file_idx, cu_comp_dir, file_spec); ++file_idx) { if (module_sp->RemapSourceFile(file_spec.GetPath(), remapped_file)) - file_spec.SetFile(remapped_file, false, FileSpec::Style::native); + file_spec.SetFile(remapped_file, FileSpec::Style::native); support_files.Append(file_spec); } return true; @@ -950,7 +950,7 @@ const lldb_private::FileSpec &comp_dir, FileSpec &file) const { uint32_t idx = file_idx - 1; // File indexes are 1 based... if (idx < file_names.size()) { - file.SetFile(file_names[idx].name, false, FileSpec::Style::native); + file.SetFile(file_names[idx].name, FileSpec::Style::native); if (file.IsRelative()) { if (file_names[idx].dir_idx > 0) { const uint32_t dir_idx = file_names[idx].dir_idx - 1; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -197,7 +197,7 @@ bool is_symlink = false; // Always normalize our compile unit directory to get rid of redundant // slashes and other path anomalies before we use it for path prepending - FileSpec local_spec(local_path, false); + FileSpec local_spec(local_path); const auto &file_specs = GetGlobalPluginProperties()->GetSymLinkPaths(); for (size_t i = 0; i < file_specs.GetSize() && !is_symlink; ++i) is_symlink = FileSpec::Equal(file_specs.GetFileSpecAtIndex(i), @@ -811,7 +811,7 @@ if (module_sp) { const DWARFDIE cu_die = dwarf_cu->DIE(); if (cu_die) { - FileSpec cu_file_spec{cu_die.GetName(), false}; + FileSpec cu_file_spec(cu_die.GetName()); if (cu_file_spec) { // If we have a full path to the compile unit, we don't need to // resolve the file. This can be expensive e.g. when the source @@ -826,8 +826,7 @@ std::string remapped_file; if (module_sp->RemapSourceFile(cu_file_spec.GetPath(), remapped_file)) - cu_file_spec.SetFile(remapped_file, false, - FileSpec::Style::native); + cu_file_spec.SetFile(remapped_file, FileSpec::Style::native); } LanguageType cu_language = DWARFUnit::LanguageTypeFromDWARF( @@ -1629,14 +1628,16 @@ return dwo_symfile; } - FileSpec dwo_file(dwo_name, true); + FileSpec dwo_file(dwo_name); + FileSystem::Instance().Resolve(dwo_file); if (dwo_file.IsRelative()) { const char *comp_dir = cu_die.GetAttributeValueAsString( this, &dwarf_cu, DW_AT_comp_dir, nullptr); if (!comp_dir) return nullptr; - dwo_file.SetFile(comp_dir, true, FileSpec::Style::native); + dwo_file.SetFile(comp_dir, FileSpec::Style::native); + FileSystem::Instance().Resolve(dwo_file); dwo_file.AppendPathComponent(dwo_name); } @@ -1680,14 +1681,15 @@ die.GetAttributeValueAsString(DW_AT_GNU_dwo_name, nullptr); if (dwo_path) { ModuleSpec dwo_module_spec; - dwo_module_spec.GetFileSpec().SetFile(dwo_path, false, + dwo_module_spec.GetFileSpec().SetFile(dwo_path, FileSpec::Style::native); if (dwo_module_spec.GetFileSpec().IsRelative()) { const char *comp_dir = die.GetAttributeValueAsString(DW_AT_comp_dir, nullptr); if (comp_dir) { - dwo_module_spec.GetFileSpec().SetFile(comp_dir, true, + dwo_module_spec.GetFileSpec().SetFile(comp_dir, FileSpec::Style::native); + FileSystem::Instance().Resolve(dwo_module_spec.GetFileSpec()); dwo_module_spec.GetFileSpec().AppendPathComponent(dwo_path); } } @@ -3877,7 +3879,7 @@ ModuleSpec module_spec; module_spec.GetFileSpec() = m_obj_file->GetFileSpec(); module_spec.GetSymbolFileSpec() = - FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); + FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp"); FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); if (FileSystem::Instance().Exists(dwp_filespec)) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -351,7 +351,7 @@ so_symbol->GetType() == eSymbolTypeSourceFile && oso_symbol->GetType() == eSymbolTypeObjectFile) { m_compile_unit_infos[i].so_file.SetFile( - so_symbol->GetName().AsCString(), false, FileSpec::Style::native); + so_symbol->GetName().AsCString(), FileSpec::Style::native); m_compile_unit_infos[i].oso_path = oso_symbol->GetName(); m_compile_unit_infos[i].oso_mod_time = llvm::sys::toTimePoint(oso_symbol->GetIntegerValue(0)); @@ -421,7 +421,7 @@ m_oso_map[{comp_unit_info->oso_path, comp_unit_info->oso_mod_time}] = comp_unit_info->oso_sp; const char *oso_path = comp_unit_info->oso_path.GetCString(); - FileSpec oso_file(oso_path, false); + FileSpec oso_file(oso_path); ConstString oso_object; if (FileSystem::Instance().Exists(oso_file)) { auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file); Index: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -594,7 +594,7 @@ llvm::StringRef source_file_name = m_index->compilands().GetMainSourceFile(cci); - FileSpec fs(source_file_name, false); + FileSpec fs(source_file_name); CompUnitSP cu_sp = std::make_shared(m_obj_file->GetModule(), nullptr, fs, @@ -1373,7 +1373,7 @@ for (llvm::StringRef f : cci->m_file_list) { FileSpec::Style style = f.startswith("/") ? FileSpec::Style::posix : FileSpec::Style::windows; - FileSpec spec(f, false, style); + FileSpec spec(f, style); support_files.Append(spec); } Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -200,7 +200,7 @@ if (!src_file_up) return false; - FileSpec spec(src_file_up->getFileName(), /*resolve_path*/ false); + FileSpec spec(src_file_up->getFileName()); decl.SetFile(spec); decl.SetColumn(first_line_up->getColumnNumber()); decl.SetLine(first_line_up->getLineNumber()); Index: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -363,7 +363,7 @@ return false; while (auto file = files->getNext()) { - FileSpec spec(file->getFileName(), false, FileSpec::Style::windows); + FileSpec spec(file->getFileName(), FileSpec::Style::windows); support_files.AppendIfUnique(spec); } @@ -768,7 +768,7 @@ std::string source_file = compiland->getSourceFileFullPath(); if (source_file.empty()) continue; - FileSpec this_spec(source_file, false, FileSpec::Style::windows); + FileSpec this_spec(source_file, FileSpec::Style::windows); bool need_full_match = !file_spec.GetDirectory().IsEmpty(); if (FileSpec::Compare(file_spec, this_spec, need_full_match) != 0) continue; @@ -929,7 +929,7 @@ uint32_t src_file_id = first_line->getSourceFileId(); auto src_file = m_session_up->getSourceFileById(src_file_id); if (src_file) { - FileSpec spec(src_file->getFileName(), /*resolve_path*/ false); + FileSpec spec(src_file->getFileName()); decl.SetFile(spec); decl.SetColumn(first_line->getColumnNumber()); decl.SetLine(first_line->getLineNumber()); Index: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -101,7 +101,7 @@ const FileSpec fspec = file_spec_list.GetFileSpecAtIndex(idx); module_spec.GetFileSpec() = obj_file->GetFileSpec(); - module_spec.GetFileSpec().ResolvePath(); + FileSystem::Instance().Resolve(module_spec.GetFileSpec()); module_spec.GetSymbolFileSpec() = fspec; module_spec.GetUUID() = uuid; FileSpec dsym_fspec = Symbols::LocateExecutableSymbolFile(module_spec); Index: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -173,7 +173,7 @@ resources[strlen("/Contents/Resources/")] = '\0'; snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_str.c_str()); - FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false); + FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path); if (FileSystem::Instance().Exists(dsym_uuid_plist_spec)) { ApplePropertyList plist(dsym_uuid_plist_path); if (plist) { @@ -244,7 +244,9 @@ } if (DBGSourcePath[0] == '~') { FileSpec resolved_source_path( - DBGSourcePath.c_str(), true); + DBGSourcePath.c_str()); + FileSystem::Instance().Resolve( + resolved_source_path); DBGSourcePath = resolved_source_path.GetPath(); } @@ -257,8 +259,8 @@ // Add this as another option in addition to // the full source path remap. if (do_truncate_remapping_names) { - FileSpec build_path(key.AsCString(), false); - FileSpec source_path(DBGSourcePath.c_str(), false); + FileSpec build_path(key.AsCString()); + FileSpec source_path(DBGSourcePath.c_str()); build_path.RemoveLastPathComponent(); build_path.RemoveLastPathComponent(); source_path.RemoveLastPathComponent(); @@ -281,8 +283,8 @@ if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) { if (DBGSourcePath[0] == '~') { - FileSpec resolved_source_path(DBGSourcePath.c_str(), - true); + FileSpec resolved_source_path(DBGSourcePath.c_str()); + FileSystem::Instance().Resolve(resolved_source_path); DBGSourcePath = resolved_source_path.GetPath(); } module_sp->GetSourceMappingList().Append( Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -277,7 +277,7 @@ // libdispatch symbols were in libSystem.B.dylib up through Mac OS X 10.6 // ("Snow Leopard") - ModuleSpec libSystem_module_spec(FileSpec("libSystem.B.dylib", false)); + ModuleSpec libSystem_module_spec(FileSpec("libSystem.B.dylib")); ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule( libSystem_module_spec)); if (module_sp) @@ -287,7 +287,7 @@ // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") // and later if (dispatch_queue_offsets_symbol == NULL) { - ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib", false)); + ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib")); module_sp = m_process->GetTarget().GetImages().FindFirstModule( libdispatch_module_spec); if (module_sp) @@ -331,7 +331,7 @@ "pthread_layout_offsets"); const Symbol *libpthread_layout_offsets_symbol = NULL; - ModuleSpec libpthread_module_spec(FileSpec("libsystem_pthread.dylib", false)); + ModuleSpec libpthread_module_spec(FileSpec("libsystem_pthread.dylib")); ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule( libpthread_module_spec)); if (module_sp) { @@ -379,7 +379,7 @@ "dispatch_tsd_indexes"); const Symbol *libdispatch_tsd_indexes_symbol = NULL; - ModuleSpec libpthread_module_spec(FileSpec("libdispatch.dylib", false)); + ModuleSpec libpthread_module_spec(FileSpec("libdispatch.dylib")); ModuleSP module_sp(m_process->GetTarget().GetImages().FindFirstModule( libpthread_module_spec)); if (module_sp) { Index: lldb/trunk/source/Symbol/CompileUnit.cpp =================================================================== --- lldb/trunk/source/Symbol/CompileUnit.cpp +++ lldb/trunk/source/Symbol/CompileUnit.cpp @@ -21,7 +21,7 @@ const char *pathname, const lldb::user_id_t cu_sym_id, lldb::LanguageType language, lldb_private::LazyBool is_optimized) - : ModuleChild(module_sp), FileSpec(pathname, false), UserID(cu_sym_id), + : ModuleChild(module_sp), FileSpec(pathname), UserID(cu_sym_id), m_user_data(user_data), m_language(language), m_flags(0), m_support_files(), m_line_table_ap(), m_variables(), m_is_optimized(is_optimized) { Index: lldb/trunk/source/Symbol/ObjectFile.cpp =================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp +++ lldb/trunk/source/Symbol/ObjectFile.cpp @@ -582,7 +582,7 @@ std::string obj; if (regex_match.GetMatchAtIndex(path_with_object, 1, path) && regex_match.GetMatchAtIndex(path_with_object, 2, obj)) { - archive_file.SetFile(path, false, FileSpec::Style::native); + archive_file.SetFile(path, FileSpec::Style::native); archive_object.SetCString(obj.c_str()); if (must_exist && !FileSystem::Instance().Exists(archive_file)) return false; Index: lldb/trunk/source/Symbol/Symbol.cpp =================================================================== --- lldb/trunk/source/Symbol/Symbol.cpp +++ lldb/trunk/source/Symbol/Symbol.cpp @@ -141,7 +141,7 @@ // back into a string that is the re-exported name. intptr_t str_ptr = m_addr_range.GetByteSize(); if (str_ptr != 0) - return FileSpec((const char *)str_ptr, false); + return FileSpec((const char *)str_ptr); } return FileSpec(); } Index: lldb/trunk/source/Symbol/SymbolContext.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp +++ lldb/trunk/source/Symbol/SymbolContext.cpp @@ -999,7 +999,7 @@ break; case eModuleSpecified: { // See if we can find the Module, if so stick it in the SymbolContext. - FileSpec module_file_spec(spec_string, false); + FileSpec module_file_spec(spec_string); ModuleSpec module_spec(module_file_spec); lldb::ModuleSP module_sp( m_target_sp->GetImages().FindFirstModule(module_spec)); @@ -1013,7 +1013,7 @@ // CompUnits can't necessarily be resolved here, since an inlined function // might show up in a number of CompUnits. Instead we just convert to a // FileSpec and store it away. - m_file_spec_ap.reset(new FileSpec(spec_string, false)); + m_file_spec_ap.reset(new FileSpec(spec_string)); m_type |= eFileSpecified; break; case eLineStartSpecified: @@ -1068,7 +1068,7 @@ if (m_module_sp.get() != sc.module_sp.get()) return false; } else { - FileSpec module_file_spec(m_module_spec, false); + FileSpec module_file_spec(m_module_spec); if (!FileSpec::Equal(module_file_spec, sc.module_sp->GetFileSpec(), false)) return false; Index: lldb/trunk/source/Target/ModuleCache.cpp =================================================================== --- lldb/trunk/source/Target/ModuleCache.cpp +++ lldb/trunk/source/Target/ModuleCache.cpp @@ -76,7 +76,7 @@ } FileSpec GetSymbolFileSpec(const FileSpec &module_file_spec) { - return FileSpec(module_file_spec.GetPath() + kSymFileExtension, false); + return FileSpec(module_file_spec.GetPath() + kSymFileExtension); } void DeleteExistingModule(const FileSpec &root_dir_spec, @@ -141,7 +141,7 @@ } const auto error = MakeDirectory( - FileSpec(sysroot_module_path_spec.GetDirectory().AsCString(), false)); + FileSpec(sysroot_module_path_spec.GetDirectory().AsCString())); if (error.Fail()) return error; Index: lldb/trunk/source/Target/PathMappingList.cpp =================================================================== --- lldb/trunk/source/Target/PathMappingList.cpp +++ lldb/trunk/source/Target/PathMappingList.cpp @@ -38,7 +38,7 @@ ConstString NormalizePath(const ConstString &path) { // If we use "path" to construct a FileSpec, it will normalize the path for // us. We then grab the string and turn it back into a ConstString. - return ConstString(FileSpec(path.GetStringRef(), false).GetPath()); + return ConstString(FileSpec(path.GetStringRef()).GetPath()); } } //---------------------------------------------------------------------- @@ -177,13 +177,13 @@ // We need to figure out if the "path" argument is relative. If it is, // then we should remap, else skip this entry. if (path_is_relative == eLazyBoolCalculate) { - path_is_relative = FileSpec(path, false).IsRelative() ? eLazyBoolYes : - eLazyBoolNo; + path_is_relative = + FileSpec(path).IsRelative() ? eLazyBoolYes : eLazyBoolNo; } if (!path_is_relative) continue; } - FileSpec remapped(it.second.GetStringRef(), false); + FileSpec remapped(it.second.GetStringRef()); remapped.AppendPathComponent(path); new_path = remapped.GetPath(); return true; @@ -197,7 +197,7 @@ for (const auto &it : m_pairs) { if (!path_ref.consume_front(it.second.GetStringRef())) continue; - fixed.SetFile(it.first.GetStringRef(), false, FileSpec::Style::native); + fixed.SetFile(it.first.GetStringRef(), FileSpec::Style::native); fixed.AppendPathComponent(path_ref); return true; } @@ -217,8 +217,7 @@ if (orig_path_len >= prefix_len) { if (::strncmp(pos->first.GetCString(), orig_path, prefix_len) == 0) { - new_spec.SetFile(pos->second.GetCString(), false, - FileSpec::Style::native); + new_spec.SetFile(pos->second.GetCString(), FileSpec::Style::native); new_spec.AppendPathComponent(orig_path + prefix_len); if (FileSystem::Instance().Exists(new_spec)) return true; Index: lldb/trunk/source/Target/Platform.cpp =================================================================== --- lldb/trunk/source/Target/Platform.cpp +++ lldb/trunk/source/Target/Platform.cpp @@ -94,7 +94,7 @@ if (!llvm::sys::path::home_directory(user_home_dir)) return; - module_cache_dir = FileSpec(user_home_dir.c_str(), false); + module_cache_dir = FileSpec(user_home_dir.c_str()); module_cache_dir.AppendPathComponent(".lldb"); module_cache_dir.AppendPathComponent("module_cache"); SetModuleCacheDirectory(module_cache_dir); @@ -536,9 +536,12 @@ if (IsHost()) { llvm::SmallString<64> cwd; if (llvm::sys::fs::current_path(cwd)) - return FileSpec{}; - else - return FileSpec(cwd, true); + return {}; + else { + FileSpec file_spec(cwd); + FileSystem::Instance().Resolve(file_spec); + return file_spec; + } } else { if (!m_working_dir) m_working_dir = GetRemoteWorkingDirectory(); @@ -556,7 +559,7 @@ RecurseCopy_Callback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) { RecurseCopyBaton *rc_baton = (RecurseCopyBaton *)baton; - FileSpec src(path, false); + FileSpec src(path); namespace fs = llvm::sys::fs; switch (ft) { case fs::file_type::fifo_file: @@ -931,7 +934,8 @@ bool Platform::ResolveRemotePath(const FileSpec &platform_path, FileSpec &resolved_platform_path) { resolved_platform_path = platform_path; - return resolved_platform_path.ResolvePath(); + FileSystem::Instance().Resolve(resolved_platform_path); + return true; } const ArchSpec &Platform::GetSystemArchitecture() { @@ -1799,9 +1803,9 @@ { FileSpec file_to_use; if (remote_filename.IsAbsolute()) - file_to_use = FileSpec(remote_filename.GetFilename().GetStringRef(), - false, - remote_filename.GetPathStyle()); + file_to_use = FileSpec(remote_filename.GetFilename().GetStringRef(), + + remote_filename.GetPathStyle()); else file_to_use = remote_filename; Index: lldb/trunk/source/Target/Process.cpp =================================================================== --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -430,7 +430,7 @@ case 'i': // STDIN for read only { FileAction action; - if (action.Open(STDIN_FILENO, FileSpec{option_arg, false}, true, false)) + if (action.Open(STDIN_FILENO, FileSpec(option_arg), true, false)) launch_info.AppendFileAction(action); break; } @@ -438,7 +438,7 @@ case 'o': // Open STDOUT for write only { FileAction action; - if (action.Open(STDOUT_FILENO, FileSpec{option_arg, false}, false, true)) + if (action.Open(STDOUT_FILENO, FileSpec(option_arg), false, true)) launch_info.AppendFileAction(action); break; } @@ -446,7 +446,7 @@ case 'e': // STDERR for write only { FileAction action; - if (action.Open(STDERR_FILENO, FileSpec{option_arg, false}, false, true)) + if (action.Open(STDERR_FILENO, FileSpec(option_arg), false, true)) launch_info.AppendFileAction(action); break; } @@ -458,7 +458,7 @@ case 'n': // Disable STDIO { FileAction action; - const FileSpec dev_null{FileSystem::DEV_NULL, false}; + const FileSpec dev_null(FileSystem::DEV_NULL); if (action.Open(STDIN_FILENO, dev_null, true, false)) launch_info.AppendFileAction(action); if (action.Open(STDOUT_FILENO, dev_null, false, true)) @@ -469,7 +469,7 @@ } case 'w': - launch_info.SetWorkingDirectory(FileSpec{option_arg, false}); + launch_info.SetWorkingDirectory(FileSpec(option_arg)); break; case 't': // Open process in new terminal window @@ -515,7 +515,7 @@ case 'c': if (!option_arg.empty()) - launch_info.SetShell(FileSpec(option_arg, false)); + launch_info.SetShell(FileSpec(option_arg)); else launch_info.SetShell(HostInfo::GetDefaultShell()); break; Index: lldb/trunk/source/Target/ProcessInfo.cpp =================================================================== --- lldb/trunk/source/Target/ProcessInfo.cpp +++ lldb/trunk/source/Target/ProcessInfo.cpp @@ -29,8 +29,8 @@ ProcessInfo::ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) - : m_executable(name, false), m_arguments(), m_environment(), - m_uid(UINT32_MAX), m_gid(UINT32_MAX), m_arch(arch), m_pid(pid) {} + : m_executable(name), m_arguments(), m_environment(), m_uid(UINT32_MAX), + m_gid(UINT32_MAX), m_arch(arch), m_pid(pid) {} void ProcessInfo::Clear() { m_executable.Clear(); @@ -96,8 +96,7 @@ // Yes the first argument is an executable, set it as the executable in // the launch options. Don't resolve the file path as the path could be a // remote platform path - const bool resolve = false; - m_executable.SetFile(first_arg, resolve, FileSpec::Style::native); + m_executable.SetFile(first_arg, FileSpec::Style::native); } } } @@ -113,8 +112,7 @@ // Yes the first argument is an executable, set it as the executable in // the launch options. Don't resolve the file path as the path could be a // remote platform path - const bool resolve = false; - m_executable.SetFile(first_arg, resolve, FileSpec::Style::native); + m_executable.SetFile(first_arg, FileSpec::Style::native); } } } Index: lldb/trunk/source/Target/ProcessLaunchInfo.cpp =================================================================== --- lldb/trunk/source/Target/ProcessLaunchInfo.cpp +++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp @@ -108,8 +108,7 @@ bool ProcessLaunchInfo::AppendSuppressFileAction(int fd, bool read, bool write) { FileAction file_action; - if (file_action.Open(fd, FileSpec{FileSystem::DEV_NULL, false}, read, - write)) { + if (file_action.Open(fd, FileSpec(FileSystem::DEV_NULL), read, write)) { AppendFileAction(file_action); return true; } @@ -306,8 +305,7 @@ open_flags |= O_CLOEXEC; #endif if (m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) { - const FileSpec slave_file_spec{m_pty->GetSlaveName(nullptr, 0), - false}; + const FileSpec slave_file_spec(m_pty->GetSlaveName(nullptr, 0)); // Only use the slave tty if we don't have anything specified for // input and don't have an action for stdin @@ -359,7 +357,7 @@ // Add a modified PATH environment variable in case argv[0] is a // relative path. const char *argv0 = argv[0]; - FileSpec arg_spec(argv0, false); + FileSpec arg_spec(argv0); if (arg_spec.IsRelative()) { // We have a relative path to our executable which may not work if we // just try to run "a.out" (without it being converted to "./a.out") Index: lldb/trunk/source/Target/TargetList.cpp =================================================================== --- lldb/trunk/source/Target/TargetList.cpp +++ lldb/trunk/source/Target/TargetList.cpp @@ -120,8 +120,8 @@ if (!user_exe_path.empty()) { ModuleSpecList module_specs; ModuleSpec module_spec; - module_spec.GetFileSpec().SetFile(user_exe_path, true, - FileSpec::Style::native); + module_spec.GetFileSpec().SetFile(user_exe_path, FileSpec::Style::native); + FileSystem::Instance().Resolve(module_spec.GetFileSpec()); // Resolve the executable in case we are given a path to a application // bundle like a .app bundle on MacOSX @@ -346,7 +346,7 @@ if (!arch.IsValid()) arch = specified_arch; - FileSpec file(user_exe_path, false); + FileSpec file(user_exe_path); if (!FileSystem::Instance().Exists(file) && user_exe_path.startswith("~")) { // we want to expand the tilde but we don't want to resolve any symbolic // links so we can't use the FileSpec constructor's resolve flag @@ -355,9 +355,9 @@ Resolver.ResolveFullPath(user_exe_path, unglobbed_path); if (unglobbed_path.empty()) - file = FileSpec(user_exe_path, false); + file = FileSpec(user_exe_path); else - file = FileSpec(unglobbed_path.c_str(), false); + file = FileSpec(unglobbed_path.c_str()); } bool user_exe_path_is_bundle = false; @@ -370,7 +370,7 @@ if (file.IsRelative() && !user_exe_path.empty()) { llvm::SmallString<64> cwd; if (! llvm::sys::fs::current_path(cwd)) { - FileSpec cwd_file(cwd.c_str(), false); + FileSpec cwd_file(cwd.c_str()); cwd_file.AppendPathComponent(file); if (FileSystem::Instance().Exists(cwd_file)) file = cwd_file; Index: lldb/trunk/source/Utility/FileSpec.cpp =================================================================== --- lldb/trunk/source/Utility/FileSpec.cpp +++ lldb/trunk/source/Utility/FileSpec.cpp @@ -10,7 +10,6 @@ #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" -#include "lldb/Utility/TildeExpressionResolver.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" @@ -67,38 +66,17 @@ } // end anonymous namespace -void FileSpec::Resolve(llvm::SmallVectorImpl &path) { - if (path.empty()) - return; - - llvm::SmallString<32> Source(path.begin(), path.end()); - StandardTildeExpressionResolver Resolver; - Resolver.ResolveFullPath(Source, path); - - // Save a copy of the original path that's passed in - llvm::SmallString<128> original_path(path.begin(), path.end()); - - llvm::sys::fs::make_absolute(path); - if (!llvm::sys::fs::exists(path)) { - path.clear(); - path.append(original_path.begin(), original_path.end()); - } -} - FileSpec::FileSpec() : m_style(GetNativeStyle()) {} //------------------------------------------------------------------ // Default constructor that can take an optional full path to a file on disk. //------------------------------------------------------------------ -FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, Style style) - : m_style(style) { - SetFile(path, resolve_path, style); +FileSpec::FileSpec(llvm::StringRef path, Style style) : m_style(style) { + SetFile(path, style); } -FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, - const llvm::Triple &Triple) - : FileSpec{path, resolve_path, - Triple.isOSWindows() ? Style::windows : Style::posix} {} +FileSpec::FileSpec(llvm::StringRef path, const llvm::Triple &Triple) + : FileSpec{path, Triple.isOSWindows() ? Style::windows : Style::posix} {} //------------------------------------------------------------------ // Copy constructor @@ -227,16 +205,14 @@ return *this; } -void FileSpec::SetFile(llvm::StringRef pathname, bool resolve) { - SetFile(pathname, resolve, m_style); -} +void FileSpec::SetFile(llvm::StringRef pathname) { SetFile(pathname, m_style); } //------------------------------------------------------------------ // Update the contents of this object with a new path. The path will be split // up into a directory and filename and stored as uniqued string values for // quick comparison and efficient memory usage. //------------------------------------------------------------------ -void FileSpec::SetFile(llvm::StringRef pathname, bool resolve, Style style) { +void FileSpec::SetFile(llvm::StringRef pathname, Style style) { m_filename.Clear(); m_directory.Clear(); m_is_resolved = false; @@ -245,12 +221,7 @@ if (pathname.empty()) return; - llvm::SmallString<64> resolved(pathname); - - if (resolve) { - FileSpec::Resolve(resolved); - m_is_resolved = true; - } + llvm::SmallString<128> resolved(pathname); // Normalize the path by removing ".", ".." and other redundant components. if (needsNormalization(resolved)) @@ -273,15 +244,14 @@ llvm::StringRef filename = llvm::sys::path::filename(resolved, m_style); if(!filename.empty()) m_filename.SetString(filename); + llvm::StringRef directory = llvm::sys::path::parent_path(resolved, m_style); if(!directory.empty()) m_directory.SetString(directory); } -void FileSpec::SetFile(llvm::StringRef path, bool resolve, - const llvm::Triple &Triple) { - return SetFile(path, resolve, - Triple.isOSWindows() ? Style::windows : Style::posix); +void FileSpec::SetFile(llvm::StringRef path, const llvm::Triple &Triple) { + return SetFile(path, Triple.isOSWindows() ? Style::windows : Style::posix); } //---------------------------------------------------------------------- @@ -316,49 +286,7 @@ // Equal to operator //------------------------------------------------------------------ bool FileSpec::operator==(const FileSpec &rhs) const { - if (!FileEquals(rhs)) - return false; - if (DirectoryEquals(rhs)) - return true; - - // TODO: determine if we want to keep this code in here. - // The code below was added to handle a case where we were trying to set a - // file and line breakpoint and one path was resolved, and the other not and - // the directory was in a mount point that resolved to a more complete path: - // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling this out... - if (IsResolved() && rhs.IsResolved()) { - // Both paths are resolved, no need to look further... - return false; - } - - FileSpec resolved_lhs(*this); - - // If "this" isn't resolved, resolve it - if (!IsResolved()) { - if (resolved_lhs.ResolvePath()) { - // This path wasn't resolved but now it is. Check if the resolved - // directory is the same as our unresolved directory, and if so, we can - // mark this object as resolved to avoid more future resolves - m_is_resolved = (m_directory == resolved_lhs.m_directory); - } else - return false; - } - - FileSpec resolved_rhs(rhs); - if (!rhs.IsResolved()) { - if (resolved_rhs.ResolvePath()) { - // rhs's path wasn't resolved but now it is. Check if the resolved - // directory is the same as rhs's unresolved directory, and if so, we can - // mark this object as resolved to avoid more future resolves - rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory); - } else - return false; - } - - // If we reach this point in the code we were able to resolve both paths and - // since we only resolve the paths if the basenames are equal, then we can - // just check if both directories are equal... - return DirectoryEquals(rhs); + return FileEquals(rhs) && DirectoryEquals(rhs); } //------------------------------------------------------------------ @@ -453,15 +381,6 @@ } } -bool FileSpec::ResolvePath() { - if (m_is_resolved) - return true; // We have already resolved this path - - // SetFile(...) will set m_is_resolved correctly if it can resolve the path - SetFile(GetPath(false), true); - return m_is_resolved; -} - FileSpec::Style FileSpec::GetPathStyle() const { return m_style; } //------------------------------------------------------------------ @@ -552,7 +471,7 @@ llvm::SmallString<64> current_path; GetPath(current_path, false); if (llvm::sys::path::has_parent_path(current_path, m_style)) - return FileSpec(llvm::sys::path::parent_path(current_path, m_style), false, + return FileSpec(llvm::sys::path::parent_path(current_path, m_style), m_style); return *this; } @@ -570,7 +489,7 @@ llvm::sys::path::append(new_path, llvm::sys::path::begin(current_path, m_style), llvm::sys::path::end(current_path), m_style); - SetFile(new_path, false, m_style); + SetFile(new_path, m_style); } void FileSpec::PrependPathComponent(const FileSpec &new_path) { @@ -581,7 +500,7 @@ llvm::SmallString<64> current_path; GetPath(current_path, false); llvm::sys::path::append(current_path, m_style, component); - SetFile(current_path, false, m_style); + SetFile(current_path, m_style); } void FileSpec::AppendPathComponent(const FileSpec &new_path) { @@ -592,7 +511,7 @@ llvm::SmallString<64> current_path; GetPath(current_path, false); if (llvm::sys::path::has_parent_path(current_path, m_style)) { - SetFile(llvm::sys::path::parent_path(current_path, m_style), false); + SetFile(llvm::sys::path::parent_path(current_path, m_style)); return true; } return false; Index: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp =================================================================== --- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp +++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp @@ -21,13 +21,13 @@ // C++ Includes - #include "Acceptor.h" #include "LLDBServerUtilities.h" #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h" #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/ConnectionFileDescriptor.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostGetOpt.h" #include "lldb/Host/OptionParser.h" #include "lldb/Host/Pipe.h" @@ -187,7 +187,9 @@ llvm::errs() << "Error getting current directory: " << ec.message() << "\n"; exit(1); } - info.SetWorkingDirectory(FileSpec(cwd, true)); + FileSpec cwd_spec(cwd); + FileSystem::Instance().Resolve(cwd_spec); + info.SetWorkingDirectory(cwd_spec); info.GetEnvironment() = Host::GetEnvironment(); gdb_server.SetLaunchInfo(info); Index: lldb/trunk/tools/lldb-server/lldb-platform.cpp =================================================================== --- lldb/trunk/tools/lldb-server/lldb-platform.cpp +++ lldb/trunk/tools/lldb-server/lldb-platform.cpp @@ -100,7 +100,7 @@ static Status save_socket_id_to_file(const std::string &socket_id, const FileSpec &file_spec) { - FileSpec temp_file_spec(file_spec.GetDirectory().AsCString(), false); + FileSpec temp_file_spec(file_spec.GetDirectory().AsCString()); Status error(llvm::sys::fs::create_directory(temp_file_spec.GetPath())); if (error.Fail()) return Status("Failed to create directory %s: %s", @@ -193,7 +193,7 @@ case 'f': // Socket file if (optarg && optarg[0]) - socket_file.SetFile(optarg, false, FileSpec::Style::native); + socket_file.SetFile(optarg, FileSpec::Style::native); break; case 'p': { Index: lldb/trunk/tools/lldb-test/lldb-test.cpp =================================================================== --- lldb/trunk/tools/lldb-test/lldb-test.cpp +++ lldb/trunk/tools/lldb-test/lldb-test.cpp @@ -347,7 +347,7 @@ if (!File.empty()) { assert(Line != 0); - FileSpec src_file(File, false); + FileSpec src_file(File); size_t cu_count = Module.GetNumCompileUnits(); for (size_t i = 0; i < cu_count; i++) { lldb::CompUnitSP cu_sp = Module.GetCompileUnitAtIndex(i); @@ -397,7 +397,7 @@ SymbolContextList List; - FileSpec src_file(File, false); + FileSpec src_file(File); size_t cu_count = Module.GetNumCompileUnits(); for (size_t i = 0; i < cu_count; i++) { lldb::CompUnitSP cu_sp = Module.GetCompileUnitAtIndex(i); @@ -695,8 +695,8 @@ int HadErrors = 0; for (const auto &File : InputFilenames) { outs() << "Module: " << File << "\n"; - ModuleSpec Spec{FileSpec(File, false)}; - Spec.GetSymbolFileSpec().SetFile(File, false, FileSpec::Style::native); + ModuleSpec Spec{FileSpec(File)}; + Spec.GetSymbolFileSpec().SetFile(File, FileSpec::Style::native); auto ModulePtr = std::make_shared(Spec); SymbolVendor *Vendor = ModulePtr->GetSymbolVendor(); @@ -721,7 +721,7 @@ int HadErrors = 0; for (const auto &File : opts::object::InputFilenames) { - ModuleSpec Spec{FileSpec(File, false)}; + ModuleSpec Spec{FileSpec(File)}; auto ModulePtr = std::make_shared(Spec); // Fetch symbol vendor before we get the section list to give the symbol Index: lldb/trunk/unittests/Core/MangledTest.cpp =================================================================== --- lldb/trunk/unittests/Core/MangledTest.cpp +++ lldb/trunk/unittests/Core/MangledTest.cpp @@ -83,8 +83,8 @@ ASSERT_NO_ERROR(llvm::sys::fs::file_size(Obj, Size)); ASSERT_GT(Size, 0u); - ModuleSpec Spec{FileSpec(Obj, false)}; - Spec.GetSymbolFileSpec().SetFile(Obj, false, FileSpec::Style::native); + ModuleSpec Spec{FileSpec(Obj)}; + Spec.GetSymbolFileSpec().SetFile(Obj, FileSpec::Style::native); auto M = std::make_shared(Spec); auto Count = [M](const char *Name, FunctionNameType Type) -> int { Index: lldb/trunk/unittests/Editline/EditlineTest.cpp =================================================================== --- lldb/trunk/unittests/Editline/EditlineTest.cpp +++ lldb/trunk/unittests/Editline/EditlineTest.cpp @@ -20,6 +20,7 @@ #include "gtest/gtest.h" #include "lldb/Host/Editline.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Pipe.h" #include "lldb/Host/PseudoTerminal.h" #include "lldb/Utility/Status.h" @@ -246,6 +247,8 @@ public: void SetUp() { + FileSystem::Initialize(); + // We need a TERM set properly for editline to work as expected. setenv("TERM", "vt100", 1); @@ -263,6 +266,8 @@ _el_adapter.CloseInput(); if (_sp_output_thread) _sp_output_thread->join(); + + FileSystem::Terminate(); } EditlineAdapter &GetEditlineAdapter() { return _el_adapter; } Index: lldb/trunk/unittests/Expression/ClangParserTest.cpp =================================================================== --- lldb/trunk/unittests/Expression/ClangParserTest.cpp +++ lldb/trunk/unittests/Expression/ClangParserTest.cpp @@ -34,7 +34,7 @@ static std::string ComputeClangDir(std::string lldb_shlib_path, bool verify = false) { FileSpec clang_dir; - FileSpec lldb_shlib_spec(lldb_shlib_path, false); + FileSpec lldb_shlib_spec(lldb_shlib_path); ComputeClangDirectory(lldb_shlib_spec, clang_dir, verify); return clang_dir.GetPath(); } Index: lldb/trunk/unittests/Host/FileSystemTest.cpp =================================================================== --- lldb/trunk/unittests/Host/FileSystemTest.cpp +++ lldb/trunk/unittests/Host/FileSystemTest.cpp @@ -158,16 +158,16 @@ TEST(FileSystemTest, FileAndDirectoryComponents) { using namespace std::chrono; + FileSystem fs; - const bool resolve = true; #ifdef _WIN32 - FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT", !resolve); + FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT"); #else - FileSpec fs1("/file/that/does/not/exist.txt", !resolve); + FileSpec fs1("/file/that/does/not/exist.txt"); #endif - FileSpec fs2(TestMainArgv0, resolve); + FileSpec fs2(TestMainArgv0); - FileSystem fs; + fs.Resolve(fs2); EXPECT_EQ(system_clock::time_point(), fs.GetModificationTime(fs1)); EXPECT_LT(system_clock::time_point() + hours(24 * 365 * 20), @@ -188,17 +188,17 @@ FileSystem fs(GetSimpleDummyFS()); EXPECT_TRUE(fs.Exists("/foo")); - EXPECT_TRUE(fs.Exists(FileSpec("/foo", false, FileSpec::Style::posix))); + EXPECT_TRUE(fs.Exists(FileSpec("/foo", FileSpec::Style::posix))); } TEST(FileSystemTest, Readable) { FileSystem fs(GetSimpleDummyFS()); EXPECT_TRUE(fs.Readable("/foo")); - EXPECT_TRUE(fs.Readable(FileSpec("/foo", false, FileSpec::Style::posix))); + EXPECT_TRUE(fs.Readable(FileSpec("/foo", FileSpec::Style::posix))); EXPECT_FALSE(fs.Readable("/qux")); - EXPECT_FALSE(fs.Readable(FileSpec("/qux", false, FileSpec::Style::posix))); + EXPECT_FALSE(fs.Readable(FileSpec("/qux", FileSpec::Style::posix))); } TEST(FileSystemTest, GetByteSize) { @@ -206,7 +206,7 @@ EXPECT_EQ((uint64_t)1024, fs.GetByteSize("/foo")); EXPECT_EQ((uint64_t)1024, - fs.GetByteSize(FileSpec("/foo", false, FileSpec::Style::posix))); + fs.GetByteSize(FileSpec("/foo", FileSpec::Style::posix))); } TEST(FileSystemTest, GetPermissions) { @@ -214,7 +214,7 @@ EXPECT_EQ(sys::fs::all_all, fs.GetPermissions("/foo")); EXPECT_EQ(sys::fs::all_all, - fs.GetPermissions(FileSpec("/foo", false, FileSpec::Style::posix))); + fs.GetPermissions(FileSpec("/foo", FileSpec::Style::posix))); } TEST(FileSystemTest, MakeAbsolute) { @@ -229,7 +229,7 @@ } { - FileSpec file_spec("foo", false); + FileSpec file_spec("foo"); auto EC = fs.MakeAbsolute(file_spec); EXPECT_FALSE(EC); EXPECT_EQ("/foo", file_spec.GetPath()); @@ -247,7 +247,7 @@ } { - FileSpec file_spec("foo", false); + FileSpec file_spec("foo"); fs.Resolve(file_spec); EXPECT_EQ("/foo", file_spec.GetPath()); } @@ -260,7 +260,7 @@ } { - FileSpec file_spec("bogus", false); + FileSpec file_spec("bogus"); fs.Resolve(file_spec); EXPECT_EQ("bogus", file_spec.GetPath()); } Index: lldb/trunk/unittests/Host/SymbolsTest.cpp =================================================================== --- lldb/trunk/unittests/Host/SymbolsTest.cpp +++ lldb/trunk/unittests/Host/SymbolsTest.cpp @@ -43,8 +43,7 @@ ModuleSpec module_spec; // using a GUID here because the symbol file shouldn't actually exist on disk module_spec.GetSymbolFileSpec().SetFile( - "4A524676-B24B-4F4E-968A-551D465EBAF1.so", false, - FileSpec::Style::native); + "4A524676-B24B-4F4E-968A-551D465EBAF1.so", FileSpec::Style::native); FileSpec symbol_file_spec = Symbols::LocateExecutableSymbolFile(module_spec); EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty()); } Index: lldb/trunk/unittests/Host/linux/HostTest.cpp =================================================================== --- lldb/trunk/unittests/Host/linux/HostTest.cpp +++ lldb/trunk/unittests/Host/linux/HostTest.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Host/Host.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" #include "gtest/gtest.h" @@ -17,8 +18,14 @@ namespace { class HostTest : public testing::Test { public: - static void SetUpTestCase() { HostInfo::Initialize(); } - static void TearDownTestCase() { HostInfo::Terminate(); } + static void SetUpTestCase() { + FileSystem::Initialize(); + HostInfo::Initialize(); + } + static void TearDownTestCase() { + HostInfo::Terminate(); + FileSystem::Terminate(); + } }; } // namespace Index: lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp =================================================================== --- lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp +++ lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp @@ -74,8 +74,8 @@ ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size)); ASSERT_GT(size, 0u); - ModuleSpec spec{FileSpec(obj, false)}; - spec.GetSymbolFileSpec().SetFile(obj, false, FileSpec::Style::native); + ModuleSpec spec{FileSpec(obj)}; + spec.GetSymbolFileSpec().SetFile(obj, FileSpec::Style::native); auto module_sp = std::make_shared(spec); SectionList *list = module_sp->GetSectionList(); ASSERT_NE(nullptr, list); @@ -134,7 +134,7 @@ TEST_F(ObjectFileELFTest, GetModuleSpecifications_EarlySectionHeaders) { std::string SO = GetInputFilePath("early-section-headers.so"); ModuleSpecList Specs; - ASSERT_EQ(1u, ObjectFile::GetModuleSpecifications(FileSpec(SO, false), 0, 0, Specs)); + ASSERT_EQ(1u, ObjectFile::GetModuleSpecifications(FileSpec(SO), 0, 0, Specs)); ModuleSpec Spec; ASSERT_TRUE(Specs.GetModuleSpecAtIndex(0, Spec)) ; UUID Uuid; Index: lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp =================================================================== --- lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp +++ lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp @@ -55,19 +55,18 @@ std::string base = "/Applications/Xcode.app/Contents/Developer/Platforms/"; EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules( PlatformDarwin::SDKType::iPhoneSimulator, - FileSpec(base + - "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk", - false))); + FileSpec( + base + + "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk"))); EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules( PlatformDarwin::SDKType::iPhoneSimulator, - FileSpec(base + - "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.2.sdk", - false))); + FileSpec( + base + + "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.2.sdk"))); EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules( PlatformDarwin::SDKType::MacOSX, - FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk", - false))); + FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"))); EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules( PlatformDarwin::SDKType::MacOSX, - FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk", false))); + FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk"))); } Index: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp =================================================================== --- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -169,14 +169,14 @@ llvm::Triple triple("i386-pc-linux"); FileSpec file_specs[] = { - FileSpec("/foo/bar.so", false, FileSpec::Style::posix), - FileSpec("/foo/baz.so", false, FileSpec::Style::posix), + FileSpec("/foo/bar.so", FileSpec::Style::posix), + FileSpec("/foo/baz.so", FileSpec::Style::posix), // This is a bit dodgy but we currently depend on GetModulesInfo not // performing denormalization. It can go away once the users // (DynamicLoaderPOSIXDYLD, at least) correctly set the path syntax for // the FileSpecs they create. - FileSpec("/foo/baw.so", false, FileSpec::Style::windows), + FileSpec("/foo/baw.so", FileSpec::Style::windows), }; std::future>> async_result = std::async(std::launch::async, @@ -203,7 +203,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) { llvm::Triple triple("i386-pc-linux"); - FileSpec file_spec("/foo/bar.so", false, FileSpec::Style::posix); + FileSpec file_spec("/foo/bar.so", FileSpec::Style::posix); std::future>> async_result = std::async(std::launch::async, [&] { return client.GetModulesInfo(file_spec, triple); }); @@ -227,7 +227,7 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) { llvm::Triple triple("i386-pc-linux"); - FileSpec file_spec("/foo/bar.so", false, FileSpec::Style::posix); + FileSpec file_spec("/foo/bar.so", FileSpec::Style::posix); const char *invalid_responses[] = { // no UUID Index: lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp =================================================================== --- lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp +++ lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp @@ -113,7 +113,7 @@ ASSERT_NO_ERROR(llvm::sys::fs::file_size(obj, size)); ASSERT_GT(size, 0u); - auto module_sp = std::make_shared(ModuleSpec(FileSpec(obj, false))); + auto module_sp = std::make_shared(ModuleSpec(FileSpec(obj))); SectionList *list = module_sp->GetSectionList(); ASSERT_NE(nullptr, list); Index: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp =================================================================== --- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp +++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp @@ -64,7 +64,7 @@ TEST_F(SymbolFileDWARFTests, TestAbilitiesForDWARF) { // Test that when we have Dwarf debug info, SymbolFileDWARF is used. - FileSpec fspec(m_dwarf_test_exe, false); + FileSpec fspec(m_dwarf_test_exe); ArchSpec aspec("i686-pc-windows"); lldb::ModuleSP module = std::make_shared(fspec, aspec); Index: lldb/trunk/unittests/Target/ModuleCacheTest.cpp =================================================================== --- lldb/trunk/unittests/Target/ModuleCacheTest.cpp +++ lldb/trunk/unittests/Target/ModuleCacheTest.cpp @@ -45,7 +45,7 @@ static const size_t module_size = 5602; static FileSpec GetDummyRemotePath() { - FileSpec fs("/", false, FileSpec::Style::posix); + FileSpec fs("/", FileSpec::Style::posix); fs.AppendPathComponent(dummy_remote_dir); fs.AppendPathComponent(module_name); return fs; Index: lldb/trunk/unittests/Target/PathMappingListTest.cpp =================================================================== --- lldb/trunk/unittests/Target/PathMappingListTest.cpp +++ lldb/trunk/unittests/Target/PathMappingListTest.cpp @@ -19,8 +19,7 @@ struct Matches { FileSpec original; FileSpec remapped; - Matches(const char *o, const char *r) - : original(o, false), remapped(r, false) {} + Matches(const char *o, const char *r) : original(o), remapped(r) {} }; } // namespace @@ -38,7 +37,7 @@ std::string orig_normalized = match.original.GetPath(); EXPECT_TRUE( map.RemapPath(ConstString(match.original.GetPath()), actual_remapped)); - EXPECT_EQ(FileSpec(actual_remapped.GetStringRef(), false), match.remapped); + EXPECT_EQ(FileSpec(actual_remapped.GetStringRef()), match.remapped); FileSpec unmapped_spec; EXPECT_TRUE(map.ReverseRemapPath(match.remapped, unmapped_spec)); std::string unmapped_path = unmapped_spec.GetPath(); Index: lldb/trunk/unittests/Utility/FileSpecTest.cpp =================================================================== --- lldb/trunk/unittests/Utility/FileSpecTest.cpp +++ lldb/trunk/unittests/Utility/FileSpecTest.cpp @@ -14,92 +14,91 @@ using namespace lldb_private; TEST(FileSpecTest, FileAndDirectoryComponents) { - FileSpec fs_posix("/foo/bar", false, FileSpec::Style::posix); + FileSpec fs_posix("/foo/bar", FileSpec::Style::posix); EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString()); EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString()); - FileSpec fs_windows("F:\\bar", false, FileSpec::Style::windows); + FileSpec fs_windows("F:\\bar", FileSpec::Style::windows); EXPECT_STREQ("F:\\bar", fs_windows.GetCString()); // EXPECT_STREQ("F:\\", fs_windows.GetDirectory().GetCString()); // It returns // "F:/" EXPECT_STREQ("bar", fs_windows.GetFilename().GetCString()); - FileSpec fs_posix_root("/", false, FileSpec::Style::posix); + FileSpec fs_posix_root("/", FileSpec::Style::posix); EXPECT_STREQ("/", fs_posix_root.GetCString()); EXPECT_EQ(nullptr, fs_posix_root.GetDirectory().GetCString()); EXPECT_STREQ("/", fs_posix_root.GetFilename().GetCString()); - FileSpec fs_net_drive("//net", false, FileSpec::Style::posix); + FileSpec fs_net_drive("//net", FileSpec::Style::posix); EXPECT_STREQ("//net", fs_net_drive.GetCString()); EXPECT_EQ(nullptr, fs_net_drive.GetDirectory().GetCString()); EXPECT_STREQ("//net", fs_net_drive.GetFilename().GetCString()); - FileSpec fs_net_root("//net/", false, FileSpec::Style::posix); + FileSpec fs_net_root("//net/", FileSpec::Style::posix); EXPECT_STREQ("//net/", fs_net_root.GetCString()); EXPECT_STREQ("//net", fs_net_root.GetDirectory().GetCString()); EXPECT_STREQ("/", fs_net_root.GetFilename().GetCString()); - FileSpec fs_windows_drive("F:", false, FileSpec::Style::windows); + FileSpec fs_windows_drive("F:", FileSpec::Style::windows); EXPECT_STREQ("F:", fs_windows_drive.GetCString()); EXPECT_EQ(nullptr, fs_windows_drive.GetDirectory().GetCString()); EXPECT_STREQ("F:", fs_windows_drive.GetFilename().GetCString()); - FileSpec fs_windows_root("F:\\", false, FileSpec::Style::windows); + FileSpec fs_windows_root("F:\\", FileSpec::Style::windows); EXPECT_STREQ("F:\\", fs_windows_root.GetCString()); EXPECT_STREQ("F:", fs_windows_root.GetDirectory().GetCString()); // EXPECT_STREQ("\\", fs_windows_root.GetFilename().GetCString()); // It // returns "/" - FileSpec fs_posix_long("/foo/bar/baz", false, FileSpec::Style::posix); + FileSpec fs_posix_long("/foo/bar/baz", FileSpec::Style::posix); EXPECT_STREQ("/foo/bar/baz", fs_posix_long.GetCString()); EXPECT_STREQ("/foo/bar", fs_posix_long.GetDirectory().GetCString()); EXPECT_STREQ("baz", fs_posix_long.GetFilename().GetCString()); - FileSpec fs_windows_long("F:\\bar\\baz", false, FileSpec::Style::windows); + FileSpec fs_windows_long("F:\\bar\\baz", FileSpec::Style::windows); EXPECT_STREQ("F:\\bar\\baz", fs_windows_long.GetCString()); // EXPECT_STREQ("F:\\bar", fs_windows_long.GetDirectory().GetCString()); // It // returns "F:/bar" EXPECT_STREQ("baz", fs_windows_long.GetFilename().GetCString()); - FileSpec fs_posix_trailing_slash("/foo/bar/", false, FileSpec::Style::posix); + FileSpec fs_posix_trailing_slash("/foo/bar/", FileSpec::Style::posix); EXPECT_STREQ("/foo/bar", fs_posix_trailing_slash.GetCString()); EXPECT_STREQ("/foo", fs_posix_trailing_slash.GetDirectory().GetCString()); EXPECT_STREQ("bar", fs_posix_trailing_slash.GetFilename().GetCString()); - FileSpec fs_windows_trailing_slash("F:\\bar\\", false, - FileSpec::Style::windows); + FileSpec fs_windows_trailing_slash("F:\\bar\\", FileSpec::Style::windows); EXPECT_STREQ("F:\\bar", fs_windows_trailing_slash.GetCString()); EXPECT_STREQ("bar", fs_windows_trailing_slash.GetFilename().GetCString()); } TEST(FileSpecTest, AppendPathComponent) { - FileSpec fs_posix("/foo", false, FileSpec::Style::posix); + FileSpec fs_posix("/foo", FileSpec::Style::posix); fs_posix.AppendPathComponent("bar"); EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); EXPECT_STREQ("/foo", fs_posix.GetDirectory().GetCString()); EXPECT_STREQ("bar", fs_posix.GetFilename().GetCString()); - FileSpec fs_posix_2("/foo", false, FileSpec::Style::posix); + FileSpec fs_posix_2("/foo", FileSpec::Style::posix); fs_posix_2.AppendPathComponent("//bar/baz"); EXPECT_STREQ("/foo/bar/baz", fs_posix_2.GetCString()); EXPECT_STREQ("/foo/bar", fs_posix_2.GetDirectory().GetCString()); EXPECT_STREQ("baz", fs_posix_2.GetFilename().GetCString()); - FileSpec fs_windows("F:\\bar", false, FileSpec::Style::windows); + FileSpec fs_windows("F:\\bar", FileSpec::Style::windows); fs_windows.AppendPathComponent("baz"); EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString()); // EXPECT_STREQ("F:\\bar", fs_windows.GetDirectory().GetCString()); // It // returns "F:/bar" EXPECT_STREQ("baz", fs_windows.GetFilename().GetCString()); - FileSpec fs_posix_root("/", false, FileSpec::Style::posix); + FileSpec fs_posix_root("/", FileSpec::Style::posix); fs_posix_root.AppendPathComponent("bar"); EXPECT_STREQ("/bar", fs_posix_root.GetCString()); EXPECT_STREQ("/", fs_posix_root.GetDirectory().GetCString()); EXPECT_STREQ("bar", fs_posix_root.GetFilename().GetCString()); - FileSpec fs_windows_root("F:\\", false, FileSpec::Style::windows); + FileSpec fs_windows_root("F:\\", FileSpec::Style::windows); fs_windows_root.AppendPathComponent("bar"); EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString()); // EXPECT_STREQ("F:\\", fs_windows_root.GetDirectory().GetCString()); // It @@ -108,7 +107,7 @@ } TEST(FileSpecTest, CopyByAppendingPathComponent) { - FileSpec fs = FileSpec("/foo", false, FileSpec::Style::posix) + FileSpec fs = FileSpec("/foo", FileSpec::Style::posix) .CopyByAppendingPathComponent("bar"); EXPECT_STREQ("/foo/bar", fs.GetCString()); EXPECT_STREQ("/foo", fs.GetDirectory().GetCString()); @@ -116,30 +115,30 @@ } TEST(FileSpecTest, PrependPathComponent) { - FileSpec fs_posix("foo", false, FileSpec::Style::posix); + FileSpec fs_posix("foo", FileSpec::Style::posix); fs_posix.PrependPathComponent("/bar"); EXPECT_STREQ("/bar/foo", fs_posix.GetCString()); - FileSpec fs_posix_2("foo/bar", false, FileSpec::Style::posix); + FileSpec fs_posix_2("foo/bar", FileSpec::Style::posix); fs_posix_2.PrependPathComponent("/baz"); EXPECT_STREQ("/baz/foo/bar", fs_posix_2.GetCString()); - FileSpec fs_windows("baz", false, FileSpec::Style::windows); + FileSpec fs_windows("baz", FileSpec::Style::windows); fs_windows.PrependPathComponent("F:\\bar"); EXPECT_STREQ("F:\\bar\\baz", fs_windows.GetCString()); - FileSpec fs_posix_root("bar", false, FileSpec::Style::posix); + FileSpec fs_posix_root("bar", FileSpec::Style::posix); fs_posix_root.PrependPathComponent("/"); EXPECT_STREQ("/bar", fs_posix_root.GetCString()); - FileSpec fs_windows_root("bar", false, FileSpec::Style::windows); + FileSpec fs_windows_root("bar", FileSpec::Style::windows); fs_windows_root.PrependPathComponent("F:\\"); EXPECT_STREQ("F:\\bar", fs_windows_root.GetCString()); } TEST(FileSpecTest, EqualSeparator) { - FileSpec backward("C:\\foo\\bar", false, FileSpec::Style::windows); - FileSpec forward("C:/foo/bar", false, FileSpec::Style::windows); + FileSpec backward("C:\\foo\\bar", FileSpec::Style::windows); + FileSpec forward("C:/foo/bar", FileSpec::Style::windows); EXPECT_EQ(forward, backward); } @@ -155,8 +154,8 @@ }; for (const auto &test : tests) { - FileSpec one(test.first, false, FileSpec::Style::windows); - FileSpec two(test.second, false, FileSpec::Style::windows); + FileSpec one(test.first, FileSpec::Style::windows); + FileSpec two(test.second, FileSpec::Style::windows); EXPECT_EQ(one, two); } } @@ -171,8 +170,8 @@ }; for (const auto &test : tests) { - FileSpec one(test.first, false, FileSpec::Style::posix); - FileSpec two(test.second, false, FileSpec::Style::posix); + FileSpec one(test.first, FileSpec::Style::posix); + FileSpec two(test.second, FileSpec::Style::posix); EXPECT_EQ(one, two); } } @@ -185,8 +184,8 @@ }; for (const auto &test : tests) { - FileSpec one(test.first, false, FileSpec::Style::posix); - FileSpec two(test.second, false, FileSpec::Style::posix); + FileSpec one(test.first, FileSpec::Style::posix); + FileSpec two(test.second, FileSpec::Style::posix); EXPECT_EQ(one, two); } } @@ -222,7 +221,7 @@ for (auto test : posix_tests) { SCOPED_TRACE(llvm::Twine("test.first = ") + test.first); EXPECT_EQ(test.second, - FileSpec(test.first, false, FileSpec::Style::posix).GetPath()); + FileSpec(test.first, FileSpec::Style::posix).GetPath()); } std::pair windows_tests[] = { @@ -254,7 +253,7 @@ }; for (auto test : windows_tests) { EXPECT_EQ(test.second, - FileSpec(test.first, false, FileSpec::Style::windows).GetPath()) + FileSpec(test.first, FileSpec::Style::windows).GetPath()) << "Original path: " << test.first; } } @@ -267,17 +266,17 @@ EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str()); EXPECT_EQ("(empty)", llvm::formatv("{0:F}", F).str()); - F = FileSpec("C:\\foo\\bar.txt", false, win); + F = FileSpec("C:\\foo\\bar.txt", win); EXPECT_EQ("C:\\foo\\bar.txt", llvm::formatv("{0}", F).str()); EXPECT_EQ("C:\\foo\\", llvm::formatv("{0:D}", F).str()); EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str()); - F = FileSpec("foo\\bar.txt", false, win); + F = FileSpec("foo\\bar.txt", win); EXPECT_EQ("foo\\bar.txt", llvm::formatv("{0}", F).str()); EXPECT_EQ("foo\\", llvm::formatv("{0:D}", F).str()); EXPECT_EQ("bar.txt", llvm::formatv("{0:F}", F).str()); - F = FileSpec("foo", false, win); + F = FileSpec("foo", win); EXPECT_EQ("foo", llvm::formatv("{0}", F).str()); EXPECT_EQ("foo", llvm::formatv("{0:F}", F).str()); EXPECT_EQ("(empty)", llvm::formatv("{0:D}", F).str()); @@ -306,7 +305,7 @@ "/foo/../.", }; for (const auto &path: not_relative) { - FileSpec spec(path, false, FileSpec::Style::posix); + FileSpec spec(path, FileSpec::Style::posix); EXPECT_FALSE(spec.IsRelative()); } llvm::StringRef is_relative[] = { @@ -324,13 +323,13 @@ "./foo/bar.c" }; for (const auto &path: is_relative) { - FileSpec spec(path, false, FileSpec::Style::posix); + FileSpec spec(path, FileSpec::Style::posix); EXPECT_TRUE(spec.IsRelative()); } } TEST(FileSpecTest, RemoveLastPathComponent) { - FileSpec fs_posix("/foo/bar/baz", false, FileSpec::Style::posix); + FileSpec fs_posix("/foo/bar/baz", FileSpec::Style::posix); EXPECT_STREQ("/foo/bar/baz", fs_posix.GetCString()); EXPECT_TRUE(fs_posix.RemoveLastPathComponent()); EXPECT_STREQ("/foo/bar", fs_posix.GetCString()); @@ -341,7 +340,7 @@ EXPECT_FALSE(fs_posix.RemoveLastPathComponent()); EXPECT_STREQ("/", fs_posix.GetCString()); - FileSpec fs_posix_relative("./foo/bar/baz", false, FileSpec::Style::posix); + FileSpec fs_posix_relative("./foo/bar/baz", FileSpec::Style::posix); EXPECT_STREQ("foo/bar/baz", fs_posix_relative.GetCString()); EXPECT_TRUE(fs_posix_relative.RemoveLastPathComponent()); EXPECT_STREQ("foo/bar", fs_posix_relative.GetCString()); @@ -350,14 +349,14 @@ EXPECT_FALSE(fs_posix_relative.RemoveLastPathComponent()); EXPECT_STREQ("foo", fs_posix_relative.GetCString()); - FileSpec fs_posix_relative2("./", false, FileSpec::Style::posix); + FileSpec fs_posix_relative2("./", FileSpec::Style::posix); EXPECT_STREQ(".", fs_posix_relative2.GetCString()); EXPECT_FALSE(fs_posix_relative2.RemoveLastPathComponent()); EXPECT_STREQ(".", fs_posix_relative2.GetCString()); EXPECT_FALSE(fs_posix_relative.RemoveLastPathComponent()); EXPECT_STREQ(".", fs_posix_relative2.GetCString()); - FileSpec fs_windows("C:\\foo\\bar\\baz", false, FileSpec::Style::windows); + FileSpec fs_windows("C:\\foo\\bar\\baz", FileSpec::Style::windows); EXPECT_STREQ("C:\\foo\\bar\\baz", fs_windows.GetCString()); EXPECT_TRUE(fs_windows.RemoveLastPathComponent()); EXPECT_STREQ("C:\\foo\\bar", fs_windows.GetCString()); Index: lldb/trunk/unittests/Utility/StructuredDataTest.cpp =================================================================== --- lldb/trunk/unittests/Utility/StructuredDataTest.cpp +++ lldb/trunk/unittests/Utility/StructuredDataTest.cpp @@ -35,11 +35,11 @@ TEST(StructuredDataTest, ParseJSONFromFile) { Status status; auto object_sp = StructuredData::ParseJSONFromFile( - FileSpec("non-existing-file.json", false), status); + FileSpec("non-existing-file.json"), status); EXPECT_EQ(nullptr, object_sp); std::string input = GetInputFilePath("StructuredData-basic.json"); - object_sp = StructuredData::ParseJSONFromFile(FileSpec(input, false), status); + object_sp = StructuredData::ParseJSONFromFile(FileSpec(input), status); ASSERT_NE(nullptr, object_sp); StreamString S;