[Lldb-commits] [PATCH] D69166: [LLDB] Do not take address of std::iscntrl in std::remove_if

Kyrylo Bohdanenko via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 18 06:16:03 PDT 2019


KyrBoh created this revision.
KyrBoh added a reviewer: MyDeveloperDay.
Herald added a reviewer: bollu.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Due to the fact, that getting an address of function in the standard library, LLDB fails to compile in my environment with en error saying "unable to find function to call for remove_if(..., <unresolved function type>)".

Just use the fix suggested by cppreference: wrap function into a lambda: https://en.cppreference.com/w/cpp/string/byte/iscntrl

Environment used:
OS: Ubuntu Eoan (19.10), x86_64
Compiler: g++ (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008
CMake invocation:
cmake \

  -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libunwind;lldb;compiler-rt;lld;polly" \
  -DLLVM_TARGETS_TO_BUILD="X86" \
  -DLLVM_BUILD_LLVM_DYLIB=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/opt/llvm-git \
  ../llvm-project/llvm


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69166

Files:
  lldb/source/Initialization/SystemInitializerCommon.cpp


Index: lldb/source/Initialization/SystemInitializerCommon.cpp
===================================================================
--- lldb/source/Initialization/SystemInitializerCommon.cpp
+++ lldb/source/Initialization/SystemInitializerCommon.cpp
@@ -80,7 +80,7 @@
     }
     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()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69166.225606.patch
Type: text/x-patch
Size: 699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191018/e60df19d/attachment-0001.bin>


More information about the lldb-commits mailing list