diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-18 17:11:48 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-18 17:11:48 +0000 |
commit | ded44e220f6ce15258663a0353cccc188211f1d7 (patch) | |
tree | e252225fc3435fc8fecb1de13060a8215d899416 | |
parent | 7f704320b058f7217847ee0e599f64e2ce50447c (diff) | |
download | bcm5719-llvm-ded44e220f6ce15258663a0353cccc188211f1d7.tar.gz bcm5719-llvm-ded44e220f6ce15258663a0353cccc188211f1d7.zip |
[Reproducer] Use ::rtrim() to remove trailing control characters.
Pavel correctly pointed out that removing all control characters from
the working directory is overkill. It should be sufficient to just strip
the last ones.
llvm-svn: 375259
-rw-r--r-- | lldb/source/Initialization/SystemInitializerCommon.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 36cec3094f3..7ae8ef5d4d6 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -80,12 +80,10 @@ llvm::Error SystemInitializerCommon::Initialize() { } if (llvm::Expected<std::string> cwd = loader->LoadBuffer<WorkingDirectoryProvider>()) { - cwd->erase(std::remove_if(cwd->begin(), cwd->end(), - [](char c) { return std::iscntrl(c); }), - cwd->end()); + llvm::StringRef working_dir = llvm::StringRef(*cwd).rtrim(); if (std::error_code ec = FileSystem::Instance() .GetVirtualFileSystem() - ->setCurrentWorkingDirectory(*cwd)) { + ->setCurrentWorkingDirectory(working_dir)) { return llvm::errorCodeToError(ec); } } else { |