Skip to content

Commit ded44e2

Browse files
committed
[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
1 parent 7f70432 commit ded44e2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lldb/source/Initialization/SystemInitializerCommon.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ llvm::Error SystemInitializerCommon::Initialize() {
8080
}
8181
if (llvm::Expected<std::string> cwd =
8282
loader->LoadBuffer<WorkingDirectoryProvider>()) {
83-
cwd->erase(std::remove_if(cwd->begin(), cwd->end(),
84-
[](char c) { return std::iscntrl(c); }),
85-
cwd->end());
83+
llvm::StringRef working_dir = llvm::StringRef(*cwd).rtrim();
8684
if (std::error_code ec = FileSystem::Instance()
8785
.GetVirtualFileSystem()
88-
->setCurrentWorkingDirectory(*cwd)) {
86+
->setCurrentWorkingDirectory(working_dir)) {
8987
return llvm::errorCodeToError(ec);
9088
}
9189
} else {

0 commit comments

Comments
 (0)