SystemInitializerCommon fix compilation on linux

C++ defines two overloads of std::iscntrl. One in <cctype> and one in
<locale>. On linux we seem to include both which makes the std::erase_if
call ambiguous.

Wrap std::iscntrl call in a lambda to ensure regular overload
resolution.

llvm-svn: 375221
This commit is contained in:
Pavel Labath 2019-10-18 11:47:23 +00:00
parent 9c155985f1
commit 0c30491774
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@ llvm::Error SystemInitializerCommon::Initialize() {
}
if (llvm::Expected<std::string> cwd =
loader->LoadBuffer<WorkingDirectoryProvider>()) {
cwd->erase(std::remove_if(cwd->begin(), cwd->end(), std::iscntrl),
cwd->erase(std::remove_if(cwd->begin(), cwd->end(),
[](char c) { return std::iscntrl(c); }),
cwd->end());
if (std::error_code ec = FileSystem::Instance()
.GetVirtualFileSystem()