mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[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
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user