summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-10-18 17:11:48 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-10-18 17:11:48 +0000
commit12bee2741325f33cd9aa5c991a3ef8ebd7c10aed (patch)
treede59e2c53da6fe5f7e292f5fa5ba7ef0a06d983a
parentbc9136b56344c2995315db3c6285c7e3a4d1f800 (diff)
[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. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@375259 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--source/Initialization/SystemInitializerCommon.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/Initialization/SystemInitializerCommon.cpp b/source/Initialization/SystemInitializerCommon.cpp
index 36cec3094..7ae8ef5d4 100644
--- a/source/Initialization/SystemInitializerCommon.cpp
+++ b/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 {