diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2161,7 +2161,7 @@ } const char *pcm_path = command.GetArgumentAtIndex(0); - FileSpec pcm_file{pcm_path}; + const FileSpec pcm_file{pcm_path}; if (pcm_file.GetFileNameExtension() != ".pcm") { result.AppendError("file must have a .pcm extension"); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -137,7 +137,8 @@ // with the binary inside it ('.../foo.dSYM/Contents/Resources/DWARF/foo'). // A dSYM bundle may have multiple DWARF binaries in them, so a vector // of matches is returned. - static std::vector GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle); + static std::vector + GetDWARFBinaryInDSYMBundle(const FileSpec &dsym_bundle); Status GetSharedModuleKext(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -421,7 +421,7 @@ static constexpr llvm::StringLiteral g_kdk_suffix = ".kdk"; PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton; - FileSpec file_spec(path); + const 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)) { @@ -482,7 +482,7 @@ static constexpr llvm::StringLiteral g_kext_suffix = ".kext"; static constexpr llvm::StringLiteral g_dsym_suffix = ".dSYM"; - FileSpec file_spec(path); + const FileSpec file_spec(path); llvm::StringRef file_spec_extension = file_spec.GetFileNameExtension(); Log *log = GetLog(LLDBLog::Platform); @@ -691,7 +691,7 @@ // it should iterate over every binary in the DWARF subdir // and return them all. std::vector -PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle) { +PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(const FileSpec &dsym_bundle) { std::vector results; static constexpr llvm::StringLiteral g_dsym_suffix = ".dSYM"; if (dsym_bundle.GetFileNameExtension() != g_dsym_suffix) { diff --git a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp --- a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp @@ -131,14 +131,13 @@ } llvm::Error Lua::LoadModule(llvm::StringRef filename) { - FileSpec file(filename); + const FileSpec file(filename); if (!FileSystem::Instance().Exists(file)) { return llvm::make_error("invalid path", llvm::inconvertibleErrorCode()); } - llvm::StringRef module_extension = file.GetFileNameExtension(); - if (module_extension != ".lua") { + if (file.GetFileNameExtension() != ".lua") { return llvm::make_error("invalid extension", llvm::inconvertibleErrorCode()); }