Clang 4 support

Linking will fail with the error: install_name_tool: no LC_RPATH load command with path: @executable_path/../lib This is not needed anymore, so this should fix it:

diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt
index 2074c58e..82c7abdd 100644
--- a/cpp/ycm/CMakeLists.txt
+++ b/cpp/ycm/CMakeLists.txt
@@ -367,7 +367,7 @@ if( LIBCLANG_TARGET )

-    if( APPLE )
+    if( 0 )
       # In OS X El Capitan, Apple introduced System Integrity Protection.
       # Amongst other things, this introduces features to the dynamic loader
       # (dyld) which cause it to "sanitise" (and complain about) embedded


curl -O
tar xvf clang+llvm-4.0.0-x86_64-apple-darwin.tar.xz
git clone
cd ycmd
git submodule update --init --recursive
# patch cpp/ycm/CMakeLists.txt
EXTRA_CMAKE_ARGS="-DPATH_TO_LLVM_ROOT=${PWD}/../clang+llvm-4.0.0-x86_64-apple-darwin" python --clang-completer

Visual Studio Code config sample

The extension:

Minimal config:

    "ycmd.path": "/Users/notsowise/pathto/ycmd",

Generate completion database

Pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to cmake on invocation. You might have to copy the compile_commands.json into the source tree.

Something like this:

mkdir build
cd build
cp compile_commands.json ../src
cd ../src
code .