SystemInitializerCommon fix compilation on linux
authorPavel Labath <pavel@labath.sk>
Fri, 18 Oct 2019 11:47:23 +0000 (11:47 +0000)
committerPavel Labath <pavel@labath.sk>
Fri, 18 Oct 2019 11:47:23 +0000 (11:47 +0000)
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

lldb/source/Initialization/SystemInitializerCommon.cpp

index e928bbc..36cec30 100644 (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()