diff -Nru rtags-2.31/CHANGELOG rtags-2.33/CHANGELOG --- rtags-2.31/CHANGELOG 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/CHANGELOG 2019-06-24 15:13:54.000000000 +0000 @@ -1,3 +1,9 @@ +2.31 +========================= +- Remove experimental lua support. It never worked correctly and I + doubt many people feel like it's the right language for the job if + we were to offer such a feature + 2.30 ========================= - A couple of fixes regarding references in template functions/classes diff -Nru rtags-2.31/cmake/FindLibClang.cmake rtags-2.33/cmake/FindLibClang.cmake --- rtags-2.31/cmake/FindLibClang.cmake 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/cmake/FindLibClang.cmake 2019-06-24 15:13:54.000000000 +0000 @@ -45,8 +45,11 @@ if (NOT LIBCLANG_LLVM_CONFIG_EXECUTABLE) set(LIBCLANG_LLVM_CONFIG_EXECUTABLE $ENV{LIBCLANG_LLVM_CONFIG_EXECUTABLE}) if (NOT LIBCLANG_LLVM_CONFIG_EXECUTABLE) + find_program(LIBCLANG_LLVM_CONFIG_EXECUTABLE "llvm-config") + endif () + if (NOT LIBCLANG_LLVM_CONFIG_EXECUTABLE) if (APPLE) - foreach(major RANGE 9 3) + foreach(major RANGE 20 3) foreach(minor RANGE 9 0) foreach(patch RANGE 9 0) message(STATUS "trying llvm-config llvm-config${major}${minor} in /usr/local/Cellar/llvm/${major}.${minor}.${patch}/bin") diff -Nru rtags-2.31/CMakeLists.txt rtags-2.33/CMakeLists.txt --- rtags-2.31/CMakeLists.txt 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/CMakeLists.txt 2019-06-24 15:13:54.000000000 +0000 @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 2.8.6) project(rtags) set(RTAGS_VERSION_MAJOR 2) -set(RTAGS_VERSION_MINOR 31) -set(RTAGS_VERSION_DATABASE 127) -set(RTAGS_VERSION_SOURCES_FILE 14) +set(RTAGS_VERSION_MINOR 33) +set(RTAGS_VERSION_DATABASE 128) +set(RTAGS_VERSION_SOURCES_FILE 15) set(RTAGS_VERSION ${RTAGS_VERSION_MAJOR}.${RTAGS_VERSION_MINOR}.${RTAGS_VERSION_DATABASE}) set(RTAGS_BINARY_ROOT_DIR ${PROJECT_BINARY_DIR}) @@ -106,6 +106,13 @@ else() message(WARNING "Nosetests executable not found! Excluding automated_tests from tests.") endif () + + if (EMACS_EXECUTABLE AND NOT RTAGS_NO_ELISP_FILES) + add_test(NAME elisptests COMMAND ${EMACS_EXECUTABLE} -batch -L ${CMAKE_BINARY_DIR}/src -l ${CMAKE_SOURCE_DIR}/tests/lisp/rtags-test.el -f ert-run-tests-batch-and-exit) + set_property(TEST elisptests PROPERTY ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_BINARY_DIR}/bin") + else() + message(WARNING "No suitable Emacs version found! Skipping elisp tests.") + endif () endif () feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL) diff -Nru rtags-2.31/debian/changelog rtags-2.33/debian/changelog --- rtags-2.31/debian/changelog 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/changelog 2019-07-26 21:06:22.000000000 +0000 @@ -1,3 +1,22 @@ +rtags (2.33-2) unstable; urgency=medium + + * cherry-pick updated changelog from upstream + * update d/copyright + * refine description of systemd unit files in README.Debian + * update Standards-Version to 4.4.0 (no changes needed) + + -- Denis Danilov Fri, 26 Jul 2019 23:06:22 +0200 + +rtags (2.33-1) unstable; urgency=medium + + * New upstream version 2.33 + * rebase patches + * do not run dh_auto_test in parallel + * drop --enable-compiler-manager from sbroot_test.pl + * give rdm some time to warm-up in autopkgtest + + -- Denis Danilov Mon, 22 Jul 2019 23:52:22 +0200 + rtags (2.31-1) unstable; urgency=medium * switch to pristine-tar diff -Nru rtags-2.31/debian/control rtags-2.33/debian/control --- rtags-2.31/debian/control 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/control 2019-07-26 21:06:22.000000000 +0000 @@ -11,7 +11,7 @@ llvm-7, pkg-config, zlib1g-dev -Standards-Version: 4.3.0 +Standards-Version: 4.4.0 Homepage: https://github.com/Andersbakken/rtags Vcs-Browser: https://salsa.debian.org/emacsen-team/rtags Vcs-Git: https://salsa.debian.org/emacsen-team/rtags.git diff -Nru rtags-2.31/debian/copyright rtags-2.33/debian/copyright --- rtags-2.31/debian/copyright 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/copyright 2019-07-26 21:06:22.000000000 +0000 @@ -3,14 +3,14 @@ Source: https://github.com/Andersbakken/rtags Files: * -Copyright: 2011-2018 Anders Bakken - 2011-2018 Jan Erik Hanssen - 2015-2017 Christian Schwarzgruber +Copyright: 2011-2019 Anders Bakken + 2011-2019 Jan Erik Hanssen + 2015-2019 Christian Schwarzgruber License: GPL-3+ Files: src/rct/* -Copyright: 2012-2016 Anders Bakken - 2012-2016 Jan Erik Hanssen +Copyright: 2012-2019 Anders Bakken + 2012-2018 Jan Erik Hanssen License: BSD-4-Clause Files: src/rct/cJSON/* @@ -26,7 +26,7 @@ License: Expat Files: debian/* -Copyright: 2018 Denis Danilov +Copyright: 2018-2019 Denis Danilov License: GPL-3+ License: GPL-3+ diff -Nru rtags-2.31/debian/patches/0001-fix-lintian-error-about-rpath.patch rtags-2.33/debian/patches/0001-fix-lintian-error-about-rpath.patch --- rtags-2.31/debian/patches/0001-fix-lintian-error-about-rpath.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0001-fix-lintian-error-about-rpath.patch 2019-07-26 21:06:22.000000000 +0000 @@ -8,10 +8,10 @@ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/FindLibClang.cmake b/cmake/FindLibClang.cmake -index f50b9ad..2fa09d9 100644 +index 3b1be57..e8a1086 100644 --- a/cmake/FindLibClang.cmake +++ b/cmake/FindLibClang.cmake -@@ -120,7 +120,7 @@ if (NOT LIBCLANG_LIBRARIES) +@@ -123,7 +123,7 @@ if (NOT LIBCLANG_LIBRARIES) else () find_library(LIBCLANG_LIBRARIES NAMES clang libclang) if (NOT EXISTS ${LIBCLANG_LIBRARIES}) @@ -21,7 +21,7 @@ endif () unset(LIBCLANG_LIB_HACK_CMAKECACHE_DOT_TEXT_BULLSHIT CACHE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index afdf32f..5934652 100644 +index c1cffbb..73e99a9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ diff -Nru rtags-2.31/debian/patches/0004-move-rp-to-lib-rtags.patch rtags-2.33/debian/patches/0004-move-rp-to-lib-rtags.patch --- rtags-2.31/debian/patches/0004-move-rp-to-lib-rtags.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0004-move-rp-to-lib-rtags.patch 2019-07-26 21:06:22.000000000 +0000 @@ -8,10 +8,10 @@ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 5934652..243605b 100644 +index 73e99a9..7d51ee7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -312,7 +312,8 @@ if (BASH_COMPLETION_FOUND) +@@ -313,7 +313,8 @@ if (BASH_COMPLETION_FOUND) install(FILES "${PROJECT_BINARY_DIR}/completions/rc" "${PROJECT_BINARY_DIR}/completions/rdm" DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR}) endif () @@ -22,7 +22,7 @@ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(FILES ../man/man7/rc.7 ../man/man7/rdm.7 DESTINATION share/man/man7/) diff --git a/src/rdm.cpp b/src/rdm.cpp -index a9ecec3..53b1655 100644 +index 6e57aef..182f9da 100644 --- a/src/rdm.cpp +++ b/src/rdm.cpp @@ -105,8 +105,8 @@ static inline Path defaultRP() diff -Nru rtags-2.31/debian/patches/0005-move-gcc-rtags-wrapper.sh-to-lib-rtags.patch rtags-2.33/debian/patches/0005-move-gcc-rtags-wrapper.sh-to-lib-rtags.patch --- rtags-2.31/debian/patches/0005-move-gcc-rtags-wrapper.sh-to-lib-rtags.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0005-move-gcc-rtags-wrapper.sh-to-lib-rtags.patch 2019-07-26 21:06:22.000000000 +0000 @@ -7,10 +7,10 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 243605b..274918a 100644 +index 7d51ee7..cf38dc0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -314,7 +314,7 @@ if (BASH_COMPLETION_FOUND) +@@ -315,7 +315,7 @@ if (BASH_COMPLETION_FOUND) endif () install(TARGETS rdm rc RUNTIME DESTINATION bin COMPONENT rtags) install(TARGETS rp RUNTIME DESTINATION lib/rtags COMPONENT rtags) diff -Nru rtags-2.31/debian/patches/0006-update-rc-manpage.patch rtags-2.33/debian/patches/0006-update-rc-manpage.patch --- rtags-2.31/debian/patches/0006-update-rc-manpage.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0006-update-rc-manpage.patch 2019-07-26 21:06:22.000000000 +0000 @@ -7,14 +7,14 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/man7/rc.7 b/man/man7/rc.7 -index 5fc4d0a..0a3d41e 100644 +index 6714dab..0d7f8c5 100644 --- a/man/man7/rc.7 +++ b/man/man7/rc.7 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. - .TH RC "7" "March 2019" "rc 2.31.127" "User Commands" + .TH RC "7" "June 2019" "rc 2.33.128" "User Commands" .SH NAME --rc \- manual page for rc 2.31.127 +-rc \- manual page for rc 2.33.128 +rc \- manual page for RTags client .SH SYNOPSIS rc [OPTION]... diff -Nru rtags-2.31/debian/patches/0007-update-rdm-manpage.patch rtags-2.33/debian/patches/0007-update-rdm-manpage.patch --- rtags-2.31/debian/patches/0007-update-rdm-manpage.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0007-update-rdm-manpage.patch 2019-07-26 21:06:22.000000000 +0000 @@ -7,14 +7,14 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man7/rdm.7 b/man/man7/rdm.7 -index 9a66f1e..ac271aa 100644 +index aa0e6ae..b9b56c2 100644 --- a/man/man7/rdm.7 +++ b/man/man7/rdm.7 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. - .TH RDM "7" "March 2019" "rdm 2.31.127" "User Commands" + .TH RDM "7" "June 2019" "rdm 2.33.128" "User Commands" .SH NAME --rdm \- manual page for rdm 2.31.127 +-rdm \- manual page for rdm 2.33.128 +rdm \- manual page for RTags server .SH SYNOPSIS rdm [OPTION]... diff -Nru rtags-2.31/debian/patches/0008-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch rtags-2.33/debian/patches/0008-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch --- rtags-2.31/debian/patches/0008-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0008-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,125 @@ +From: Denis Danilov +Date: Wed, 28 Nov 2018 22:52:13 +0100 +Subject: rename {rc,rdm} binaries to rtags-{rc,rdm} + +--- + bin/gcc-rtags-wrapper.sh | 2 +- + share/etc/services/system/rdm.service | 2 +- + src/CMakeLists.txt | 21 +++++++++++---------- + src/rtags-bash-completion.bash | 2 +- + src/rtags.el | 4 ++-- + 5 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/bin/gcc-rtags-wrapper.sh b/bin/gcc-rtags-wrapper.sh +index 60ec868..c49e882 100755 +--- a/bin/gcc-rtags-wrapper.sh ++++ b/bin/gcc-rtags-wrapper.sh +@@ -34,7 +34,7 @@ fi + + # tup support end + +-rc=$(which rc) ++rc=$(which rtags-rc) + for i in $(which -a "$(basename "$0")"); do + filename="$i" + max=10 +diff --git a/share/etc/services/system/rdm.service b/share/etc/services/system/rdm.service +index e09986b..ad87f03 100644 +--- a/share/etc/services/system/rdm.service ++++ b/share/etc/services/system/rdm.service +@@ -5,6 +5,6 @@ Requires=rdm.socket + + [Service] + Type=simple +-ExecStart=/usr/bin/rdm --verbose --inactivity-timeout 300 --log-flush ++ExecStart=/usr/bin/rtags-rdm --verbose --inactivity-timeout 300 --log-flush + Nice=19 + CPUSchedulingPolicy=idle +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index cf38dc0..c92be24 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -223,11 +223,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${RTAGS_BINARY_ROOT_DIR}/bin) + + # RCT_LIBRARIES and stdc++ library must be at the end + set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES} rct) +-add_executable(rc rc.cpp) +-target_link_libraries(rc ${RTAGS_LIBRARIES}) ++add_executable(rtags-rc rc.cpp) ++target_link_libraries(rtags-rc ${RTAGS_LIBRARIES}) + +-add_executable(rdm rdm.cpp) +-target_link_libraries(rdm ${RTAGS_LIBRARIES}) ++add_executable(rtags-rdm rdm.cpp) ++target_link_libraries(rtags-rdm ${RTAGS_LIBRARIES}) + + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + +@@ -235,7 +235,7 @@ add_executable(rp rp.cpp) + target_link_libraries(rp ${RTAGS_LIBRARIES}) + + if (CYGWIN) +- EnsureLibraries(rdm rct) ++ EnsureLibraries(rtags-rdm rct) + endif () + + if (EMACS) +@@ -304,20 +304,21 @@ install(CODE "message(\"Installing rtags...\")") + include(BashCompletion) + if (BASH_COMPLETION_FOUND) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/completions") +- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rc +- COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rdm ++ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rtags-rc ++ COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rtags-rdm + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/completions") + install(FILES rtags-bash-completion.bash DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR} + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + RENAME rtags) +- install(FILES "${PROJECT_BINARY_DIR}/completions/rc" "${PROJECT_BINARY_DIR}/completions/rdm" ++ install(FILES "${PROJECT_BINARY_DIR}/completions/rtags-rc" "${PROJECT_BINARY_DIR}/completions/rtags-rdm" + DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR}) + endif () +-install(TARGETS rdm rc RUNTIME DESTINATION bin COMPONENT rtags) ++install(TARGETS rtags-rdm rtags-rc RUNTIME DESTINATION bin COMPONENT rtags) + install(TARGETS rp RUNTIME DESTINATION lib/rtags COMPONENT rtags) + install(FILES ../bin/gcc-rtags-wrapper.sh DESTINATION lib/rtags + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +-install(FILES ../man/man7/rc.7 ../man/man7/rdm.7 DESTINATION share/man/man7/) ++install(FILES ../man/man7/rc.7 DESTINATION share/man/man7/ RENAME rtags-rc.7) ++install(FILES ../man/man7/rdm.7 DESTINATION share/man/man7/ RENAME rtags-rdm.7) + + if (UNIX AND NOT ${SKIP_CTEST}) + install(CODE "execute_process(COMMAND ctest)") +diff --git a/src/rtags-bash-completion.bash b/src/rtags-bash-completion.bash +index 7a3a2c5..a555e87 100644 +--- a/src/rtags-bash-completion.bash ++++ b/src/rtags-bash-completion.bash +@@ -56,7 +56,7 @@ _rtags () + COMPREPLY=($(compgen -W "$value_opts $non_value_opts" -- -$cur)) + fi + } +-complete -F _rtags -o default rc rdm ++complete -F _rtags -o default rtags-rc rtags-rdm + + if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then + complete -F _rtags -o default rc.exe rdm.exe +diff --git a/src/rtags.el b/src/rtags.el +index aa00d77..99b75a7 100644 +--- a/src/rtags.el ++++ b/src/rtags.el +@@ -507,12 +507,12 @@ return t if RTags is allowed to modify this file." + :type '(choice (const :tag "Unset" nil) integer) + :safe 'integerp) + +-(defcustom rtags-rc-binary-name "rc" ++(defcustom rtags-rc-binary-name "rtags-rc" + "Name of rc binary file." + :type 'string + :risky t) + +-(defcustom rtags-rdm-binary-name "rdm" ++(defcustom rtags-rdm-binary-name "rtags-rdm" + "Name of rdm binary file." + :type 'string + :risky t) diff -Nru rtags-2.31/debian/patches/0009-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch rtags-2.33/debian/patches/0009-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch --- rtags-2.31/debian/patches/0009-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0009-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -From: Denis Danilov -Date: Wed, 28 Nov 2018 22:52:13 +0100 -Subject: rename {rc,rdm} binaries to rtags-{rc,rdm} - ---- - bin/gcc-rtags-wrapper.sh | 2 +- - share/etc/services/system/rdm.service | 2 +- - src/CMakeLists.txt | 21 +++++++++++---------- - src/rtags-bash-completion.bash | 2 +- - src/rtags.el | 4 ++-- - 5 files changed, 16 insertions(+), 15 deletions(-) - -diff --git a/bin/gcc-rtags-wrapper.sh b/bin/gcc-rtags-wrapper.sh -index 60ec868..c49e882 100755 ---- a/bin/gcc-rtags-wrapper.sh -+++ b/bin/gcc-rtags-wrapper.sh -@@ -34,7 +34,7 @@ fi - - # tup support end - --rc=$(which rc) -+rc=$(which rtags-rc) - for i in $(which -a "$(basename "$0")"); do - filename="$i" - max=10 -diff --git a/share/etc/services/system/rdm.service b/share/etc/services/system/rdm.service -index e09986b..ad87f03 100644 ---- a/share/etc/services/system/rdm.service -+++ b/share/etc/services/system/rdm.service -@@ -5,6 +5,6 @@ Requires=rdm.socket - - [Service] - Type=simple --ExecStart=/usr/bin/rdm --verbose --inactivity-timeout 300 --log-flush -+ExecStart=/usr/bin/rtags-rdm --verbose --inactivity-timeout 300 --log-flush - Nice=19 - CPUSchedulingPolicy=idle -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 274918a..9e62222 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -222,11 +222,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${RTAGS_BINARY_ROOT_DIR}/bin) - - # RCT_LIBRARIES and stdc++ library must be at the end - set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES} rct) --add_executable(rc rc.cpp) --target_link_libraries(rc ${RTAGS_LIBRARIES}) -+add_executable(rtags-rc rc.cpp) -+target_link_libraries(rtags-rc ${RTAGS_LIBRARIES}) - --add_executable(rdm rdm.cpp) --target_link_libraries(rdm ${RTAGS_LIBRARIES}) -+add_executable(rtags-rdm rdm.cpp) -+target_link_libraries(rtags-rdm ${RTAGS_LIBRARIES}) - - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) - -@@ -234,7 +234,7 @@ add_executable(rp rp.cpp) - target_link_libraries(rp ${RTAGS_LIBRARIES}) - - if (CYGWIN) -- EnsureLibraries(rdm rct) -+ EnsureLibraries(rtags-rdm rct) - endif () - - if (EMACS) -@@ -303,20 +303,21 @@ install(CODE "message(\"Installing rtags...\")") - include(BashCompletion) - if (BASH_COMPLETION_FOUND) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/completions") -- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rc -- COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rdm -+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rtags-rc -+ COMMAND ${CMAKE_COMMAND} -E create_symlink rtags rtags-rdm - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/completions") - install(FILES rtags-bash-completion.bash DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR} - PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ - RENAME rtags) -- install(FILES "${PROJECT_BINARY_DIR}/completions/rc" "${PROJECT_BINARY_DIR}/completions/rdm" -+ install(FILES "${PROJECT_BINARY_DIR}/completions/rtags-rc" "${PROJECT_BINARY_DIR}/completions/rtags-rdm" - DESTINATION ${BASH_COMPLETION_COMPLETIONSDIR}) - endif () --install(TARGETS rdm rc RUNTIME DESTINATION bin COMPONENT rtags) -+install(TARGETS rtags-rdm rtags-rc RUNTIME DESTINATION bin COMPONENT rtags) - install(TARGETS rp RUNTIME DESTINATION lib/rtags COMPONENT rtags) - install(FILES ../bin/gcc-rtags-wrapper.sh DESTINATION lib/rtags - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) --install(FILES ../man/man7/rc.7 ../man/man7/rdm.7 DESTINATION share/man/man7/) -+install(FILES ../man/man7/rc.7 DESTINATION share/man/man7/ RENAME rtags-rc.7) -+install(FILES ../man/man7/rdm.7 DESTINATION share/man/man7/ RENAME rtags-rdm.7) - - if (UNIX AND NOT ${SKIP_CTEST}) - install(CODE "execute_process(COMMAND ctest)") -diff --git a/src/rtags-bash-completion.bash b/src/rtags-bash-completion.bash -index 7a3a2c5..a555e87 100644 ---- a/src/rtags-bash-completion.bash -+++ b/src/rtags-bash-completion.bash -@@ -56,7 +56,7 @@ _rtags () - COMPREPLY=($(compgen -W "$value_opts $non_value_opts" -- -$cur)) - fi - } --complete -F _rtags -o default rc rdm -+complete -F _rtags -o default rtags-rc rtags-rdm - - if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then - complete -F _rtags -o default rc.exe rdm.exe -diff --git a/src/rtags.el b/src/rtags.el -index d29fa35..e9be07b 100644 ---- a/src/rtags.el -+++ b/src/rtags.el -@@ -552,13 +552,13 @@ return t if RTags is allowed to modify this file." - :type '(choice (const :tag "Unset" nil) integer) - :safe 'integerp) - --(defcustom rtags-rc-binary-name "rc" -+(defcustom rtags-rc-binary-name "rtags-rc" - "Name of rc binary file." - :group 'rtags - :type 'string - :risky t) - --(defcustom rtags-rdm-binary-name "rdm" -+(defcustom rtags-rdm-binary-name "rtags-rdm" - "Name of rdm binary file." - :group 'rtags - :type 'string diff -Nru rtags-2.31/debian/patches/0009-rename-rc-rdm-in-the-man-pages.patch rtags-2.33/debian/patches/0009-rename-rc-rdm-in-the-man-pages.patch --- rtags-2.31/debian/patches/0009-rename-rc-rdm-in-the-man-pages.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0009-rename-rc-rdm-in-the-man-pages.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,203 @@ +From: Denis Danilov +Date: Sat, 1 Dec 2018 12:34:00 +0100 +Subject: rename {rc,rdm} in the man pages + +--- + man/man7/rc.7 | 28 ++++++++++++++-------------- + man/man7/rdm.7 | 26 ++++++++++++++------------ + 2 files changed, 28 insertions(+), 26 deletions(-) + +diff --git a/man/man7/rc.7 b/man/man7/rc.7 +index 0d7f8c5..eb12a03 100644 +--- a/man/man7/rc.7 ++++ b/man/man7/rc.7 +@@ -1,11 +1,11 @@ + .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +-.TH RC "7" "June 2019" "rc 2.33.128" "User Commands" ++.TH RTAGS-RC "7" "June 2019" "rc 2.33.128" "User Commands" + .SH NAME +-rc \- manual page for RTags client ++rtags-rc \- manual page for RTags client + .SH SYNOPSIS +-rc [OPTION]... ++rtags-rc [OPTION]... + .SH DESCRIPTION +-rc is the RTags client application. ++rtags-rc is the RTags client application. + .PP + .SH OPTIONS + .TP +@@ -35,7 +35,7 @@ Don't load any rc files. + Tell server to shut down with optional exit code as argument. + .TP + \fB\-\-connect\-timeout\fR [arg] +-Timeout for connecting to rdm in ms (default 1000). ++Timeout for connecting to rtags-rdm in ms (default 1000). + .SS "Project management:" + .TP + \fB\-\-clear\fR|\-C +@@ -52,7 +52,7 @@ Set or query current job count. (Prefix with l to set low\-priority\-job\-count) + .SS "Indexing commands:" + .TP + \fB\-\-compile\fR|\-c [optional] +-Pass compilation arguments to rdm. ++Pass compilation arguments to rtags-rdm. + .TP + \fB\-\-guess\-flags\fR + Guess compile flags (used with \fB\-c\fR). +@@ -83,7 +83,7 @@ Find symbols matching arg. + Get cursor info for this location. + .TP + \fB\-\-status\fR|\-s [optional] +-Dump status of rdm. Arg can be symbols or symbolNames. ++Dump status of rtags-rdm. Arg can be symbols or symbolNames. + .TP + \fB\-\-diagnose\fR [arg] + Resend diagnostics for file. +@@ -134,7 +134,7 @@ Dump file maps for file. + Generate a test for a given source file. + .TP + \fB\-\-rdm\-log\fR|\-g +-Receive logs from rdm. ++Receive logs from rtags-rdm. + .TP + \fB\-\-fixits\fR [arg] + Get fixits for file. +@@ -164,7 +164,7 @@ Dump dependencies for all source files [(includes, included\-by, depends\-on, de + Reload file manager. + .TP + \fB\-\-man\fR +-Output XML for xmltoman to generate man page for rc :\-) ++Output XML for xmltoman to generate man page for rtags-rc :\-) + .TP + \fB\-\-code\-complete\-at\fR|\-l [arg] + Code complete at location: arg is file:line:col. +@@ -261,7 +261,7 @@ Output json. + Output json diagnostics with skipped ranges. + .TP + \fB\-\-diagnostics\fR|\-m +-Receive async formatted diagnostics from rdm. ++Receive async formatted diagnostics from rtags-rdm. + .TP + \fB\-\-match\-regexp\fR|\-Z + Treat various text patterns as regexps (\fB\-P\fR, \fB\-i\fR, \fB\-V\fR, \fB\-F\fR). +@@ -306,7 +306,7 @@ Include cursor kind in \fB\-\-find\-symbols\fR output. + Include display name in \fB\-\-find\-symbols\fR output. + .TP + \fB\-\-current\-file\fR [arg] +-Pass along which file is being edited to give rdm a better chance at picking the right project. ++Pass along which file is being edited to give rtags-rdm a better chance at picking the right project. + .TP + \fB\-\-declaration\-only\fR|\-G + Filter out definitions (unless inline). +@@ -339,7 +339,7 @@ For \fB\-\-source\fR, print pwd for compile command on the first line. + For \fB\-\-dump\-file\fR, also dump dependencies. + .TP + \fB\-\-silent\-query\fR +-Don't log this request in rdm. ++Don't log this request in rtags-rdm. + .TP + \fB\-\-synchronous\-completions\fR + Wait for completion results and print them to stdout. +@@ -381,7 +381,7 @@ Don't wait for synchronous completion if the translation unit has to be created. + Filter out code completion results that don't start with this prefix. + .TP + \fB\-\-code\-completion\-enabled\fR|\-b +-Inform rdm that we're code\-completing. Use with \fB\-\-diagnose\fR ++Inform rtags-rdm that we're code\-completing. Use with \fB\-\-diagnose\fR + .TP + \fB\-\-no\-spell\-checking\fR + Don't produce spell check info in diagnostics. +@@ -398,4 +398,4 @@ Dump include path for symbol. + \fB\-\-max\-depth\fR [arg] + Max search depth. Used for \fB\-\-include\-path\fR. + .SH "SEE ALSO" +-rdm(7) ++rtags-rdm(7) +diff --git a/man/man7/rdm.7 b/man/man7/rdm.7 +index b9b56c2..a02961a 100644 +--- a/man/man7/rdm.7 ++++ b/man/man7/rdm.7 +@@ -1,9 +1,9 @@ + .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +-.TH RDM "7" "June 2019" "rdm 2.33.128" "User Commands" ++.TH RTAGS-RDM "7" "June 2019" "rdm 2.33.128" "User Commands" + .SH NAME +-rdm \- manual page for RTags server ++rtags-rdm \- manual page for RTags server + .SH SYNOPSIS +-rdm [OPTION]... ++rtags-rdm [OPTION]... + .SH DESCRIPTION + RTags is a client/server application that indexes C/C++ code and keeps + a persistent file\-based database of references, declarations, +@@ -91,7 +91,9 @@ Disable signal handler to dump stack for crashes. + No logging to stdout/stderr. + .TP + \fB\-\-exclude\-filter\fR|\-X [arg] +-Files to exclude from rdm, default "*/CMakeFiles/*;*/cmake*/Modules/*;*/conftest.c*;/tmp/*;/private/tmp/*;/private/var/*". ++.nf ++Files to exclude from rtags-rdm, default "*/CMakeFiles/*;*/cmake*/Modules/*;*/conftest.c*;/tmp/*;/private/tmp/*;/private/var/*". ++.fi + .TP + \fB\-\-socket\-file\fR|\-n [arg] + Use this file for the server socket (default ~/.rdm). +@@ -106,7 +108,7 @@ Disregard any clang fixit that looks like it's trying to fix format for printf a + Set error limit to argument (\fB\-ferror\-limit=\fR{arg} (default 50). + .TP + \fB\-\-block\-argument\fR|\-G [arg] +-Block this argument from being passed to clang. E.g. rdm \fB\-\-block\-argument\fR \fB\-fno\-inline\fR ++Block this argument from being passed to clang. E.g. rtags-rdm \fB\-\-block\-argument\fR \fB\-fno\-inline\fR + .TP + \fB\-\-no\-spell\-checking\fR|\-l + Don't pass \fB\-fspell\-checking\fR. +@@ -139,10 +141,10 @@ Timeout for rp visitfile commands in ms (0 means no timeout) (default 60000). + Timeout for rp indexer\-message in ms (0 means no timeout) (default 60000). + .TP + \fB\-\-rp\-connect\-timeout\fR|\-O [arg] +-Timeout for connection from rp to rdm in ms (0 means no timeout) (default 0). ++Timeout for connection from rp to rtags-rdm in ms (0 means no timeout) (default 0). + .TP + \fB\-\-rp\-connect\-attempts\fR [arg] +-Number of times rp attempts to connect to rdm before giving up. (default 3). ++Number of times rp attempts to connect to rtags-rdm before giving up. (default 3). + .TP + \fB\-\-rp\-nice\-value\fR|\-a [arg] + Nice value to use for rp (nice(2)) (default is no nicing). +@@ -157,10 +159,10 @@ Make rp log to syslog. + Start out suspended (no reindexing enabled). + .TP + \fB\-\-separate\-debug\-and\-release\fR|\-E +-Normally rdm doesn't consider release and debug as different builds. Pass this if you want it to. ++Normally rtags-rdm doesn't consider release and debug as different builds. Pass this if you want it to. + .TP + \fB\-\-separate\-32\-bit\-and\-64\-bit\fR +-Normally rdm doesn't consider \fB\-m32\fR and \fB\-m64\fR as different builds. Pass this if you want it to. ++Normally rtags-rdm doesn't consider \fB\-m32\fR and \fB\-m64\fR as different builds. Pass this if you want it to. + .HP + \fB\-\-ignore\-include\-path\-differences\-in\-usr\fR Don't consider sources that only differ in includepaths within \fI\,/usr\/\fP (not including /usr/home/) as different builds. + .TP +@@ -210,7 +212,7 @@ Max files to cache per query (Should not exceed maximum number of open file desc + Don't use a file system watcher for filemanager. + .TP + \fB\-\-no\-filemanager\fR +-Don't scan project directory for files. (rc \fB\-P\fR won't work). ++Don't scan project directory for files. (rtags-rc \fB\-P\fR won't work). + .TP + \fB\-\-no\-file\-lock\fR + Disable file locking. Not entirely safe but might improve performance on certain systems. +@@ -228,7 +230,7 @@ Use arg to transform arguments. [arg] should be executable with (execv(3)). + Don't parse/store doxygen comments. + .TP + \fB\-\-inactivity\-timeout\fR [arg] +-Time in seconds after which rdm will quit if there's been no activity (N.B., once rdm has quit, something will need to re\-run it!). ++Time in seconds after which rtags-rdm will quit if there's been no activity (N.B., once rtags-rdm has quit, something will need to re\-run it!). + .TP + \fB\-\-daemon\fR + Run as daemon (detach from terminal). +@@ -272,4 +274,4 @@ Use this file (instead of ~/.rdmrc). + \fB\-\-no\-rc\fR|\-N + Don't load any rc files. + .SH "SEE ALSO" +-rc(7) ++rtags-rc(7) diff -Nru rtags-2.31/debian/patches/0010-adjust-sbroot_test.pl-to-renamed-binaries.patch rtags-2.33/debian/patches/0010-adjust-sbroot_test.pl-to-renamed-binaries.patch --- rtags-2.31/debian/patches/0010-adjust-sbroot_test.pl-to-renamed-binaries.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0010-adjust-sbroot_test.pl-to-renamed-binaries.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,21 @@ +From: Denis Danilov +Date: Sun, 24 Feb 2019 18:23:12 +0100 +Subject: adjust sbroot_test.pl to renamed binaries + +--- + tests/sbroot/sbroot_test.pl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/sbroot/sbroot_test.pl b/tests/sbroot/sbroot_test.pl +index baaee19..e9c3bfc 100755 +--- a/tests/sbroot/sbroot_test.pl ++++ b/tests/sbroot/sbroot_test.pl +@@ -191,7 +191,7 @@ sub ProcessArgsAndSetupSandbox { + + (my $me = $FindBin::Script) =~ s/\.pl$//; + +- my @progs = ("$rtagsBin/rdm","$rtagsBin/rc"); ++ my @progs = ("$rtagsBin/rtags-rdm","$rtagsBin/rtags-rc"); + foreach my $p (@progs) { + if (! -x $p) { + die "$p doesn't exist or isn't executable"; diff -Nru rtags-2.31/debian/patches/0010-rename-rc-rdm-in-the-man-pages.patch rtags-2.33/debian/patches/0010-rename-rc-rdm-in-the-man-pages.patch --- rtags-2.31/debian/patches/0010-rename-rc-rdm-in-the-man-pages.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0010-rename-rc-rdm-in-the-man-pages.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -From: Denis Danilov -Date: Sat, 1 Dec 2018 12:34:00 +0100 -Subject: rename {rc,rdm} in the man pages - ---- - man/man7/rc.7 | 28 ++++++++++++++-------------- - man/man7/rdm.7 | 26 ++++++++++++++------------ - 2 files changed, 28 insertions(+), 26 deletions(-) - -diff --git a/man/man7/rc.7 b/man/man7/rc.7 -index 0a3d41e..db70172 100644 ---- a/man/man7/rc.7 -+++ b/man/man7/rc.7 -@@ -1,11 +1,11 @@ - .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. --.TH RC "7" "March 2019" "rc 2.31.127" "User Commands" -+.TH RTAGS-RC "7" "March 2019" "rc 2.31.127" "User Commands" - .SH NAME --rc \- manual page for RTags client -+rtags-rc \- manual page for RTags client - .SH SYNOPSIS --rc [OPTION]... -+rtags-rc [OPTION]... - .SH DESCRIPTION --rc is the RTags client application. -+rtags-rc is the RTags client application. - .PP - .SH OPTIONS - .TP -@@ -35,7 +35,7 @@ Don't load any rc files. - Tell server to shut down with optional exit code as argument. - .TP - \fB\-\-connect\-timeout\fR [arg] --Timeout for connecting to rdm in ms (default 1000). -+Timeout for connecting to rtags-rdm in ms (default 1000). - .SS "Project management:" - .TP - \fB\-\-clear\fR|\-C -@@ -52,7 +52,7 @@ Set or query current job count. (Prefix with l to set low\-priority\-job\-count) - .SS "Indexing commands:" - .TP - \fB\-\-compile\fR|\-c [optional] --Pass compilation arguments to rdm. -+Pass compilation arguments to rtags-rdm. - .TP - \fB\-\-guess\-flags\fR - Guess compile flags (used with \fB\-c\fR). -@@ -83,7 +83,7 @@ Find symbols matching arg. - Get cursor info for this location. - .TP - \fB\-\-status\fR|\-s [optional] --Dump status of rdm. Arg can be symbols or symbolNames. -+Dump status of rtags-rdm. Arg can be symbols or symbolNames. - .TP - \fB\-\-diagnose\fR [arg] - Resend diagnostics for file. -@@ -134,7 +134,7 @@ Dump file maps for file. - Generate a test for a given source file. - .TP - \fB\-\-rdm\-log\fR|\-g --Receive logs from rdm. -+Receive logs from rtags-rdm. - .TP - \fB\-\-fixits\fR [arg] - Get fixits for file. -@@ -164,7 +164,7 @@ Dump dependencies for all source files [(includes, included\-by, depends\-on, de - Reload file manager. - .TP - \fB\-\-man\fR --Output XML for xmltoman to generate man page for rc :\-) -+Output XML for xmltoman to generate man page for rtags-rc :\-) - .TP - \fB\-\-code\-complete\-at\fR|\-l [arg] - Code complete at location: arg is file:line:col. -@@ -261,7 +261,7 @@ Output json. - Output json diagnostics with skipped ranges. - .TP - \fB\-\-diagnostics\fR|\-m --Receive async formatted diagnostics from rdm. -+Receive async formatted diagnostics from rtags-rdm. - .TP - \fB\-\-match\-regexp\fR|\-Z - Treat various text patterns as regexps (\fB\-P\fR, \fB\-i\fR, \fB\-V\fR, \fB\-F\fR). -@@ -306,7 +306,7 @@ Include cursor kind in \fB\-\-find\-symbols\fR output. - Include display name in \fB\-\-find\-symbols\fR output. - .TP - \fB\-\-current\-file\fR [arg] --Pass along which file is being edited to give rdm a better chance at picking the right project. -+Pass along which file is being edited to give rtags-rdm a better chance at picking the right project. - .TP - \fB\-\-declaration\-only\fR|\-G - Filter out definitions (unless inline). -@@ -339,7 +339,7 @@ For \fB\-\-source\fR, print pwd for compile command on the first line. - For \fB\-\-dump\-file\fR, also dump dependencies. - .TP - \fB\-\-silent\-query\fR --Don't log this request in rdm. -+Don't log this request in rtags-rdm. - .TP - \fB\-\-synchronous\-completions\fR - Wait for completion results and print them to stdout. -@@ -381,7 +381,7 @@ Don't wait for synchronous completion if the translation unit has to be created. - Filter out code completion results that don't start with this prefix. - .TP - \fB\-\-code\-completion\-enabled\fR|\-b --Inform rdm that we're code\-completing. Use with \fB\-\-diagnose\fR -+Inform rtags-rdm that we're code\-completing. Use with \fB\-\-diagnose\fR - .TP - \fB\-\-no\-spell\-checking\fR - Don't produce spell check info in diagnostics. -@@ -392,4 +392,4 @@ Include symbols for tokens. - \fB\-\-no\-realpath\fR - Don't resolve paths using realpath(3). - .SH "SEE ALSO" --rdm(7) -+rtags-rdm(7) -diff --git a/man/man7/rdm.7 b/man/man7/rdm.7 -index ac271aa..cdce549 100644 ---- a/man/man7/rdm.7 -+++ b/man/man7/rdm.7 -@@ -1,9 +1,9 @@ - .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. --.TH RDM "7" "March 2019" "rdm 2.31.127" "User Commands" -+.TH RTAGS-RDM "7" "March 2019" "rdm 2.31.127" "User Commands" - .SH NAME --rdm \- manual page for RTags server -+rtags-rdm \- manual page for RTags server - .SH SYNOPSIS --rdm [OPTION]... -+rtags-rdm [OPTION]... - .SH DESCRIPTION - RTags is a client/server application that indexes C/C++ code and keeps - a persistent file\-based database of references, declarations, -@@ -91,7 +91,9 @@ Disable signal handler to dump stack for crashes. - No logging to stdout/stderr. - .TP - \fB\-\-exclude\-filter\fR|\-X [arg] --Files to exclude from rdm, default "*/CMakeFiles/*;*/cmake*/Modules/*;*/conftest.c*;/tmp/*;/private/tmp/*;/private/var/*". -+.nf -+Files to exclude from rtags-rdm, default "*/CMakeFiles/*;*/cmake*/Modules/*;*/conftest.c*;/tmp/*;/private/tmp/*;/private/var/*". -+.fi - .TP - \fB\-\-socket\-file\fR|\-n [arg] - Use this file for the server socket (default ~/.rdm). -@@ -106,7 +108,7 @@ Disregard any clang fixit that looks like it's trying to fix format for printf a - Set error limit to argument (\fB\-ferror\-limit=\fR{arg} (default 50). - .TP - \fB\-\-block\-argument\fR|\-G [arg] --Block this argument from being passed to clang. E.g. rdm \fB\-\-block\-argument\fR \fB\-fno\-inline\fR -+Block this argument from being passed to clang. E.g. rtags-rdm \fB\-\-block\-argument\fR \fB\-fno\-inline\fR - .TP - \fB\-\-no\-spell\-checking\fR|\-l - Don't pass \fB\-fspell\-checking\fR. -@@ -139,10 +141,10 @@ Timeout for rp visitfile commands in ms (0 means no timeout) (default 60000). - Timeout for rp indexer\-message in ms (0 means no timeout) (default 60000). - .TP - \fB\-\-rp\-connect\-timeout\fR|\-O [arg] --Timeout for connection from rp to rdm in ms (0 means no timeout) (default 0). -+Timeout for connection from rp to rtags-rdm in ms (0 means no timeout) (default 0). - .TP - \fB\-\-rp\-connect\-attempts\fR [arg] --Number of times rp attempts to connect to rdm before giving up. (default 3). -+Number of times rp attempts to connect to rtags-rdm before giving up. (default 3). - .TP - \fB\-\-rp\-nice\-value\fR|\-a [arg] - Nice value to use for rp (nice(2)) (default is no nicing). -@@ -157,10 +159,10 @@ Make rp log to syslog. - Start out suspended (no reindexing enabled). - .TP - \fB\-\-separate\-debug\-and\-release\fR|\-E --Normally rdm doesn't consider release and debug as different builds. Pass this if you want it to. -+Normally rtags-rdm doesn't consider release and debug as different builds. Pass this if you want it to. - .TP - \fB\-\-separate\-32\-bit\-and\-64\-bit\fR --Normally rdm doesn't consider \fB\-m32\fR and \fB\-m64\fR as different builds. Pass this if you want it to. -+Normally rtags-rdm doesn't consider \fB\-m32\fR and \fB\-m64\fR as different builds. Pass this if you want it to. - .HP - \fB\-\-ignore\-include\-path\-differences\-in\-usr\fR Don't consider sources that only differ in includepaths within \fI\,/usr\/\fP (not including /usr/home/) as different builds. - .TP -@@ -210,7 +212,7 @@ Max files to cache per query (Should not exceed maximum number of open file desc - Don't use a file system watcher for filemanager. - .TP - \fB\-\-no\-filemanager\fR --Don't scan project directory for files. (rc \fB\-P\fR won't work). -+Don't scan project directory for files. (rtags-rc \fB\-P\fR won't work). - .TP - \fB\-\-no\-file\-lock\fR - Disable file locking. Not entirely safe but might improve performance on certain systems. -@@ -228,7 +230,7 @@ Use arg to transform arguments. [arg] should be executable with (execv(3)). - Don't parse/store doxygen comments. - .TP - \fB\-\-inactivity\-timeout\fR [arg] --Time in seconds after which rdm will quit if there's been no activity (N.B., once rdm has quit, something will need to re\-run it!). -+Time in seconds after which rtags-rdm will quit if there's been no activity (N.B., once rtags-rdm has quit, something will need to re\-run it!). - .TP - \fB\-\-daemon\fR - Run as daemon (detach from terminal). -@@ -272,4 +274,4 @@ Use this file (instead of ~/.rdmrc). - \fB\-\-no\-rc\fR|\-N - Don't load any rc files. - .SH "SEE ALSO" --rc(7) -+rtags-rc(7) diff -Nru rtags-2.31/debian/patches/0011-adjust-sbroot_test.pl-to-renamed-binaries.patch rtags-2.33/debian/patches/0011-adjust-sbroot_test.pl-to-renamed-binaries.patch --- rtags-2.31/debian/patches/0011-adjust-sbroot_test.pl-to-renamed-binaries.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0011-adjust-sbroot_test.pl-to-renamed-binaries.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Denis Danilov -Date: Sun, 24 Feb 2019 18:23:12 +0100 -Subject: adjust sbroot_test.pl to renamed binaries - ---- - tests/sbroot/sbroot_test.pl | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/sbroot/sbroot_test.pl b/tests/sbroot/sbroot_test.pl -index 2b2f799..21710d0 100755 ---- a/tests/sbroot/sbroot_test.pl -+++ b/tests/sbroot/sbroot_test.pl -@@ -191,7 +191,7 @@ sub ProcessArgsAndSetupSandbox { - - (my $me = $FindBin::Script) =~ s/\.pl$//; - -- my @progs = ("$rtagsBin/rdm","$rtagsBin/rc"); -+ my @progs = ("$rtagsBin/rtags-rdm","$rtagsBin/rtags-rc"); - foreach my $p (@progs) { - if (! -x $p) { - die "$p doesn't exist or isn't executable"; diff -Nru rtags-2.31/debian/patches/0011-make-build-reproducible.patch rtags-2.33/debian/patches/0011-make-build-reproducible.patch --- rtags-2.31/debian/patches/0011-make-build-reproducible.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0011-make-build-reproducible.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,21 @@ +From: Denis Danilov +Date: Wed, 6 Mar 2019 21:51:04 +0100 +Subject: make build reproducible + +--- + src/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c92be24..a103d03 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -141,7 +141,7 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug") + endif () + + add_definitions( +- "-DRTAGS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" ++ "-DRTAGS_SOURCE_DIR=." + "-DCLANG_LIBDIR=${LIBCLANG_LIBDIR}" + "-DCLANG_VERSION=${LIBCLANG_VERSION_STRING}" + "-DOS_${CMAKE_SYSTEM_NAME}" diff -Nru rtags-2.31/debian/patches/0012-make-build-reproducible.patch rtags-2.33/debian/patches/0012-make-build-reproducible.patch --- rtags-2.31/debian/patches/0012-make-build-reproducible.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0012-make-build-reproducible.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Denis Danilov -Date: Wed, 6 Mar 2019 21:51:04 +0100 -Subject: make build reproducible - ---- - src/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 9e62222..ddea51c 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -141,7 +141,7 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug") - endif () - - add_definitions( -- "-DRTAGS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" -+ "-DRTAGS_SOURCE_DIR=." - "-DCLANG_LIBDIR=${LIBCLANG_LIBDIR}" - "-DCLANG_VERSION=${LIBCLANG_VERSION_STRING}" - "-DOS_${CMAKE_SYSTEM_NAME}" diff -Nru rtags-2.31/debian/patches/0012-run-nosetests-with-system-binaries.patch rtags-2.33/debian/patches/0012-run-nosetests-with-system-binaries.patch --- rtags-2.31/debian/patches/0012-run-nosetests-with-system-binaries.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0012-run-nosetests-with-system-binaries.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,76 @@ +From: Denis Danilov +Date: Wed, 13 Mar 2019 22:51:47 +0100 +Subject: run nosetests with system binaries + +--- + tests/automated/test_runner.py | 23 ++++++----------------- + 1 file changed, 6 insertions(+), 17 deletions(-) + +diff --git a/tests/automated/test_runner.py b/tests/automated/test_runner.py +index cc83c16..8763e95 100644 +--- a/tests/automated/test_runner.py ++++ b/tests/automated/test_runner.py +@@ -37,20 +37,14 @@ except NameError: + + sys.dont_write_bytecode = True + os.environ["PYTHONDONTWRITEBYTECODE"] = "1" +-SOCKET_FILE = "/var/tmp/rdm_dev" + +-try: +- RDM = os.path.join(os.environ['RTAGS_BINARY_DIR'], 'rdm') +- RC = os.path.join(os.environ['RTAGS_BINARY_DIR'], 'rc') +-except KeyError: +- sys.stderr.write("You need to set RTAGS_BINARY_DIR environment variable.\n") +- sys.exit(1) ++RC = 'rtags-rc' + + + def create_compile_commands(test_dir, test_files): + """Create dict of compile commands.""" + return [dict(directory=os.path.abspath(test_dir), file=test_file, +- command="clang++ -std=c++11 -I. -c %s" % \ ++ command="c++ -std=c++11 -I. -c %s" % \ + os.path.join(test_dir, test_file)) + for test_file in (src_file for src_file in test_files + if src_file.endswith(('.cpp', '.c')))] +@@ -90,7 +84,7 @@ class Location(object): + + def run_rc(args): + """Run rc command.""" +- args = [RC, "--socket-file=" + SOCKET_FILE] + args ++ args = [RC] + args + return sp.check_output(args).decode() + + # pylint: disable=too-few-public-methods +@@ -116,7 +110,7 @@ def run_parse(test_dir, rc_command, expected): + """Run a parse test, and compare with EXPECTED output.""" + output = run_rc(rc_command) + assert_that(output, is_not(empty())) +- assert_that(output.split(" "), has_item(expected.format(test_dir + "/"))) ++ assert_that(output.split(), has_item(expected.format(test_dir + "/"))) + + def run_completion(test_dir, rc_command, expected): + """Run a completion test, and compare with EXPECTED output.""" +@@ -147,8 +141,7 @@ def run(test_dir, rc_command, expected, test_type): + + def setup_rdm(test_dir, test_files): + """Start rdm and parse the test files.""" +- rdm = sp.Popen([RDM, "-n", SOCKET_FILE, "-d", "~/.rtags_dev", "-o", "-B", +- "-C", "--log-flush"], stdout=sp.PIPE, stderr=sp.STDOUT) ++ rdm = sp.Popen(["true"], stdout=sp.PIPE, stderr=sp.STDOUT) + compile_commands = create_compile_commands(test_dir, test_files) + # Wait for rdm + for _ in range(10): +@@ -173,11 +166,7 @@ def setup_rdm(test_dir, test_files): + + def setup_module(): + """Nosetests module setup function.""" +- for exe in [RDM, RC]: +- if not (os.path.isfile(exe) and os.access(exe, os.X_OK)): +- raise FileNotFoundError( +- "{} does not exist or is not executable\n".format(exe)) +- return 0 ++ pass + + def get_type(test_dir): + """Return test type derived from the directory name.""" diff -Nru rtags-2.31/debian/patches/0013-drop-enable-compiler-manager.patch rtags-2.33/debian/patches/0013-drop-enable-compiler-manager.patch --- rtags-2.31/debian/patches/0013-drop-enable-compiler-manager.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0013-drop-enable-compiler-manager.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,22 @@ +From: Denis Danilov +Date: Mon, 22 Jul 2019 23:22:27 +0200 +Subject: drop --enable-compiler-manager from sbroot_test.pl + +it was added by upstream to fix some mac test issues, +but it breaks build tests in pbuilder environment +--- + tests/sbroot/sbroot_test.pl | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/tests/sbroot/sbroot_test.pl b/tests/sbroot/sbroot_test.pl +index e9c3bfc..21710d0 100755 +--- a/tests/sbroot/sbroot_test.pl ++++ b/tests/sbroot/sbroot_test.pl +@@ -264,7 +264,6 @@ sub StartRDM { + my $cmd = ("$rdm ". + "--socket-file=$sockFile ". + "--no-rc ". +- "--enable-compiler-manager ". + "--data-dir=$rtagsDir/rtags_db ". + "--log-file-log-level=debug ". + "--log-file=$rtagsDir/rdm.log ". diff -Nru rtags-2.31/debian/patches/0013-run-nosetests-with-system-binaries.patch rtags-2.33/debian/patches/0013-run-nosetests-with-system-binaries.patch --- rtags-2.31/debian/patches/0013-run-nosetests-with-system-binaries.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0013-run-nosetests-with-system-binaries.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -From: Denis Danilov -Date: Wed, 13 Mar 2019 22:51:47 +0100 -Subject: run nosetests with system binaries - ---- - tests/automated/test_runner.py | 23 ++++++----------------- - 1 file changed, 6 insertions(+), 17 deletions(-) - -diff --git a/tests/automated/test_runner.py b/tests/automated/test_runner.py -index ecdfad1..fd3d06d 100644 ---- a/tests/automated/test_runner.py -+++ b/tests/automated/test_runner.py -@@ -37,20 +37,14 @@ except NameError: - - sys.dont_write_bytecode = True - os.environ["PYTHONDONTWRITEBYTECODE"] = "1" --SOCKET_FILE = "/var/tmp/rdm_dev" - --try: -- RDM = os.path.join(os.environ['RTAGS_BINARY_DIR'], 'rdm') -- RC = os.path.join(os.environ['RTAGS_BINARY_DIR'], 'rc') --except KeyError: -- sys.stderr.write("You need to set RTAGS_BINARY_DIR environment variable.\n") -- sys.exit(1) -+RC = 'rtags-rc' - - - def create_compile_commands(test_dir, test_files): - """Create dict of compile commands.""" - return [dict(directory=os.path.abspath(test_dir), file=test_file, -- command="clang++ -std=c++11 -I. -c %s" % \ -+ command="c++ -std=c++11 -I. -c %s" % \ - os.path.join(test_dir, test_file)) - for test_file in (src_file for src_file in test_files - if src_file.endswith(('.cpp', '.c')))] -@@ -87,7 +81,7 @@ class Location(object): - - def run_rc(args): - """Run rc command.""" -- args = [RC, "--socket-file=" + SOCKET_FILE] + args -+ args = [RC] + args - return sp.check_output(args).decode() - - # pylint: disable=too-few-public-methods -@@ -112,7 +106,7 @@ def run_parse(test_dir, rc_command, expected): - """Run a parse test, and compare with EXPECTED output.""" - output = run_rc(rc_command) - assert_that(output, is_not(empty())) -- assert_that(output.split(" "), has_item(expected.format(test_dir + "/"))) -+ assert_that(output.split(), has_item(expected.format(test_dir + "/"))) - - def run_completion(test_dir, rc_command, expected): - """Run a completion test, and compare with EXPECTED output.""" -@@ -133,8 +127,7 @@ def run(test_dir, rc_command, expected, test_type): - - def setup_rdm(test_dir, test_files): - """Start rdm and parse the test files.""" -- rdm = sp.Popen([RDM, "-n", SOCKET_FILE, "-d", "~/.rtags_dev", "-o", "-B", -- "-C", "--log-flush"], stdout=sp.PIPE, stderr=sp.STDOUT) -+ rdm = sp.Popen(["true"], stdout=sp.PIPE, stderr=sp.STDOUT) - compile_commands = create_compile_commands(test_dir, test_files) - # Wait for rdm - for _ in range(10): -@@ -159,11 +152,7 @@ def setup_rdm(test_dir, test_files): - - def setup_module(): - """Nosetests module setup function.""" -- for exe in [RDM, RC]: -- if not (os.path.isfile(exe) and os.access(exe, os.X_OK)): -- raise FileNotFoundError( -- "{} does not exist or is not executable\n".format(exe)) -- return 0 -+ pass - - def get_type(test_dir): - """Return test type derived from the directory name.""" diff -Nru rtags-2.31/debian/patches/0014-Changelog-for-2.31.patch rtags-2.33/debian/patches/0014-Changelog-for-2.31.patch --- rtags-2.31/debian/patches/0014-Changelog-for-2.31.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0014-Changelog-for-2.31.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -From: Anders Bakken -Date: Tue, 12 Mar 2019 22:20:13 -0700 -Subject: Changelog for 2.31 - ---- - CHANGELOG | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/CHANGELOG b/CHANGELOG -index 8f5950e..f307d99 100644 ---- a/CHANGELOG -+++ b/CHANGELOG -@@ -1,3 +1,9 @@ -+2.31 -+========================= -+- Remove experimental lua support. It never worked correctly and I -+ doubt many people feel like it's the right language for the job if -+ we were to offer such a feature -+ - 2.30 - ========================= - - A couple of fixes regarding references in template functions/classes diff -Nru rtags-2.31/debian/patches/0014-update-changelog.patch rtags-2.33/debian/patches/0014-update-changelog.patch --- rtags-2.31/debian/patches/0014-update-changelog.patch 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/debian/patches/0014-update-changelog.patch 2019-07-26 21:06:22.000000000 +0000 @@ -0,0 +1,25 @@ +From: Anders Bakken +Date: Fri, 21 Jun 2019 13:07:26 -0700 +Subject: update changelog + +--- + CHANGELOG | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index f307d99..8378b37 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,12 @@ ++2.33 ++========================= ++- Rework how daemons work. Make it possible to separately configure ++ how many daemons you have ++ ++2.32 ++========================= ++- Try to reduce memory usage with --rp-daemon ++ + 2.31 + ========================= + - Remove experimental lua support. It never worked correctly and I diff -Nru rtags-2.31/debian/patches/0015-Fix-protocol-version.patch rtags-2.33/debian/patches/0015-Fix-protocol-version.patch --- rtags-2.31/debian/patches/0015-Fix-protocol-version.patch 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/0015-Fix-protocol-version.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -From: Anders Bakken -Date: Tue, 12 Mar 2019 22:31:54 -0700 -Subject: Fix protocol version. - ---- - src/rtags.el | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/rtags.el b/src/rtags.el -index e9be07b..3b7a968 100644 ---- a/src/rtags.el -+++ b/src/rtags.el -@@ -73,7 +73,7 @@ - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;; Constants - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --(defconst rtags-protocol-version 128) -+(defconst rtags-protocol-version 126) - (defconst rtags-package-version "2.31") - (defconst rtags-popup-available (require 'popup nil t)) - (defconst rtags-supported-major-modes '(c-mode c++-mode objc-mode) "Major modes RTags supports.") diff -Nru rtags-2.31/debian/patches/series rtags-2.33/debian/patches/series --- rtags-2.31/debian/patches/series 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/patches/series 2019-07-26 21:06:22.000000000 +0000 @@ -5,10 +5,10 @@ 0005-move-gcc-rtags-wrapper.sh-to-lib-rtags.patch 0006-update-rc-manpage.patch 0007-update-rdm-manpage.patch -0009-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch -0010-rename-rc-rdm-in-the-man-pages.patch -0011-adjust-sbroot_test.pl-to-renamed-binaries.patch -0012-make-build-reproducible.patch -0013-run-nosetests-with-system-binaries.patch -0014-Changelog-for-2.31.patch -0015-Fix-protocol-version.patch +0008-rename-rc-rdm-binaries-to-rtags-rc-rdm.patch +0009-rename-rc-rdm-in-the-man-pages.patch +0010-adjust-sbroot_test.pl-to-renamed-binaries.patch +0011-make-build-reproducible.patch +0012-run-nosetests-with-system-binaries.patch +0013-drop-enable-compiler-manager.patch +0014-update-changelog.patch diff -Nru rtags-2.31/debian/rtags.README.Debian rtags-2.33/debian/rtags.README.Debian --- rtags-2.31/debian/rtags.README.Debian 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/rtags.README.Debian 2019-07-26 21:06:22.000000000 +0000 @@ -16,7 +16,12 @@ to the `~/.config/rtags/rdmrc` file. -To manually start the `rtags-rdm` indexer, run `rtags-rdm` in a shell. +For users of `systemd` service manager, `rtags` package ships +user-mode unit files, where `rdm.service` service is socket activated. +You can check its current status by running the following commands: + + systemctl --user status rdm.socket + systemctl --user status rdm.service Emacs with `elpa-rtags` package can automatically start the indexer process unless the process is already running with the function @@ -25,8 +30,4 @@ (add-hook 'c-mode-hook 'rtags-start-process-unless-running) (add-hook 'c++-mode-hook 'rtags-start-process-unless-running) -Finally, users of `systemd` service manager can use the units shipped -within the `rtags` package by running the following commands: - - systemctl --user enable rdm.socket - systemctl --user start rdm.socket +To manually start the `rtags-rdm` indexer, run `rtags-rdm` in a shell. diff -Nru rtags-2.31/debian/rules rtags-2.33/debian/rules --- rtags-2.31/debian/rules 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/rules 2019-07-26 21:06:22.000000000 +0000 @@ -12,6 +12,9 @@ dh_auto_configure -- \ -DRTAGS_NO_ELISP_FILES=1 +override_dh_auto_test: + dh_auto_test --no-parallel + override_dh_install: dh_install dh_elpa diff -Nru rtags-2.31/debian/tests/run-test rtags-2.33/debian/tests/run-test --- rtags-2.31/debian/tests/run-test 2019-03-17 10:03:30.000000000 +0000 +++ rtags-2.33/debian/tests/run-test 2019-07-26 21:06:22.000000000 +0000 @@ -1,6 +1,7 @@ #!/bin/sh rtags-rdm --daemon --no-filesystem-watcher --no-startup-project --clean-slate --exclude-filter /none +sleep 2 # nosetest writes results summary to sys.stderr and there is no way to # prevent that, therefore redirect stderr to stdout diff -Nru rtags-2.31/man/man7/rc.7 rtags-2.33/man/man7/rc.7 --- rtags-2.31/man/man7/rc.7 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/man/man7/rc.7 2019-06-24 15:13:54.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH RC "7" "March 2019" "rc 2.31.127" "User Commands" +.TH RC "7" "June 2019" "rc 2.33.128" "User Commands" .SH NAME -rc \- manual page for rc 2.31.127 +rc \- manual page for rc 2.33.128 .SH SYNOPSIS rc [OPTION]... .SH DESCRIPTION @@ -391,5 +391,11 @@ .TP \fB\-\-no\-realpath\fR Don't resolve paths using realpath(3). +.TP +\fB\-\-include\-path\fR [arg] +Dump include path for symbol. +.TP +\fB\-\-max\-depth\fR [arg] +Max search depth. Used for \fB\-\-include\-path\fR. .SH "SEE ALSO" rdm(7) diff -Nru rtags-2.31/man/man7/rdm.7 rtags-2.33/man/man7/rdm.7 --- rtags-2.31/man/man7/rdm.7 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/man/man7/rdm.7 2019-06-24 15:13:54.000000000 +0000 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH RDM "7" "March 2019" "rdm 2.31.127" "User Commands" +.TH RDM "7" "June 2019" "rdm 2.33.128" "User Commands" .SH NAME -rdm \- manual page for rdm 2.31.127 +rdm \- manual page for rdm 2.33.128 .SH SYNOPSIS rdm [OPTION]... .SH DESCRIPTION @@ -182,8 +182,8 @@ \fB\-\-completion\-diagnostics\fR [optional] Send diagnostics from completion thread. .TP -\fB\-\-rp\-daemon\fR -Keep rp's alive as daemons and cache the last tu. +\fB\-\-rp\-daemon\fR [arg] +Keep this many rp daemons alive and cache the last tu. Default to 1 .TP \fB\-\-max\-include\-completion\-depth\fR [arg] Max recursion depth for header completion (default 3). diff -Nru rtags-2.31/README.org rtags-2.33/README.org --- rtags-2.31/README.org 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/README.org 2019-06-24 15:13:54.000000000 +0000 @@ -23,7 +23,11 @@ bones about the fact that the only reason we are able to improve on the current tools is because of clang (https://clang.llvm.org/). RTags is named RTags in recognition of Roberto Raggi on whose C++ parser we intended to base -this project but he assured us clang was the way to go. The name stuck though. +this project but he assured us clang was the way to go. The name stuck +though. + +Tarball releases are available here: +https://github.com/Andersbakken/rtags/releases/ * TLDR Quickstart Build RTags @@ -50,7 +54,7 @@ Open source file in =emacs= #+BEGIN_SRC sh -emacs +73:34 src/rdm.cpp +emacs +74:34 src/rdm.cpp #+END_SRC Load =rtags.el= diff -Nru rtags-2.31/scripts/bump-version.sh rtags-2.33/scripts/bump-version.sh --- rtags-2.31/scripts/bump-version.sh 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/scripts/bump-version.sh 2019-06-24 15:13:54.000000000 +0000 @@ -5,19 +5,14 @@ MAJOR=$(echo $1 | awk -F. '{print $1}') MINOR=$(echo $1 | awk -F. '{print $2}') - -if ! echo "$1" | grep -q "^[0-9]\+\.[0-9]\+$"; then - echo "Bad argument: \"$1\"" - echo "Usage bump-version.sh 3.22" - exit 1 -fi +PROTOCOL=$(echo $1 | awk -F. '{print $3}') JOBS=$(getconf _NPROCESSORS_ONLN) if [ "$(uname)" == "Darwin" ]; then - SED=$(which gsed) + SED=$(command -v gsed) else - SED=$(which sed) + SED=$(command -v sed) fi if [ ! -x "$SED" ]; then @@ -26,13 +21,25 @@ fi cd $DIR/.. -$SED -i"" \ - -e "s,^set(RTAGS_VERSION_MAJOR [0-9]\+),set(RTAGS_VERSION_MAJOR $MAJOR)," \ - -e "s,^set(RTAGS_VERSION_MINOR [0-9]\+),set(RTAGS_VERSION_MINOR $MINOR)," \ + +if ! echo "$1" | grep -q "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; then + echo "Bad argument: \"$1\"" + CURRENT_MAJOR=$(grep -o "^set(RTAGS_VERSION_MAJOR [0-9]*" CMakeLists.txt | awk '{print $2}') + CURRENT_MINOR=$(grep -o "^set(RTAGS_VERSION_MINOR [0-9]*" CMakeLists.txt | awk '{print $2}') + CURRENT_DATABASE=$(grep -o "^set(RTAGS_VERSION_DATABASE [0-9]*" CMakeLists.txt | awk '{print $2}') + echo "Usage bump-version.sh ${CURRENT_MAJOR}.${CURRENT_MINOR}.${CURRENT_DATABASE}" + exit 1 +fi + +$SED -i"" \ + -e "s,^set(RTAGS_VERSION_MAJOR [0-9]\+),set(RTAGS_VERSION_MAJOR $MAJOR)," \ + -e "s,^set(RTAGS_VERSION_MINOR [0-9]\+),set(RTAGS_VERSION_MINOR $MINOR)," \ + -e "s,^set(RTAGS_VERSION_DATABASE [0-9]\+),set(RTAGS_VERSION_DATABASE $PROTOCOL)," \ CMakeLists.txt $SED -i"" \ -e "s,^(defconst rtags-package-version \"[0-9]\+\.[0-9]\+\"),(defconst rtags-package-version \"${MAJOR}.${MINOR}\")," \ - -e "s,^;; Version: [0-9]\+\.[0-9]\+,;; Version: ${MAJOR}.${MINOR}," \ + -e "s,^(defconst rtags-protocol-version [0-9]\+),(defconst rtags-protocol-version ${PROTOCOL})," \ + -e "s,^;; Version: [0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?,;; Version: ${MAJOR}.${MINOR}.${PROTOCOL}," \ src/rtags.el echo "Generating manpages" @@ -40,7 +47,7 @@ mkdir build fi cd build -cmake .. +cmake -G "Unix Makefiles" .. make man -j$JOBS cd .. diff -Nru rtags-2.31/scripts/gen-man-pages.sh rtags-2.33/scripts/gen-man-pages.sh --- rtags-2.31/scripts/gen-man-pages.sh 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/scripts/gen-man-pages.sh 2019-06-24 15:13:54.000000000 +0000 @@ -26,9 +26,9 @@ exit 1 fi -SED=$(which sed) +SED=$(command -v sed) if [ "$(uname)" == "Darwin" ]; then - SED=$(which gsed) + SED=$(command -v gsed) fi if [ ! -x "$SED" ]; then diff -Nru rtags-2.31/scripts/getclang.sh rtags-2.33/scripts/getclang.sh --- rtags-2.31/scripts/getclang.sh 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/scripts/getclang.sh 2019-06-24 15:13:54.000000000 +0000 @@ -3,8 +3,6 @@ VERSION="$1" [ -z "${VERSION}" ] && VERSION="3.8.1" -CHECKSUMDIR=`dirname "${BASH_SOURCE[0]}"`/../llvm-checksums/ - LLVM=llvm-${VERSION}.src LLVM_FILE=${LLVM}.tar.xz CLANG=cfe-${VERSION}.src @@ -15,12 +13,11 @@ function dnload() { local FILE=$1-${VERSION}.src.tar.xz - local URL=http://llvm.org/releases/${VERSION}/${FILE} - STATUS=`curl -L -w "%{http_code}" -z ${FILE} https://releases.llvm.org/${VERSION}/${FILE} -o ${FILE} 2>/dev/null` - echo ${STATUS} + local URL=https://releases.llvm.org/${VERSION}/${FILE} + curl -L -w "%{http_code}" -z ${FILE} ${URL} -o ${FILE} 2>/dev/null } -STATUS=`dnload llvm` +STATUS=$(dnload llvm) if [ "${STATUS}" == 200 ] || [ ! -d llvm ]; then tar xf ${LLVM_FILE} rm -rf llvm @@ -30,7 +27,7 @@ rm -f llvm/tools/clang mv ${CLANG} llvm/tools/clang - if [ `uname -s` = Darwin ]; then + if [ "$(uname -s)" = "Darwin" ]; then dnload libcxx >/dev/null tar xf ${LIBCXX_FILE} mv ${LIBCXX} llvm/projects/libcxx diff -Nru rtags-2.31/scripts/llvm-osx/build.sh rtags-2.33/scripts/llvm-osx/build.sh --- rtags-2.31/scripts/llvm-osx/build.sh 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/scripts/llvm-osx/build.sh 2019-06-24 15:13:54.000000000 +0000 @@ -1,3 +1,3 @@ #!/bin/bash brew tap homebrew/versions -brew install llvm38 --with-libcxx --with-clang --without-assertions --rtti $@ +brew install llvm38 --with-libcxx --with-clang --without-assertions --rtti "$@" diff -Nru rtags-2.31/scripts/travis.sh rtags-2.33/scripts/travis.sh --- rtags-2.31/scripts/travis.sh 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/scripts/travis.sh 2019-06-24 15:13:54.000000000 +0000 @@ -38,13 +38,14 @@ emacs --version cmake "$1" "${CMAKE_PARAMS[@]}" .. || cat CMakeFiles/CMakeError.log make VERBOSE=1 -j2 - PATH=$(pwd)/bin:$PATH ctest --output-on-failure --verbose $@ + shift + PATH=$(pwd)/bin:$PATH ctest --output-on-failure --verbose "$@" popd >/dev/null } function add_cmake_params() { - for param in $@; do + for param in "$@"; do CMAKE_PARAMS[${#CMAKE_PARAMS[@]}]="$param" done } @@ -52,25 +53,17 @@ function osx() { ## Step -- Setup - brew update - brew install llvm yarn cppunit ccache - brew upgrade python3 - export PATH="/usr/local/opt/ccache/libexec:$PATH" - - python3 -m pip install --upgrade pip pip3 install --user --upgrade nose PyHamcrest ## Step -- Build mkdir -p ~/.local/bin - ln -s /usr/local/Cellar/numpy/*/libexec/nose/bin/nosetests-3.7 \ - ~/.local/bin/nosetests - export PYTHONPATH=/usr/local/lib/python3.7/site-packages + ln -s /usr/local/Cellar/numpy/*/libexec/nose/bin/nosetests-3.6 ~/.local/bin/nosetests export LIBCLANG_LLVM_CONFIG_EXECUTABLE=$(find /usr/local/Cellar/llvm/*/bin -name llvm-config 2>/dev/null) # Help cmake to find openssl includes/library add_cmake_params "-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl" - build_and_test -DCMAKE_BUILD_TYPE=Release - build_and_test -DCMAKE_BUILD_TYPE=Debug + # Note sure why the "elisptests" target is generated even though Emacs is to old (Works locally) :/ + build_and_test -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -E elisp } function gnu_linux() @@ -78,8 +71,7 @@ ## Step -- Setup pip3 install --user --upgrade nose PyHamcrest - build_and_test -DCMAKE_BUILD_TYPE=Release - build_and_test -DCMAKE_BUILD_TYPE=Debug + build_and_test -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} } if [ $TRAVIS_OS_NAME = osx ]; then diff -Nru rtags-2.31/src/ClangIndexer.cpp rtags-2.33/src/ClangIndexer.cpp --- rtags-2.31/src/ClangIndexer.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/ClangIndexer.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -47,7 +47,7 @@ const CXType canonical = clang_getCanonicalType(type); if (!clang_equalTypes(type, canonical) #if CINDEX_VERSION >= CINDEX_VERSION_ENCODE(0, 32) - && (symbol.typeName == "auto" || type.kind != CXType_Auto) + && (symbol.typeName == "auto" || type.kind == CXType_Auto) #endif ) { symbol.typeName += " => " + RTags::eatString(clang_getTypeSpelling(canonical)); @@ -75,9 +75,11 @@ ClangIndexer *indexer; }; +ClangIndexer::State ClangIndexer::sState = ClangIndexer::NotStarted; +std::mutex ClangIndexer::sStateMutex; Flags ClangIndexer::sServerOpts; -ClangIndexer::ClangIndexer() - : mCurrentTranslationUnit(String::npos), mLastCursor(clang_getNullCursor()), +ClangIndexer::ClangIndexer(Mode mode) + : mMode(mode), mCurrentTranslationUnit(String::npos), mLastCursor(clang_getNullCursor()), mLastCallExprSymbol(0), mVisitFileResponseMessageFileId(0), mVisitFileResponseMessageVisit(0), mParseDuration(0), mVisitDuration(0), mBlocked(0), mAllowed(0), mIndexed(1), mVisitFileTimeout(0), mIndexDataMessageTimeout(0), @@ -97,6 +99,15 @@ bool ClangIndexer::exec(const String &data) { + { + std::unique_lock lock(sStateMutex); + if (sState == Stopped) { + sState = NotStarted; + return true; + } + assert(sState == NotStarted); + sState = Running; + } mFromCache = false; mTimer.restart(); mMacroTokens.clear(); @@ -214,6 +225,9 @@ return false; } + if (ClangIndexer::state() == Stopped) + return true; + Location::init(blockedFiles); Location::set(mSourceFile, mSources.front().fileId); while (!mConnection->isConnected()) { @@ -225,6 +239,9 @@ } usleep(500 * 1000); } + + if (ClangIndexer::state() == Stopped) + return true; // mLogFile = fopen(String::format("/tmp/%s", mSourceFile.fileName()).constData(), "w"); mIndexDataMessage.setProject(mProject); mIndexDataMessage.setIndexerJobFlags(indexerJobFlags); @@ -234,7 +251,16 @@ assert(mConnection->isConnected()); assert(mSources.front().fileId); mIndexDataMessage.files()[mSources.front().fileId] |= IndexDataMessage::Visited; - parse() && visit() && diagnose(); + bool ok = parse(); + if (ClangIndexer::state() == Stopped) + return true; + if (ok) + ok = visit(); + if (ClangIndexer::state() == Stopped) + return true; + if (ok) + ok = diagnose(); + String message = mSourceFile.toTilde(); String err; @@ -254,6 +280,8 @@ } else { writeDuration = sw.elapsed(); } + if (ClangIndexer::state() == Stopped) + return true; message += String::format<16>(" in %lldms. ", mTimer.elapsed()); if (mSources.size() > 1) { message += String::format("(%zu builds) ", mSources.size()); @@ -307,6 +335,8 @@ mIndexDataMessage.setMessage(std::move(message)); sw.restart(); + if (ClangIndexer::state() == Stopped) + return true; debug() << "Sending index data message" << mIndexDataMessage.id(); if (!mConnection->send(mIndexDataMessage)) { error() << "Couldn't send IndexDataMessage" << mSourceFile; @@ -317,6 +347,7 @@ error() << "Timed out sending IndexDataMessage" << mSourceFile; return false; } + if (getenv("RDM_DEBUG_INDEXERMESSAGE")) error() << "Send took" << sw.elapsed() << "for" << mSourceFile; @@ -717,6 +748,8 @@ CXChildVisitResult ClangIndexer::visitorHelper(CXCursor cursor, CXCursor, CXClientData data) { + if (ClangIndexer::state() == Stopped) + return CXChildVisit_Break; ClangIndexer *indexer = static_cast(data); const CXChildVisitResult res = indexer->indexVisitor(cursor); if (res == CXChildVisit_Recurse) @@ -1311,7 +1344,6 @@ } } - mIndexDataMessage.files()[location.fileId()] |= IndexDataMessage::IncludeError; error() << "handleInclude failed" << includedFile << cursor; } @@ -1913,9 +1945,7 @@ Flags flags = CXTranslationUnit_DetailedPreprocessingRecord; - if (sServerOpts & Server::RPDaemon - && (mIndexDataMessage.indexerJobFlags() & (IndexerJob::EditorActive|IndexerJob::EditorOpen) - || mCachedTranslationUnits.isEmpty())) { + if (mMode == Daemon) { flags |= CXTranslationUnit_PrecompiledPreamble; flags |= CXTranslationUnit_ForSerialization; #if CINDEX_VERSION >= CINDEX_VERSION_ENCODE(0, 32) @@ -2005,10 +2035,7 @@ mIndexDataMessage.setFlag(IndexDataMessage::ParseFailure); } } - if (sServerOpts & Server::RPDaemon - && (mIndexDataMessage.indexerJobFlags() & (IndexerJob::EditorActive|IndexerJob::EditorOpen) - || mCachedTranslationUnits.isEmpty())) { - // only overwrite cache with active/open compiles + if (mMode == Daemon) { if (ok) { mCachedSources = mSources; mCachedTranslationUnits = mTranslationUnits; diff -Nru rtags-2.31/src/ClangIndexer.h rtags-2.33/src/ClangIndexer.h --- rtags-2.31/src/ClangIndexer.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/ClangIndexer.h 2019-06-24 15:13:54.000000000 +0000 @@ -32,9 +32,30 @@ class ClangIndexer : public RTags::DiagnosticsProvider { public: - ClangIndexer(); + enum Mode { + Normal, + Daemon + }; + ClangIndexer(Mode mode); ~ClangIndexer(); + enum State { + NotStarted, + Stopped, + Running + }; + + static void transition(State state) + { + std::unique_lock lock(sStateMutex); + sState = state; + } + + static State state() + { + std::unique_lock lock(sStateMutex); + return sState; + } Path sourceFile() const { return mSourceFile; } bool exec(const String &data); static Flags serverOpts() { return sServerOpts; } @@ -144,6 +165,7 @@ Hash > mUnits; + const Mode mMode; Path mProject; SourceList mSources, mCachedSources; Path mSourceFile; @@ -191,6 +213,9 @@ size_t mInTemplateFunction; static Flags sServerOpts; + + static State sState; + static std::mutex sStateMutex; }; #endif diff -Nru rtags-2.31/src/CMakeLists.txt rtags-2.33/src/CMakeLists.txt --- rtags-2.31/src/CMakeLists.txt 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/CMakeLists.txt 2019-06-24 15:13:54.000000000 +0000 @@ -158,6 +158,7 @@ CompilerManager.cpp CompletionThread.cpp DependenciesJob.cpp + IncludePathJob.cpp FileManager.cpp FindFileJob.cpp FindSymbolsJob.cpp @@ -261,8 +262,8 @@ set(RTAGS_NO_ELISP_FILES TRUE) endif () else () - set(RTAGS_NO_ELISP_FILES TRUE) message(STATUS "Emacs was not found, elisp files are not going to be installed!") + set(RTAGS_NO_ELISP_FILES TRUE) endif () set(RTAGS_ELISP_FILES diff -Nru rtags-2.31/src/IncludePathJob.cpp rtags-2.33/src/IncludePathJob.cpp --- rtags-2.31/src/IncludePathJob.cpp 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/src/IncludePathJob.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,96 @@ +/* This file is part of RTags (http://rtags.net). + + RTags is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + RTags is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with RTags. If not, see . */ + +#include "IncludePathJob.h" + +#include "Project.h" +#include "RTags.h" +#include "Server.h" + +IncludePathJob::IncludePathJob(const Location loc, const std::shared_ptr &query, const std::shared_ptr &project) + : QueryJob(query, project, QuietJob), location(loc) +{ +} + +int IncludePathJob::execute() +{ + int idx = 0; + Symbol symbol = project()->findSymbol(location, &idx); + if (symbol.isNull()) { + return 1; + } + + // if you invoke a destructor explicitly there's a typeref on the class + // name. This finds the destructor instead. + if ((symbol.kind == CXCursor_TypeRef || symbol.kind == CXCursor_TemplateRef) && idx > 0) { + auto symbols = project()->openSymbols(location.fileId()); + if (!symbols || !symbols->count()) + return 1; + const Symbol prev = symbols->valueAt(idx - 1); + if (prev.kind == CXCursor_MemberRefExpr + && prev.location.column() == symbol.location.column() - 1 + && prev.location.line() == symbol.location.line() + && prev.symbolName.contains("~")) { + symbol = prev; + } + } + + auto targets = RTags::sortTargets(project()->findTargets(symbol)); + + String allTargetPath; + int maxDepth = queryMessage()->maxDepth(); + if (maxDepth == -1) + maxDepth = 8; + const bool absolute = queryFlags() & QueryMessage::AbsolutePath; + const std::shared_ptr proj = project(); + if (!proj) + return 1; + const Path projectPath = proj->path(); + for (const auto &target : targets) { + DependencyNode *depNode = project()->dependencyNode(location.fileId()); + if (depNode) { + List paths; + bool done = false; + std::function process = [&](DependencyNode *n) { + if (done || !paths.contains(n->fileId)) { + paths.append(n->fileId); + if (n->fileId == target.location.fileId()) { + String path; + for (uint32_t fileId : paths) { + if (!path.isEmpty()) + path += " -> "; + Path p = Location::path(fileId); + if (!absolute && p.startsWith(projectPath)) { + path += p.mid(projectPath.size()); + } else { + path += p; + } + } + if (!write(path)) + done = true; + } else if (paths.size() < static_cast(maxDepth)) { + for (const auto &includeNode : n->includes) { + process(includeNode.second); + } + } + paths.removeLast(); + } + }; + process(depNode); + } + } + + return 0; +} diff -Nru rtags-2.31/src/IncludePathJob.h rtags-2.33/src/IncludePathJob.h --- rtags-2.31/src/IncludePathJob.h 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/src/IncludePathJob.h 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,33 @@ +/* This file is part of RTags (http://rtags.net). + + RTags is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + RTags is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with RTags. If not, see . */ + +#ifndef IncludePathJob_h +#define IncludePathJob_h + +#include "QueryJob.h" + +class Project; +class QueryMessage; +class IncludePathJob : public QueryJob +{ + public: + IncludePathJob(const Location loc, const std::shared_ptr &query, const std::shared_ptr &project); + protected: + virtual int execute() override; + private: + const Location location; +}; + +#endif diff -Nru rtags-2.31/src/IndexDataMessage.h rtags-2.33/src/IndexDataMessage.h --- rtags-2.31/src/IndexDataMessage.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/IndexDataMessage.h 2019-06-24 15:13:54.000000000 +0000 @@ -89,8 +89,7 @@ Includes &includes() { return mIncludes; } enum FileFlag { NoFileFlag = 0x0, - Visited = 0x1, - IncludeError = 0x2 + Visited = 0x1 }; Hash > &files() { return mFiles; } const Hash > &files() const { return mFiles; } diff -Nru rtags-2.31/src/IndexParseData.h rtags-2.33/src/IndexParseData.h --- rtags-2.31/src/IndexParseData.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/IndexParseData.h 2019-06-24 15:13:54.000000000 +0000 @@ -60,6 +60,12 @@ return *this; } + void clearSources() + { + lastModifiedMs = 0; + sources.clear(); + } + uint64_t lastModifiedMs; Sources sources; List environment; diff -Nru rtags-2.31/src/JobScheduler.cpp rtags-2.33/src/JobScheduler.cpp --- rtags-2.31/src/JobScheduler.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/JobScheduler.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -25,12 +25,13 @@ enum { MaxPriority = 10 }; // we set the priority to be this when a job has been requested and we couldn't load it JobScheduler::JobScheduler() - : mProcrastination(0) + : mProcrastination(0), mStopped(false) { } JobScheduler::~JobScheduler() { + mStopped = true; mPendingJobs.deleteAll(); for (const auto &job : mActiveByProcess) { mDaemons.erase(job.first); @@ -44,20 +45,40 @@ } } -void JobScheduler::setActiveJobs(size_t active) +bool JobScheduler::start() { - assert(active > 0); - const bool daemon = Server::instance()->options().options & Server::RPDaemon; - if (daemon) { - while (mDaemons.size() > active) - mDaemons.erase(mDaemons.begin()); + return initDaemons(); +} + +bool JobScheduler::initDaemons() +{ + const auto &options = Server::instance()->options(); + assert(mDaemons.size() <= static_cast(options.daemonCount)); + const int needed = options.daemonCount - static_cast(mDaemons.size()); + for (int i=0; i arguments; + for (int l=logLevel().toInt(); l>0; --l) + arguments << "-v"; + arguments << "--daemon"; + if (options.options & Server::RPLogToSyslog) + arguments << "--log-to-syslog"; + if (!process->start(options.rp, arguments)) { + error() << "Couldn't start rp" << options.rp << process->errorString(); + delete process; + return false; + } + mDaemons[process] = {}; } + return true; } void JobScheduler::add(const std::shared_ptr &job) { assert(!(job->flags & (IndexerJob::Crashed|IndexerJob::Aborted|IndexerJob::Complete|IndexerJob::Running))); - std::shared_ptr node(new Node({ 0, job, 0, 0, 0, String(), String() })); + std::shared_ptr node(new Node); node->job = job; // error() << job->priority << job->sourceFile << mProcrastination; if (mPendingJobs.isEmpty() || job->priority() > mPendingJobs.first()->job->priority()) { @@ -86,191 +107,96 @@ return; } const auto &options = server->options(); - std::shared_ptr jobNode = mPendingJobs.first(); - auto cont = [&jobNode, this]() { - auto tmp = jobNode->next; - mPendingJobs.remove(jobNode); - jobNode = tmp; - }; - - const bool isDaemon = options.options & Server::RPDaemon; - while (mActiveByProcess.size() < options.jobCount && jobNode) { - assert(jobNode); - assert(jobNode->job); - assert(!(jobNode->job->flags & (IndexerJob::Running|IndexerJob::Complete|IndexerJob::Crashed|IndexerJob::Aborted))); - std::shared_ptr project = Server::instance()->project(jobNode->job->project); - if (!project) { - cont(); - debug() << jobNode->job->sourceFile << "doesn't have a project, discarding"; - continue; - } - - switch (Server::instance()->activeBufferType(jobNode->job->sourceFileId())) { - case Server::Active: - jobNode->job->flags |= IndexerJob::EditorActive; - break; - case Server::Open: - jobNode->job->flags |= IndexerJob::EditorOpen; - break; - case Server::Inactive: - break; - } + int slots = std::max(0, options.jobCount - mActiveByProcess.size()); + int daemonSlots = std::max(0, options.daemonCount - mActiveDaemonsByProcess.size()); - - const uint64_t jobId = jobNode->job->id; - Process *process = nullptr; - DaemonData *daemonData = nullptr; - int daemonDataScore = -1; - auto score = [](Flags f) -> int { - return Flags(f & (IndexerJob::EditorActive|IndexerJob::EditorOpen)).cast(); - }; - - for (auto &daemon : mDaemons) { - if (daemon.second.cache == jobNode->job->sources) { - process = daemon.first; - daemonData = nullptr; - break; + std::shared_ptr node = mPendingJobs.first(); + while (node && (slots || daemonSlots)) { + const Server::ActiveBufferType type = Server::instance()->activeBufferType(node->job->sourceFileId()); + if (daemonSlots && type == Server::Active) { + auto cand = mDaemons.end(); + bool cacheHit = false; + for (auto it = mDaemons.begin(); it != mDaemons.end(); ++it) { + if (mActiveDaemonsByProcess.contains(it->first)) + continue; + + if (node->job->sources == it->second.cache) { + cand = it; + cacheHit = true; + break; + } else if (cand == mDaemons.end() || cand->second.touched > it->second.touched) { + cand = it; + } } - if (mDaemons.size() < options.jobCount || mActiveByProcess.find(daemon.first) != mActiveByProcess.end()) - continue; // we'll just make a new daemon, we're not at capacity - - const int dscore = score(daemon.second.flags); - if (!daemonData || dscore < daemonDataScore || (dscore == daemonDataScore && daemon.second.touched < daemonData->touched)) { - process = daemon.first; - daemonData = &daemon.second; - daemonDataScore = dscore; + if (cand != mDaemons.end()) { + if (!cacheHit) { + cand->second.touched = 0; + cand->second.cache.clear(); + } + node->process = cand->first; + assert(!(node->job->flags & (IndexerJob::Crashed|IndexerJob::Aborted|IndexerJob::Complete|IndexerJob::Running))); + node->job->flags |= IndexerJob::Running|IndexerJob::EditorActive; + node->daemon = true; + cand->first->write(node->job->encode()); + node->started = Rct::monoMs(); + mActiveDaemonsByProcess[cand->first] = node; + mInactiveById.remove(node->job->id); + mActiveById[node->job->id] = node; + --daemonSlots; + std::shared_ptr tmp = node; + node = node->next; + mPendingJobs.remove(tmp); + continue; } } - if (daemonData && jobNode->job->flags & (IndexerJob::EditorActive|IndexerJob::EditorOpen)) { - daemonData->cache.clear(); - daemonData->touched = 0; - } - - if (!process) { - process = new Process; - if (isDaemon) - mDaemons[process] = DaemonData {}; - debug() << "Starting process for" << jobId << jobNode->job->sourceFileId() << jobNode->job.get(); + if (slots) { + Process *process = new Process; + debug() << "Starting process for" << node->job->id << node->job->sourceFileId() << node->job.get(); List arguments; - arguments << "--priority" << String::number(jobNode->job->priority()); - + arguments << "--priority" << String::number(node->job->priority()); for (int i=logLevel().toInt(); i>0; --i) arguments << "-v"; - - if (isDaemon) - arguments << "--daemon"; if (options.options & Server::RPLogToSyslog) arguments << "--log-to-syslog"; - process->readyReadStdErr().connect([this](Process *proc) { - std::shared_ptr n = mActiveByProcess[proc]; - if (n) - n->stdErr.append(proc->readAllStdErr()); - }); - - process->readyReadStdOut().connect([this, isDaemon](Process *proc) { - (void)isDaemon; - std::shared_ptr n = mActiveByProcess.value(proc); - if (!n) { - error() << "Cannot find process in active"; - return; - } - n->stdOut.append(proc->readAllStdOut()); - - { - std::regex rx("@CRASH@([^@]*)@CRASH@"); - std::smatch match; - while (std::regex_search(n->stdOut.ref(), match, rx)) { - error() << match[1].str(); - n->stdOut.remove(match.position(), match.length()); - } - } - { - const size_t idx = n->stdOut.indexOf("@FINISHED@"); - if (idx != String::npos) { - assert(isDaemon); - mActiveByProcess.remove(proc); - assert(!n || n->process == proc); - if (idx > 0 || !n->stdErr.isEmpty()) { - error() << ("Output from " + n->job->sourceFile + ":") - << '\n' << n->stdErr << n->stdOut.mid(0, idx); - } - - n->stdOut.remove(0, idx + 10); - n->stdErr.clear(); - - assert(mDaemons.contains(n->process)); - assert(n->process == proc); - n->process = 0; - assert(!(n->job->flags & IndexerJob::Aborted)); - auto it = mDaemons.find(proc); - if (it == mDaemons.end()) { - proc->closeStdIn(); - } else if (n->job->flags & (IndexerJob::EditorActive|IndexerJob::EditorOpen) || !it->second.touched) { - it->second.cache = n->job->sources; - it->second.touched = Rct::monoMs(); - it->second.flags = n->job->flags & (IndexerJob::EditorActive|IndexerJob::EditorOpen); - } + connectProcess(process); - startJobs(); - } - } - }); + switch (type) { + case Server::Active: + node->job->flags |= IndexerJob::EditorActive; + break; + case Server::Open: + node->job->flags |= IndexerJob::EditorOpen; + break; + case Server::Inactive: + break; + } if (!process->start(options.rp, arguments)) { error() << "Couldn't start rp" << options.rp << process->errorString(); delete process; - if (isDaemon) - mDaemons.erase(process); - jobNode->job->flags |= IndexerJob::Crashed; - debug() << "job crashed (didn't start)" << jobId << jobNode->job->sourceFileId() << jobNode->job.get(); - auto msg = std::make_shared(jobNode->job); + node->job->flags |= IndexerJob::Crashed; + debug() << "job crashed (didn't start)" << node->job->id << node->job->sourceFileId() << node->job.get(); + auto msg = std::make_shared(node->job); msg->setFlag(IndexDataMessage::ParseFailure); - jobFinished(jobNode->job, msg); - cont(); - continue; + jobFinished(node->job, msg); + } else { + node->process = process; + assert(!(node->job->flags & (IndexerJob::Crashed|IndexerJob::Aborted|IndexerJob::Complete|IndexerJob::Running))); + node->job->flags |= IndexerJob::Running; + process->write(node->job->encode()); + node->started = Rct::monoMs(); + mActiveByProcess[process] = node; + mActiveById[node->job->id] = node; + --slots; } - const int pid = process->pid(); - process->finished().connect([this, options, pid, isDaemon](Process *proc) { - if (isDaemon) - mDaemons.erase(proc); - EventLoop::deleteLater(proc); - auto n = mActiveByProcess.take(proc); - assert(!n || n->process == proc); - if (n && (!n->stdOut.isEmpty() || !n->stdErr.isEmpty())) { - error() << "Finish output from" << n->job->sourceFile << '\n' << n->stdErr << n->stdOut; - } - Path::rmdir(options.tempDir + String::number(pid)); - - if (n) { - assert(n->process == proc); - n->process = 0; - assert(!(n->job->flags & IndexerJob::Aborted)); - if (!(n->job->flags & IndexerJob::Complete) && proc->returnCode() != 0) { - auto nodeById = mActiveById.take(n->job->id); - assert(nodeById); - assert(nodeById == n); - // job failed, probably no IndexDataMessage coming - n->job->flags |= IndexerJob::Crashed; - debug() << "job crashed" << n->job->id << n->job->sourceFileId() << n->job.get(); - auto msg = std::make_shared(n->job); - msg->setFlag(IndexDataMessage::ParseFailure); - jobFinished(n->job, msg); - } - } - startJobs(); - }); + mInactiveById.remove(node->job->id); + std::shared_ptr tmp = node; + node = node->next; + mPendingJobs.remove(tmp); + } else { + node = node->next; } - - jobNode->process = process; - assert(!(jobNode->job->flags & (IndexerJob::Crashed|IndexerJob::Aborted|IndexerJob::Complete|IndexerJob::Running))); - jobNode->job->flags |= IndexerJob::Running; - process->write(jobNode->job->encode()); - jobNode->started = Rct::monoMs(); - mActiveByProcess[process] = jobNode; - mInactiveById.remove(jobId); - mActiveById[jobId] = jobNode; - cont(); } } @@ -319,8 +245,8 @@ void JobScheduler::dumpJobs(const std::shared_ptr &conn) { + conn->write<1024>("Pending: %zu", mPendingJobs.size()); if (!mPendingJobs.isEmpty()) { - conn->write("Pending:"); for (const auto &node : mPendingJobs) { conn->write<128>("%s: %s %d %s", node->job->sourceFile.constData(), @@ -329,8 +255,9 @@ IndexerJob::dumpFlags(node->job->flags).constData()); } } + + conn->write<1024>("Active: %zu/%zu", mActiveById.size(), Server::instance()->options().jobCount); if (!mActiveById.isEmpty()) { - conn->write("Active:"); const unsigned long long now = Rct::monoMs(); for (const auto &node : mActiveById) { conn->write<128>("%s: %s priority: %d %s %lldms", @@ -347,14 +274,16 @@ void JobScheduler::dumpDaemons(const std::shared_ptr &conn) { if (mDaemons.size()) { - conn->write("Daemons:"); + conn->write<1024>("Daemons: %zu", mDaemons.size()); for (const auto &daemon : mDaemons) { if (!daemon.second.cache.isEmpty()) { conn->write<1024>("pid: %d %s%s", - daemon.first->pid(), + static_cast(daemon.first->pid()), daemon.second.cache.front().sourceFile().constData(), daemon.second.cache.size() > 1 ? String::format(" (%zu builds)", daemon.second.cache.size()).constData() : ""); + } else { + conn->write<1024>("pid: %d: empty", static_cast(daemon.first->pid())); } } } @@ -378,8 +307,14 @@ debug() << "Aborting active job" << job->sourceFile << job->sourceFileId() << job->id << job.get(); } if (node->process) { - debug() << "Killing process" << node->process; - node->process->kill(); + if (node->daemon) { + debug() << "Killing process with SIGALRM" << node->process; + node->process->kill(SIGALRM); + } else { + debug() << "Killing process" << node->process; + node->process->kill(); + } + mActiveByProcess.remove(node->process); } } @@ -401,3 +336,108 @@ mPendingJobs.append(std::move(n)); } } + +void JobScheduler::onProcessReadyReadStdErr(Process *proc) +{ + std::shared_ptr n = mActiveByProcess[proc]; + String out = proc->readAllStdErr(); + if (n) + n->stdErr.append(out); +} + +void JobScheduler::onProcessReadyReadStdOut(Process *proc) +{ + std::shared_ptr n = mActiveByProcess.value(proc); + bool daemon = false; + if (!n) { + n = mActiveDaemonsByProcess.value(proc); + daemon = true; + } + if (!n) { + debug() << "Cannot find process in active" << proc->pid() + << proc->readAllStdOut(); + startJobs(); + return; + } + n->stdOut.append(proc->readAllStdOut()); + + { + std::regex rx("@CRASH@([^@]*)@CRASH@"); + std::smatch match; + while (std::regex_search(n->stdOut.ref(), match, rx)) { + error() << match[1].str(); + n->stdOut.remove(match.position(), match.length()); + } + } + if (daemon) { + const size_t idx = n->stdOut.indexOf("@FINISHED@"); + if (idx != String::npos) { + const bool removed = mActiveDaemonsByProcess.remove(proc); + static_cast(removed); + assert(removed); + assert(n->process == proc); + if (idx > 0 || !n->stdErr.isEmpty()) { + error() << ("Output from " + n->job->sourceFile + ":") + << '\n' << n->stdErr << n->stdOut.mid(0, idx); + } + + n->stdOut.remove(0, idx + 10); + n->stdErr.clear(); + assert(mDaemons.contains(n->process)); + + DaemonData &data = mDaemons[n->process]; + data.cache = n->job->sources; + data.touched = Rct::monoMs(); + assert(n->process == proc); + n->process = 0; + assert(!(n->job->flags & IndexerJob::Aborted)); + startJobs(); + } + } +} + +void JobScheduler::onProcessFinished(Process *proc, pid_t pid) +{ + const bool daemon = mDaemons.erase(proc); + // ### restart daemon? + EventLoop::deleteLater(proc); + auto n = mActiveByProcess.take(proc); + if (!n) { + n = mActiveDaemonsByProcess.take(proc); + } + if (n && (!n->stdOut.isEmpty() || !n->stdErr.isEmpty())) { + error() << "Finish output from" << n->job->sourceFile << '\n' << n->stdErr << n->stdOut; + } + const auto &options = Server::instance()->options(); + Path::rmdir(options.tempDir + String::number(pid)); + + if (n) { + assert(n->process == proc); + n->process = 0; + assert(!(n->job->flags & IndexerJob::Aborted)); + if (!(n->job->flags & IndexerJob::Complete) && proc->returnCode() != 0) { + auto nodeById = mActiveById.take(n->job->id); + assert(nodeById); + assert(nodeById == n); + // job failed, probably no IndexDataMessage coming + n->job->flags |= IndexerJob::Crashed; + debug() << "job crashed" << n->job->id << n->job->sourceFileId() << n->job.get(); + auto msg = std::make_shared(n->job); + msg->setFlag(IndexDataMessage::ParseFailure); + jobFinished(n->job, msg); + } + } + if (!mStopped) { + if (daemon) + initDaemons(); + startJobs(); + } +} + +void JobScheduler::connectProcess(Process *process) +{ + assert(process); + process->readyReadStdOut().connect(std::bind(&JobScheduler::onProcessReadyReadStdOut, this, std::placeholders::_1)); + process->readyReadStdOut().connect(std::bind(&JobScheduler::onProcessReadyReadStdErr, this, std::placeholders::_1)); + process->finished().connect(std::bind(&JobScheduler::onProcessFinished, this, std::placeholders::_1, std::placeholders::_2)); +} diff -Nru rtags-2.31/src/JobScheduler.h rtags-2.33/src/JobScheduler.h --- rtags-2.31/src/JobScheduler.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/JobScheduler.h 2019-06-24 15:13:54.000000000 +0000 @@ -37,6 +37,8 @@ JobScheduler(); ~JobScheduler(); + bool start(); + struct JobScope { JobScope(const std::shared_ptr &scheduler) : mScheduler(scheduler) @@ -64,26 +66,31 @@ size_t pendingJobCount() const { return mPendingJobs.size(); } size_t activeJobCount() const { return mActiveById.size(); } void sort(); - void setActiveJobs(size_t active); private: + bool initDaemons(); + void onProcessReadyReadStdErr(Process *process); + void onProcessReadyReadStdOut(Process *process); + void onProcessFinished(Process *process, pid_t pid); + void connectProcess(Process *process); void jobFinished(const std::shared_ptr &job, const std::shared_ptr &message); struct Node { - unsigned long long started; + unsigned long long started { 0 }; std::shared_ptr job; - Process *process; + Process *process { nullptr }; std::shared_ptr next, prev; String stdOut, stdErr; + bool daemon { false }; }; int mProcrastination; + bool mStopped; struct DaemonData { uint64_t touched { 0 }; SourceList cache; - Flags flags; }; Hash mDaemons; EmbeddedLinkedList > mPendingJobs; - Hash > mActiveByProcess; + Hash > mActiveByProcess, mActiveDaemonsByProcess; Hash > mActiveById, mInactiveById; }; diff -Nru rtags-2.31/src/Preprocessor.cpp rtags-2.33/src/Preprocessor.cpp --- rtags-2.31/src/Preprocessor.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Preprocessor.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -46,6 +46,13 @@ mProcess->finished().connect(std::bind(&Preprocessor::onProcessFinished, this)); } +Preprocessor::~Preprocessor() +{ + if (mProcess && mProcess->returnCode() == Process::ReturnUnset) { + mProcess->kill(); + } +} + void Preprocessor::preprocess() { mProcess->start(mSource.compiler(), mArgs); @@ -63,3 +70,4 @@ mConnection->finish(); EventLoop::deleteLater(this); } + diff -Nru rtags-2.31/src/Preprocessor.h rtags-2.33/src/Preprocessor.h --- rtags-2.31/src/Preprocessor.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Preprocessor.h 2019-06-24 15:13:54.000000000 +0000 @@ -28,6 +28,7 @@ enum Mode { Preprocess, Asm }; Preprocessor(Mode mode, const Source &source, const std::shared_ptr &connection); + ~Preprocessor(); void preprocess(); private: diff -Nru rtags-2.31/src/Project.cpp rtags-2.33/src/Project.cpp --- rtags-2.31/src/Project.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Project.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -218,9 +218,7 @@ file >> fileId; if (!fileId) return false; - Flags flags; - file >> flags; - dependencies[fileId] = new DependencyNode(fileId, flags); + dependencies[fileId] = new DependencyNode(fileId); } for (int i=0; i(dependencies.size()); for (const auto &it : dependencies) { - file << it.first << it.second->flags; + file << it.first; } for (const auto &it : dependencies) { file << static_cast(it.second->dependents.size()); @@ -349,10 +347,12 @@ String err; if (!Project::readSources(mSourcesFilePath, mIndexParseData, &err)) { - if (!err.isEmpty()) + if (!err.isEmpty()) { error("Sources restore error %s: %s", mPath.constData(), err.constData()); + return false; + } - return false; + return true; } auto reindexAll = [this]() { @@ -381,7 +381,6 @@ { std::lock_guard lock(mMutex); file >> mVisitedFiles; - Sandbox::decode(mVisitedFiles); } file >> mDiagnostics; for (const auto &info : mIndexParseData.compileCommands) @@ -773,7 +772,7 @@ assert(((job->flags & (IndexerJob::Complete|IndexerJob::Crashed)) == IndexerJob::Complete) || ((job->flags & (IndexerJob::Complete|IndexerJob::Crashed)) == IndexerJob::Crashed)); const auto &options = Server::instance()->options(); - if (!success) { + if (!success || msg->flags() & IndexDataMessage::ParseFailure) { releaseFileIds(job->visited); } @@ -815,7 +814,7 @@ Set visited = msg->visitedFiles(); updateFixIts(visited, msg->fixIts()); - updateDependencies(fileId, msg, job->unsavedFiles); + updateDependencies(fileId, msg); if (success) { forEachSources([&msg, fileId](Sources &sources) -> VisitResult { // error() << "finished with" << Location::path(fileId) << sources.contains(fileId) << msg->parseTime(); @@ -912,11 +911,7 @@ } { std::lock_guard lock(mMutex); - if (Sandbox::hasRoot()) { - file << Sandbox::encoded(mVisitedFiles); - } else { - file << mVisitedFiles; - } + file << mVisitedFiles; } file << mDiagnostics; saveDependencies(file, mDependencies); @@ -980,7 +975,7 @@ void Project::onFileAddedOrModified(const Path &file, uint32_t fileId) { - // error() << file.fileName() << mCompileCommandsInfos.dir << file; + // error() << file.fileName() << fileId << mIndexParseData.compileCommands.keys(); if (mIndexParseData.compileCommands.contains(fileId)) { mCheckTimer.restart(CheckExplicitTimeout); return; @@ -1104,12 +1099,11 @@ } } -void Project::updateDependencies(uint32_t fileId, const std::shared_ptr &msg, const UnsavedFiles &unsavedFiles) +void Project::updateDependencies(uint32_t fileId, const std::shared_ptr &msg) { static_cast(fileId); const bool prune = !(msg->flags() & IndexDataMessage::ParseFailure); // error() << "updateDependencies" << Location::path(fileId) << prune; - Set includeErrors, dirty; for (auto pair : msg->files()) { assert(pair.first); DependencyNode *&node = mDependencies[pair.first]; @@ -1118,32 +1112,13 @@ node = new DependencyNode(pair.first); } - if (pair.second & IndexDataMessage::Visited) { - if (pair.second & IndexDataMessage::IncludeError) { - node->flags |= DependencyNode::Flag_IncludeError; - includeErrors.insert(pair.first); - // error() << "got include error for" << Location::path(pair.first); - } else if (node->flags & DependencyNode::Flag_IncludeError) { - // error() << "used to have include error for" << Location::path(pair.first) << node->includes.size(); - node->flags &= ~DependencyNode::Flag_IncludeError; - dirty.insert(pair.first); - // for (auto dep : node->includes) { - // dirty.insert(dep.first); - // // error() << "dirty" << Location::path(dep.first); - // } - for (auto dep : node->dependents) { - dirty.insert(dep.first); - // error() << "dirty" << Location::path(dep.first); - } - } - if (prune) { - for (auto it : node->includes) { - it.second->dependents.remove(pair.first); - // error() << "removing" << Location::path(pair.first) << "from" << Location::path(it.first); - } - // error() << "Removing all includes for" << Location::path(pair.first) << node->includes.size(); - node->includes.clear(); + if (pair.second & IndexDataMessage::Visited && prune) { + for (auto it : node->includes) { + it.second->dependents.remove(pair.first); + // error() << "removing" << Location::path(pair.first) << "from" << Location::path(it.first); } + // error() << "Removing all includes for" << Location::path(pair.first) << node->includes.size(); + node->includes.clear(); } watchFile(pair.first); } @@ -1162,22 +1137,6 @@ includer->include(inclusiary); } - if (!includeErrors.isEmpty()) { - // error() << "releasing files"; - // for (uint32_t f : includeErrors) { - // error() << Location::path(f); - // } - releaseFileIds(includeErrors); - } - if (!dirty.isEmpty()) { - // error() << "dirtying"; - // for (uint32_t f : dirty) { - // error() << Location::path(f); - // } - SimpleDirty simple; - simple.init(shared_from_this(), dirty); - startDirtyJobs(&simple, IndexerJob::Dirty, unsavedFiles); - } // for (auto node : mDependencies) { // for (auto inc : node.second->includes) { // if (!inc.second->dependents.contains(node.first)) { @@ -2543,23 +2502,21 @@ data.project = mPath; data.environment = mIndexParseData.environment; bool found = false; - auto it = mIndexParseData.compileCommands.begin(); - while (it != mIndexParseData.compileCommands.end()) { + + for (auto it = mIndexParseData.compileCommands.begin(); it != mIndexParseData.compileCommands.end(); ++it) { const Path file = Location::path(it->first); const uint64_t lastModified = file.lastModifiedMs(); if (!lastModified) { for (auto src : it->second.sources) { removed[src.first] = it->first; } - mIndexParseData.compileCommands.erase(it++); - continue; - } - - if (lastModified != it->second.lastModifiedMs - && Server::instance()->loadCompileCommands(data, file, it->second.environment, &cache)) { - found = true; + it->second.clearSources(); + } else { + if (lastModified != it->second.lastModifiedMs + && Server::instance()->loadCompileCommands(data, file, it->second.environment, &cache)) { + found = true; + } } - ++it; } removeSources(removed); if (found) @@ -2971,8 +2928,8 @@ }; if (!fileId) { Set seenUsrs; - for (const auto &file : mVisitedFiles) { - processFile(file.first, &seenUsrs); + for (uint32_t id : mVisitedFiles) { + processFile(id, &seenUsrs); } } else { processFile(fileId); diff -Nru rtags-2.31/src/Project.h rtags-2.33/src/Project.h --- rtags-2.31/src/Project.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Project.h 2019-06-24 15:13:54.000000000 +0000 @@ -43,12 +43,8 @@ class RestoreThread; struct DependencyNode { - enum Flag { - Flag_None = 0x0, - Flag_IncludeError = 0x1 - }; - DependencyNode(uint32_t f, Flags l = NullFlags) - : fileId(f), flags(l) + DependencyNode(uint32_t f) + : fileId(f) {} void include(DependencyNode *dependee) { @@ -60,12 +56,8 @@ Dependencies dependents, includes; uint32_t fileId; - - Flags flags; }; -RCT_FLAGS(DependencyNode::Flag); - class Project : public std::enable_shared_from_this { public: @@ -198,7 +190,7 @@ Source source(uint32_t fileId, int buildIndex) const; bool hasSource(uint32_t fileId) const; bool isActiveJob(uint32_t sourceFileId) { return !sourceFileId || mActiveJobs.contains(sourceFileId); } - inline bool visitFile(uint32_t fileId, const Path &path, uint32_t sourceFileId); + inline bool visitFile(uint32_t fileId, uint32_t sourceFileId); inline void releaseFileIds(const Set &fileIds); String fixIts(uint32_t fileId) const; int reindex(const Match &match, @@ -227,7 +219,7 @@ void dumpFileMaps(const std::shared_ptr &msg, const std::shared_ptr &conn); void removeSources(const Hash &sources); // key fileid, value fileid for compile_commands.json void removeSource(uint32_t fileId); - Hash visitedFiles() const + Set visitedFiles() const { std::lock_guard lock(mMutex); return mVisitedFiles; @@ -235,7 +227,10 @@ void encodeVisitedFiles(Serializer &serializer) { std::lock_guard lock(mMutex); - serializer << mVisitedFiles; + serializer << static_cast(mVisitedFiles.size()); + for (uint32_t fileId : mVisitedFiles) { + serializer << fileId << Location::path(fileId); + } } enum ScopeFlag { None = 0x0, NoValidate = 0x1 }; @@ -318,7 +313,7 @@ }; bool validate(uint32_t fileId, ValidateMode mode, String *error = 0) const; void removeDependencies(uint32_t fileId); - void updateDependencies(uint32_t fileId, const std::shared_ptr &msg, const UnsavedFiles &unsavedFiles); + void updateDependencies(uint32_t fileId, const std::shared_ptr &msg); void loadFailed(uint32_t fileId); void updateFixIts(const Set &visited, FixIts &fixIts); int startDirtyJobs(Dirty *dirty, @@ -447,7 +442,7 @@ Files mFiles; - Hash mVisitedFiles; + Set mVisitedFiles; int mJobCounter, mJobsStarted; time_t mLastIdleTime; @@ -478,18 +473,16 @@ RCT_FLAGS(Project::WatchMode); RCT_FLAGS(Project::ScopeFlag); -inline bool Project::visitFile(uint32_t visitFileId, const Path &path, uint32_t id) +inline bool Project::visitFile(uint32_t visitFileId, uint32_t id) { assert(id); std::lock_guard lock(mMutex); assert(visitFileId); - Path &p = mVisitedFiles[visitFileId]; assert(id); assert(mActiveJobs.contains(id)); std::shared_ptr &job = mActiveJobs[id]; assert(job); - if (p.isEmpty()) { - p = path; + if (mVisitedFiles.insert(visitFileId)) { job->visited.insert(visitFileId); return true; } diff -Nru rtags-2.31/src/QueryMessage.cpp rtags-2.33/src/QueryMessage.cpp --- rtags-2.31/src/QueryMessage.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/QueryMessage.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -19,21 +19,21 @@ #include "RTags.h" QueryMessage::QueryMessage(Type type) - : RTagsMessage(MessageId), mType(type), mMax(-1), mMinLine(-1), mMaxLine(-1), mBuildIndex(0), mTerminalWidth(-1) + : RTagsMessage(MessageId), mType(type), mMax(-1), mMaxDepth(-1), mMinLine(-1), mMaxLine(-1), mBuildIndex(0), mTerminalWidth(-1) { } void QueryMessage::encode(Serializer &serializer) const { serializer << mCommandLine << mQuery << mCodeCompletePrefix << mType << mFlags << mMax - << mMinLine << mMaxLine << mBuildIndex << mPathFilters << mKindFilters + << mMaxDepth << mMinLine << mMaxLine << mBuildIndex << mPathFilters << mKindFilters << mCurrentFile << mUnsavedFiles << mTerminalWidth; } void QueryMessage::decode(Deserializer &deserializer) { deserializer >> mCommandLine >> mQuery >> mCodeCompletePrefix >> mType >> mFlags >> mMax - >> mMinLine >> mMaxLine >> mBuildIndex >> mPathFilters >> mKindFilters + >> mMaxDepth >> mMinLine >> mMaxLine >> mBuildIndex >> mPathFilters >> mKindFilters >> mCurrentFile >> mUnsavedFiles >> mTerminalWidth; } diff -Nru rtags-2.31/src/QueryMessage.h rtags-2.33/src/QueryMessage.h --- rtags-2.31/src/QueryMessage.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/QueryMessage.h 2019-06-24 15:13:54.000000000 +0000 @@ -72,7 +72,8 @@ Suspend, SymbolInfo, Validate, - Tokens + Tokens, + IncludePath }; enum Flag { @@ -204,6 +205,9 @@ int minLine() const { return mMinLine; } int maxLine() const { return mMaxLine; } + int maxDepth() const { return mMaxDepth; } + void setMaxDepth(int depth) { mMaxDepth = depth; } + int max() const { return mMax; } void setMax(int max) { mMax = max; } @@ -243,7 +247,7 @@ String mQuery, mCodeCompletePrefix; Type mType; Flags mFlags; - int mMax, mMinLine, mMaxLine, mBuildIndex; + int mMax, mMaxDepth, mMinLine, mMaxLine, mBuildIndex; List mPathFilters; KindFilters mKindFilters; Path mCurrentFile; diff -Nru rtags-2.31/src/RClient.cpp rtags-2.33/src/RClient.cpp --- rtags-2.31/src/RClient.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/RClient.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -178,6 +178,8 @@ { RClient::NoSpellCheckinging, "no-spell-checking", 0, CommandLineParser::NoValue, "Don't produce spell check info in diagnostics." }, { RClient::TokensIncludeSymbols, "tokens-include-symbols", 0, CommandLineParser::NoValue, "Include symbols for tokens." }, { RClient::NoRealPath, "no-realpath", 0, CommandLineParser::NoValue, "Don't resolve paths using realpath(3)." }, + { RClient::IncludePath, "include-path", 0, CommandLineParser::Required, "Dump include path for symbol." }, + { RClient::MaxDepth, "max-depth", 0, CommandLineParser::Required, "Max search depth. Used for --include-path." }, { RClient::None, String(), 0, CommandLineParser::NoValue, 0 } }; @@ -222,6 +224,7 @@ msg.setTerminalWidth(rc->terminalWidth()); msg.setCurrentFile(rc->currentFile()); msg.setCodeCompletePrefix(rc->codeCompletePrefix()); + msg.setMaxDepth(rc->maxDepth()); return connection->send(msg) ? RTags::Success : RTags::NetworkFailure; } @@ -314,7 +317,7 @@ }; RClient::RClient() - : mMax(-1), mTimeout(-1), mMinOffset(-1), mMaxOffset(-1), + : mMax(-1), mMaxDepth(-1), mTimeout(-1), mMinOffset(-1), mMaxOffset(-1), mConnectTimeout(DEFAULT_CONNECT_TIMEOUT), mBuildIndex(0), mLogLevel(LogLevel::Error), mTcpPort(0), mGuessFlags(false), mTerminalWidth(-1), mExitCode(RTags::ArgumentParseError) @@ -635,7 +638,7 @@ case VerifyVersion: { const int version = strtoul(value.constData(), 0, 10); if (version != NumOptions) { - fprintf(stdout, "Protocol version mismatch\n"); + fprintf(stdout, "Protocol version mismatch got: %d expected: %d \n", version, NumOptions); mExitCode = RTags::ProtocolFailure; return { String(), CommandLineParser::Parse_Error }; } @@ -1296,6 +1299,23 @@ case ReferenceName: { addQuery(QueryMessage::ReferencesName, std::move(value)); break; } + case IncludePath: { + String encoded = Location::encode(value); + if (encoded.isEmpty()) { + return { String::format<1024>("include path can't resolve argument %s", value.constData()), CommandLineParser::Parse_Error }; + } + + addQuery(QueryMessage::IncludePath, std::move(encoded)); + break; } + case MaxDepth: { + const int depth = atoi(value.constData()); + if (depth <= 0) { + return { String::format<1024>("Invalid depth %s", value.constData()), CommandLineParser::Parse_Error }; + } + + mMaxDepth = depth; + break; } + } return { String(), CommandLineParser::Parse_Exec }; }; diff -Nru rtags-2.31/src/RClient.h rtags-2.33/src/RClient.h --- rtags-2.31/src/RClient.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/RClient.h 2019-06-24 15:13:54.000000000 +0000 @@ -91,6 +91,7 @@ HasFileManager, Help, IncludeFile, + IncludePath, IsIndexed, IsIndexing, JSON, @@ -107,6 +108,7 @@ MatchCaseInsensitive, MatchRegex, Max, + MaxDepth, NoColor, NoContext, NoRealPath, @@ -168,6 +170,7 @@ CommandLineParser::ParseStatus parse(size_t argc, char **argv); int max() const { return mMax; } + int maxDepth() const { return mMaxDepth; } LogLevel logLevel() const { return mLogLevel; } int timeout() const { return mTimeout; } int buildIndex() const { return mBuildIndex; } @@ -204,7 +207,7 @@ void addCompile(Path &&compileCommands); Flags mQueryFlags; - int mMax, mTimeout, mMinOffset, mMaxOffset, mConnectTimeout, mBuildIndex; + int mMax, mMaxDepth, mTimeout, mMinOffset, mMaxOffset, mConnectTimeout, mBuildIndex; LogLevel mLogLevel; Set mPathFilters; QueryMessage::KindFilters mKindFilters; diff -Nru rtags-2.31/src/rct/rct/DataFile.h rtags-2.33/src/rct/rct/DataFile.h --- rtags-2.31/src/rct/rct/DataFile.h 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/rct/DataFile.h 2019-06-24 15:13:56.000000000 +0000 @@ -82,7 +82,7 @@ int version; (*mDeserializer) >> version; if (version != mVersion) { - mError = String::format<128>("Wrong database version. Expected %d, got %d for %s.", + mError = String::format<128>("Wrong database version. Expected %d, got %d for %s", mVersion, version, mPath.constData()); return false; } diff -Nru rtags-2.31/src/rct/rct/Plugin.h rtags-2.33/src/rct/rct/Plugin.h --- rtags-2.31/src/rct/rct/Plugin.h 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/rct/Plugin.h 2019-06-24 15:13:56.000000000 +0000 @@ -8,7 +8,7 @@ namespace Rct { void* loadPlugin(const Path& fileName); -void unloadPlugin(void* handle); +void unloadPlugin(void* handle); void* resolveSymbol(void* handle, const char* symbol); char* pluginError(); } diff -Nru rtags-2.31/src/rct/rct/Process.cpp rtags-2.33/src/rct/rct/Process.cpp --- rtags-2.31/src/rct/rct/Process.cpp 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/rct/Process.cpp 2019-06-24 15:13:56.000000000 +0000 @@ -406,7 +406,8 @@ ProcessThread::setPending(1); - mPid = ::fork(); + pid_t oldPid; + oldPid = mPid = ::fork(); if (mPid == -1) { //printf("fork, something horrible has happened %d\n", errno); // bail out @@ -579,7 +580,7 @@ eintrwrap(w, ::close(mSync[0])); mSync[0] = -1; } - mFinished(this); + mFinished(this, oldPid); return Done; } if (timeout) { @@ -713,8 +714,10 @@ void Process::finish(int returnCode) { + pid_t oldPid; { std::lock_guard lock(mMutex); + oldPid = mPid; mReturn = returnCode; mStdInBuffer.clear(); @@ -740,7 +743,7 @@ } if (mMode == Async) - mFinished(this); + mFinished(this, oldPid); } void Process::handleInput(int fd) @@ -868,7 +871,7 @@ bool Process::isFinished() const { std::lock_guard lock(mMutex); - return mReturn != ReturnUnset; + return mReturn != ReturnUnset; } String Process::errorString() const diff -Nru rtags-2.31/src/rct/rct/Process.h rtags-2.33/src/rct/rct/Process.h --- rtags-2.31/src/rct/rct/Process.h 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/rct/Process.h 2019-06-24 15:13:56.000000000 +0000 @@ -18,8 +18,6 @@ class Process { public: - typedef Signal > SignalOnData; -public: /** * Constructor. */ @@ -133,9 +131,10 @@ */ void kill(int signal = SIGTERM); - SignalOnData &readyReadStdOut() { return mReadyReadStdOut; } - SignalOnData &readyReadStdErr() { return mReadyReadStdErr; } - SignalOnData &finished() { return mFinished; } +public: + Signal > &readyReadStdOut() { return mReadyReadStdOut; } + Signal > &readyReadStdErr() { return mReadyReadStdErr; } + Signal > &finished() { return mFinished; } /** * Get this process' environment. This can be used as a starting point to @@ -177,13 +176,13 @@ private: // members for windows and non-windows implementations /// Will be notified when child sends something over its stdout - SignalOnData mReadyReadStdOut; + Signal > mReadyReadStdOut; /// Will be notified when child sends something over its stderr - SignalOnData mReadyReadStdErr; + Signal > mReadyReadStdErr; /// Will be notified when the child process finishes. - SignalOnData mFinished; + Signal > mFinished; enum { Sync, Async } mMode; @@ -245,9 +244,7 @@ void closeStdErr(); void handleInput(int fd); - void handleOutput(int fd, String &buffer, int &index, SignalOnData &signal); - - + void handleOutput(int fd, String &buffer, int &index, Signal > &signal); private: // members not required for the windows implementation diff -Nru rtags-2.31/src/rct/tests/CMakeLists.txt rtags-2.33/src/rct/tests/CMakeLists.txt --- rtags-2.31/src/rct/tests/CMakeLists.txt 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/tests/CMakeLists.txt 2019-06-24 15:13:56.000000000 +0000 @@ -23,7 +23,7 @@ link_directories(${CPPUNIT_LIBRARY_DIRS} ${PROJECT_BINARY_DIR} ${RCT_BINARY_DIR}) -set(RCT_TEST_SRCS main.cpp PathTestSuite.cpp ProcessTestSuite.cpp MemoryMappedFileTestSuite.cpp StringTokenizerTestSuite.cpp) +set(RCT_TEST_SRCS main.cpp PathTestSuite.cpp MemoryMappedFileTestSuite.cpp StringTokenizerTestSuite.cpp) if (OPENSSL_FOUND) list(APPEND RCT_TEST_SRCS SHA256TestSuite.cpp) endif () @@ -32,6 +32,10 @@ list(APPEND RCT_TEST_SRCS DateTestSuite.cpp) endif() +if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + list(APPEND RCT_TEST_SRCS ProcessTestSuite.cpp) +endif() + if (RCT_NO_LIBRARY) list(APPEND RCT_TEST_SRCS ${RCT_SOURCES}) endif () diff -Nru rtags-2.31/src/rct/tests/FindCPPUNIT.cmake rtags-2.33/src/rct/tests/FindCPPUNIT.cmake --- rtags-2.31/src/rct/tests/FindCPPUNIT.cmake 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/tests/FindCPPUNIT.cmake 2019-06-24 15:13:56.000000000 +0000 @@ -18,7 +18,7 @@ include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set CPPUNIT_FOUND to TRUE # if all listed variables are TRUE -find_package_handle_standard_args(CPPUNIT DEFAULT_MSG +find_package_handle_standard_args(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARY CPPUNIT_INCLUDE_DIR) mark_as_advanced(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARY ) diff -Nru rtags-2.31/src/rct/tests/ProcessTestSuite.cpp rtags-2.33/src/rct/tests/ProcessTestSuite.cpp --- rtags-2.31/src/rct/tests/ProcessTestSuite.cpp 2019-03-13 06:02:57.000000000 +0000 +++ rtags-2.33/src/rct/tests/ProcessTestSuite.cpp 2019-06-24 15:13:56.000000000 +0000 @@ -263,7 +263,7 @@ stderrData.append(pp->readAllStdErr().c_str()); }); - p.finished().connect([&](Process* pp) + p.finished().connect([&](Process* pp, pid_t) { std::lock_guard lock(mut); if(pp != &p) wrongProcessObjPassed = true; diff -Nru rtags-2.31/src/rdm.cpp rtags-2.33/src/rdm.cpp --- rtags-2.31/src/rdm.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/rdm.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -338,7 +338,7 @@ { CompletionNoFilter, "completion-no-filter", 0, CommandLineParser::NoValue, "Don't filter private members and destructors from completions." }, { CompletionLogs, "completion-logs", 0, CommandLineParser::NoValue, "Log more info about completions." }, { CompletionDiagnostics, "completion-diagnostics", 0, CommandLineParser::Optional, "Send diagnostics from completion thread." }, - { RPDaemon, "rp-daemon", 0, CommandLineParser::NoValue, "Keep rp's alive as daemons and cache the last tu." }, + { RPDaemon, "rp-daemon", 0, CommandLineParser::Required, "Keep this many rp daemons alive and cache the last tu. Default to 1" }, { MaxIncludeCompletionDepth, "max-include-completion-depth", 0, CommandLineParser::Required, "Max recursion depth for header completion (default " STR(DEFAULT_MAX_INCLUDE_COMPLETION_DEPTH) ")." }, { AllowWpedantic, "allow-Wpedantic", 'P', CommandLineParser::NoValue, "Don't strip out -Wpedantic. This can cause problems in certain projects." }, { AllowWErrorAndWFatalErrors, "allow-Werror", 0, CommandLineParser::NoValue, "Don't strip out -Werror and -Wfatal-errors. By default these are stripped out. " }, @@ -561,7 +561,13 @@ serverOpts.options |= Server::RPLogToSyslog; break; } case RPDaemon: { - serverOpts.options |= Server::RPDaemon; + serverOpts.daemonCount = atoi(value.constData()); + if (!serverOpts.daemonCount && value != "0") + serverOpts.daemonCount = -1; + if (serverOpts.daemonCount < 0) { + return { String::format<1024>("Invalid argument to --rp-daemon %s", value.constData()), CommandLineParser::Parse_Error }; + } + break; } case StartSuspended: { serverOpts.options |= Server::StartSuspended; diff -Nru rtags-2.31/src/rp.cpp rtags-2.33/src/rp.cpp --- rtags-2.31/src/rp.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/rp.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -90,6 +90,9 @@ signal(SIGSEGV, sigHandler); signal(SIGABRT, sigHandler); signal(SIGBUS, sigHandler); + signal(SIGALRM, [](int) { + ClangIndexer::transition(ClangIndexer::Stopped); + }); Flags logFlags = LogStderr; std::shared_ptr closer; @@ -103,7 +106,7 @@ RTags::initMessages(); auto eventLoop = std::make_shared(); eventLoop->init(EventLoop::MainEventLoop); - ClangIndexer indexer; + ClangIndexer indexer(daemon ? ClangIndexer::Daemon : ClangIndexer::Normal); while (true) { String data; @@ -127,9 +130,14 @@ if (!indexer.exec(data)) { error() << "ClangIndexer error"; return 3; - } else if (daemon) { - printf("@FINISHED@"); - fflush(stdout); + } + + if (daemon) { + if (ClangIndexer::state() == ClangIndexer::Running) { + printf("@FINISHED@"); + fflush(stdout); + } + ClangIndexer::transition(ClangIndexer::NotStarted); } else { break; } diff -Nru rtags-2.31/src/RTags.cpp rtags-2.33/src/RTags.cpp --- rtags-2.31/src/RTags.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/RTags.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -650,7 +650,7 @@ bool resolveAuto(const CXCursor &cursor, Auto *a) { CXType type = clang_getCursorType(cursor); - while (type.kind == CXType_Pointer) + while (type.kind == CXType_Pointer || type.kind == CXType_LValueReference || type.kind == CXType_RValueReference) type = clang_getPointeeType(type); if ( diff -Nru rtags-2.31/src/rtags.el rtags-2.33/src/rtags.el --- rtags-2.31/src/rtags.el 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/rtags.el 2019-06-24 15:13:54.000000000 +0000 @@ -5,7 +5,7 @@ ;; Author: Jan Erik Hanssen ;; Anders Bakken ;; URL: http://rtags.net -;; Version: 2.31 +;; Version: 2.33.128 ;; This file is not part of GNU Emacs. @@ -74,7 +74,7 @@ ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defconst rtags-protocol-version 128) -(defconst rtags-package-version "2.31") +(defconst rtags-package-version "2.33") (defconst rtags-popup-available (require 'popup nil t)) (defconst rtags-supported-major-modes '(c-mode c++-mode objc-mode) "Major modes RTags supports.") (defconst rtags-verbose-results-delimiter "------------------------------------------") @@ -123,7 +123,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defcustom rtags-enabled t "Whether RTags is enabled. We try to do nothing when it's not." - :group 'rtags :type 'boolean :safe 'booleanp) @@ -139,7 +138,6 @@ compilation-finish-functions)))) (defcustom rtags-suspend-during-compilation nil "Suspend during compilation." - :group 'rtags :type 'boolean :safe 'booleanp :set (lambda (var val) @@ -147,15 +145,20 @@ (rtags-set-suspend-during-compilation-enabled))) +(defcustom rtags-verify-protocol-version t + "Set to nil if you don't want to verify the protocol version. +Note that all sorts of wrong things could happen when running +with mismatched versions" + :type 'boolean + :safe 'booleanp) + (defcustom rtags-use-mark-as-current-symbol nil "Use mark, when visible as default for rtags-find-symbol." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-completing-read-behavior 'insert-default "Behavior for completing-read" - :group 'rtags :type '(choice (const :tag "insert default" insert-default) (const :tag "default when empty" default-when-empty) @@ -165,94 +168,79 @@ (defcustom rtags-use-bookmarks t "Whether RTags uses bookmarks for locations." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-find-file-absolute nil "Whether `rtags-find-file' shows absolute paths." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-wrap-results t "Whether `rtags-next-match'/`rtags-previous-match' wraps around." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-close-taglist-on-focus-lost nil "Whether `rtags-taglist' should close when it loses focus." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-close-taglist-on-selection t "Whether `rtags-taglist' should close when something is selected." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-follow-symbol-try-harder t "Fall back to string-matching, if follow symbol fails." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-reindex-on-save nil "Explicitly reindex files on save. This is only useful if your file system watching is not working." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-use-filename-completion t "Whether RTags special filename completion is enabled. Set to nil to enable ido-ubiquitous etc." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-diagnostics-use-pipe t "Whether diagnostics should use pipes. If you're running Emacs in cygwin you might have to set this to nil." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-autostart-diagnostics nil "Whether RTags automatically will restart diagnostics." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-spellcheck-enabled t "Whether RTags does syntax checking with overlays etc to mark errors, warnings and fixups." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-multiple-targets t "Whether RTags will offer multiple choices for `rtags-find-symbol-at-point' when appropriate, warnings and fixups." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-verbose-results nil "Print more verbose results buffer." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-sort-references-by-input t "Whether RTags sorts the references based on the input to `rtags-find-references'." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-completions-enabled nil "Whether completions are enabled." - :group 'rtags :type 'boolean :safe 'booleanp) @@ -291,7 +279,6 @@ Setting this variable directly has no effect, either set this variable using the Customize interface, `rtags-set-periodic-reparse-timeout', `customize-set-variable' or `custom-set-variables'." - :group 'rtags :type '(choice (const :tag "Unset" nil) number) :risky nil :set (lambda (var val) @@ -301,31 +288,26 @@ (defcustom rtags-update-current-project-timer-interval .5 "Interval for update current project timer." - :group 'rtags :type 'number :safe 'numberp) (defcustom rtags-imenu-syntax-highlighting nil "Set to t to enable syntax highlight in rtags-imenu. If rtags-imenu-syntax-highlighting is set to a number this is considered the max number of lines to highlight" - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-wildcard-symbol-names t "Allow use of * and ? to match symbol names." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-tracking nil "When on automatically jump to symbol under cursor in *RTags* buffer." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-tramp-enabled nil "Enable tramp support." - :group 'rtags :type 'boolean :safe 'booleanp) @@ -387,13 +369,11 @@ ;; (defcustom rtags-socket-file "" "Socket file to pass to rc." - :group 'rtags :type 'string :safe 'stringp) (defcustom rtags-socket-address"" "Socket address to pass to rc." - :group 'rtags :type 'string :safe 'stringp) @@ -410,83 +390,68 @@ \"Unable to connect to the RTags server. See BLAH to start it\") (t (rtags-error-message-default type))))" - :group 'rtags :type 'function) (defcustom rtags-find-file-prompt "Find files" "What prompt to use for `rtags-find-file'." - :group 'rtags :type 'string :type 'stringp) (defcustom rtags-track-container nil - "When on continually update current container (function/class/namespace) -on intervals." - :group 'rtags + "When on continually update current container (function/class/namespace) on intervals." :type 'boolean :safe 'booleanp) (defcustom rtags-error-timer-interval .5 "Interval for minibuffer error timer." - :group 'rtags :type 'number :safe 'numberp) (defcustom rtags-display-current-error-as-message t "Display error under cursor using (message)." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-display-current-error-as-tooltip nil "Display error under cursor using `popup-tip' (requires 'popup)." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-display-summary-as-tooltip rtags-popup-available "Display help / summary text using `popup-tip' (requires 'popup)." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-tooltips-enabled (and rtags-popup-available t) "Display help / summary text when hovering over symbols." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-error-timer-interval .5 "Interval for minibuffer error timer." - :group 'rtags :type 'number :safe 'numberp) (defcustom rtags-tracking-timer-interval .5 "Interval for tracking timer." - :group 'rtags :type 'number :safe 'numberp) (defcustom rtags-container-timer-interval .5 "Interval for container timer." - :group 'rtags :type 'number :safe 'numberp) (defcustom rtags-current-container-hook nil "Run after RTags has set the current container." - :group 'rtags :type 'hook) (defcustom rtags-is-indexable 'rtags-is-indexable-default "defun for determining what files are indexable by rtags." - :group 'rtags :type 'function) (defcustom rtags-bury-buffer-function 'rtags-bury-or-delete "The function used to bury or kill the current rtags buffer." - :group 'rtags :type '(radio (function-item rtags-bury-or-delete) (function-item quit-window) @@ -495,22 +460,18 @@ (defcustom rtags-after-find-file-hook nil "Run after RTags has jumped to a location possibly in a new file." - :group 'rtags :type 'hook) (defcustom rtags-mode-hook nil "Run when `rtags-mode' is started." - :group 'rtags :type 'hook) (defcustom rtags-diagnostics-hook nil "Run after diagnostics have been parsed." - :group 'rtags :type 'hook) (defcustom rtags-diagnostics-summary-in-mode-line t "Display diagnostics count (warnings, errors, fixits) in the mode line" - :group 'rtags :type 'boolean :set (lambda (var val) (set var val) @@ -520,135 +481,112 @@ (defcustom rtags-completions-hook nil "Run after completions have been parsed." - :group 'rtags :type 'hook) (defcustom rtags-edit-hook nil "Run before RTags tries to modify a buffer (from rtags-rename) return t if RTags is allowed to modify this file." - :group 'rtags :type 'hook) (defcustom rtags-switch-to-buffer-hook nil "Run after RTags has switched to a buffer" - :group 'rtags :type 'hook) (defcustom rtags-jump-to-first-match t "If t, jump to first match." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-highlight-current-line t "If t, highlight the current line in *RTags* buffer." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-timeout nil "Max amount of ms to wait before timing out requests." - :group 'rtags :type '(choice (const :tag "Unset" nil) integer) :safe 'integerp) (defcustom rtags-rc-binary-name "rc" "Name of rc binary file." - :group 'rtags :type 'string :risky t) (defcustom rtags-rdm-binary-name "rdm" "Name of rdm binary file." - :group 'rtags :type 'string :risky t) (defcustom rtags-path nil "Path to RTags executables." - :group 'rtags :type '(choice (const :tag "Unset" nil) directory) :risky t) (defcustom rtags-rc-config-path nil "Path to for configuration file for rc." - :group 'rtags :type '(choice (const :tag "Unset" nil) directory) :risky t) (defcustom rtags-install-path nil "Path to install rtags using rtags-package-install RTags executables." - :group 'rtags :type '(choice (const :tag "Unset" nil) directory) :risky t) (defcustom rtags-max-bookmark-count 100 "How many bookmarks to keep on the stack." - :group 'rtags :type 'integer :safe 'integerp) (defcustom rtags-rc-log-enabled nil "If t, log rc commands and responses." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-show-containing-function nil "If t, pass -o to rc to include containing function." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-enable-unsaved-reparsing nil "Whether rtags will reparse unsaved buffers as needed." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-reparse-timeout nil "Max number of ms you're willing to wait for a reparse to finish." - :group 'rtags :type '(choice (const :tag "Unset" nil) integer) :safe 'integerp) (defcustom rtags-find-file-case-insensitive nil "Treat files case-insensitively." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-symbolnames-case-insensitive nil "Treat symbol names case-insensitively." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-find-file-prefer-exact-match t "Jump directly to files that exactly match the filename for `rtags-find-file'." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-other-window-window-size-percentage 30 "Percentage size of other buffer." - :group 'rtags :type 'integer) (defcustom rtags-split-window-function 'split-window "Function to split window. default is `split-window'." - :group 'rtags :type 'function) (defcustom rtags-results-buffer-other-window nil "Open rtags find results buffer in `other-window'." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-other-window-function #'(lambda () (other-window 1)) "Function select another window. default is (`other-window' 1)." - :group 'rtags :type 'function) (defcustom rtags-buffer-follows-sandbox-id-match 'ask @@ -663,7 +601,6 @@ Note: If *RTags Diagnostics* is not running, then the 'match check' is not performed, because sandbox tracking is not needed then. Note: It is recommended to run each sandbox is separate Emacs process." - :group 'rtags :type '(choice (const :tag "Perform query without update" nil) (const :tag "Ask the user" ask) @@ -672,30 +609,25 @@ (defcustom rtags-includes-func 'rtags-dummy-includes-func "Function to return flags and include flags for rdm." - :group 'rtags :type 'function) (defcustom rtags-rdm-includes "" "Additional include paths." - :group 'rtags :type 'string :safe 'stringp) (defcustom rtags-process-flags "" "Flags for rdm." - :group 'rtags :type 'string :safe 'stringp) (defcustom rtags-rdm-process-use-pipe nil "If t, use pipes to communicate with rdm." - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-popup-results-buffer t "Popup the *RTags* buffer when more than one search result is obtained." - :group 'rtags :type 'boolean :safe 'booleanp) @@ -705,13 +637,11 @@ (const :tag "RTags (default)" default) (const :tag "Helm" helm) (const :tag "Ivy" ivy)) - :group 'rtags :type 'symbol :risky t) (defcustom rtags-imenu-kind-filter "-references,-vardecl,-parmdecl,-inclusiondirective,-*literal*,-enumconstantdecl,-classdecl-,-structdecl-,-classtemplate-,-statements,-lambdaexpr" "Argument passed to --kind-filter for `rtags-imenu'." - :group 'rtags :type 'string :safe 'stringp) @@ -727,14 +657,12 @@ - `rtags-find-references-at-point' - `rtags-find-all-references-at-point' - `rtags-print-class-hierarchy'" - :group 'rtags :type 'boolean :safe 'booleanp) (defcustom rtags-use-multiple-cursors nil "When non-nil, commands like `rtags-rename-symbol' may use features of the package `multiple-cursors', if it is installed." - :group 'rtags :type 'boolean :safe 'booleanp) @@ -742,64 +670,58 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Faces ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defface rtags-path nil "Path" :group 'rtags) -(defface rtags-context nil "Context" :group 'rtags) +(defface rtags-path nil "Path") +(defface rtags-context nil "Context") (defface rtags-warnline - '((((class color) (background light) (supports :underline (:style wave))) - :underline (:style wave :color "black") - :foreground "black" :background "yellow") - (((class color) (background dark) (supports :underline (:style wave))) - :underline (:style wave :color "white") - :foreground "white" :background "OrangeRed") - (t - :underline t :inherit error)) - "Face used for marking error lines." - :group 'rtags) + '((((class color) (background light) (supports :underline (:style wave))) + :underline (:style wave :color "black") + :foreground "black" :background "yellow") + (((class color) (background dark) (supports :underline (:style wave))) + :underline (:style wave :color "white") + :foreground "white" :background "OrangeRed") + (t + :underline t :inherit error)) + "Face used for marking error lines.") (defface rtags-errline - '((((class color) (background light) (supports :underline (:style wave))) - :underline (:style wave :color "red") - :foreground "red" :background "yellow") - (((class color) (background dark) (supports :underline (:style wave))) - :underline (:style wave :color "white") - :foreground "white" :background "red") - (t - :underline t :inherit error)) - "Face used for marking warning lines." - :group 'rtags) + '((((class color) (background light) (supports :underline (:style wave))) + :underline (:style wave :color "red") + :foreground "red" :background "yellow") + (((class color) (background dark) (supports :underline (:style wave))) + :underline (:style wave :color "white") + :foreground "white" :background "red") + (t + :underline t :inherit error)) + "Face used for marking warning lines.") (defface rtags-fixitline - '((((class color) (background light) (supports :underline (:style wave))) - :underline (:style wave :color "brown") - :foreground "brown" :background "yellow" :slant italic) - (((class color) (background dark) (supports :underline (:style wave))) - :underline (:style wave :color "white") - :foreground "white" :background "brown" :slant italic) - (t - :underline t :inherit error)) - "Face used for marking fixit lines." - :group 'rtags) + '((((class color) (background light) (supports :underline (:style wave))) + :underline (:style wave :color "brown") + :foreground "brown" :background "yellow" :slant italic) + (((class color) (background dark) (supports :underline (:style wave))) + :underline (:style wave :color "white") + :foreground "white" :background "brown" :slant italic) + (t + :underline t :inherit error)) + "Face used for marking fixit lines.") (defface rtags-current-line - '((((class color) (background dark)) (:background "gray19")) - (((class color) (background light)) (:background "LightGray")) - (t (:bold t))) - "Face used for highlighting current line." - :group 'rtags) + '((((class color) (background dark)) (:background "gray19")) + (((class color) (background light)) (:background "LightGray")) + (t (:bold t))) + "Face used for highlighting current line.") (defface rtags-skippedline - '((((class color) (background dark)) (:background "gray12")) - (((class color) (background light)) (:background "light gray"))) - "Face used for marking skipped lines." - :group 'rtags) + '((((class color) (background dark)) (:background "gray12")) + (((class color) (background light)) (:background "light gray"))) + "Face used for marking skipped lines.") (defface rtags-argument-face - '((((class color) (background dark)) (:background "blue")) ;; e.g. white on blue - (((class color) (background light)) (:background "cyan" )) ;; e.g. black on cyan - (t (:bold t))) - "Face used for marking error lines." - :group 'rtags) + '((((class color) (background dark)) (:background "blue")) ;; e.g. white on blue + (((class color) (background light)) (:background "cyan" )) ;; e.g. black on cyan + (t (:bold t))) + "Face used for marking error lines.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Logic @@ -1366,7 +1288,8 @@ (setq arguments (mapcar 'rtags-untrampify arguments)) ;; other way to ignore colors would IMHO be to configure tramp, ;; but: do we need colors from rc? - (push (format "-t%d" rtags-protocol-version) arguments) + (when rtags-verify-protocol-version + (push (format "-t%d" rtags-protocol-version) arguments)) (push "-z" arguments) (setq path (rtags-untrampify path)) (when path-filter @@ -1579,7 +1502,6 @@ (defcustom rtags-completing-read-behavior 'insert-default-marked "Behavior for completing-read" - :group 'rtags :type '(choice (const :tag "insert default" insert-default) (const :tag "default when empty" helm) @@ -1732,6 +1654,17 @@ (rtags-call-rc :path fn "--dependencies" fn args (unless rtags-print-filenames-relative "-K")) (rtags-mode)))) +(defun rtags-print-include-path () + "Print include path of the current symbol in cursor." + (interactive) + (let ((dep-buffer (rtags-get-buffer "*RTags Include Path*")) + (arg (rtags-current-location))) + (rtags-delete-rtags-windows) + (rtags-location-stack-push) + (rtags-switch-to-buffer dep-buffer) + (rtags-call-rc "--include-path" arg) + (rtags-mode))) + (defun rtags-find-dead-functions (&optional prefix buffer) "Print information about uncalled functions in buffer." (interactive "P") @@ -2658,7 +2591,7 @@ (define-key map (kbd (concat prefix "I")) 'rtags-imenu) (define-key map (kbd (concat prefix "T")) 'rtags-taglist) (define-key map (kbd (concat prefix "h")) 'rtags-print-class-hierarchy) - (define-key map (kbd (concat prefix "a")) 'rtags-print-source-arguments) + (define-key map (kbd (concat prefix "a")) 'rtags-expand-auto) (define-key map (kbd (concat prefix "A")) 'rtags-find-functions-called-by-this-function) (define-key map (kbd (concat prefix "l")) 'rtags-list-results) (define-key map (kbd (concat prefix "Z")) 'rtags-location-stack-visualize)) @@ -3996,6 +3929,19 @@ (let ((cur (rtags-dependency-tree-current-file))) (when cur (rtags-goto-location (car cur) nil other-window)))) + ((string= (buffer-name) "*RTags Include Path*") + (let (start path) + (save-excursion + (setq start (if (search-backward " " (point-at-bol) t) + (1+ (point)) + (point-at-bol)))) + (save-excursion + (setq path (buffer-substring-no-properties start + (if (search-forward " " (point-at-eol) t) + (1- (point)) + (point-at-eol))))) + (unless (string= "->" path) + (rtags-goto-location path)))) ((string= (buffer-name) "*RTags Location Stack*") (let ((index (- (length rtags-location-stack) line))) (setq rtags-location-stack-index index) @@ -5384,10 +5330,19 @@ (switch-to-buffer (process-buffer process))) (t nil)))) +(defun rtags-expand-auto () + (interactive) + (let* ((symbolinfo (rtags-symbol-info-internal)) + (auto (cdr (assoc 'auto symbolinfo))) + (type (and auto (cdr (assoc 'type symbolinfo))))) + (when type + (save-excursion + (when (re-search-backward "\\" nil t) + (kill-forward-chars 4) + (insert type)))))) (defcustom rtags-install-cmake-args nil "Additional arguments to cmake when building rtags with rtags-install." - :group 'rtags :type 'string :safe 'stringp) diff -Nru rtags-2.31/src/RTags.h rtags-2.33/src/RTags.h --- rtags-2.31/src/RTags.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/RTags.h 2019-06-24 15:13:54.000000000 +0000 @@ -152,14 +152,11 @@ struct TranslationUnit { TranslationUnit() - : index(0), unit(0) + : index(nullptr), unit(nullptr) {} ~TranslationUnit() { - if (unit) - clang_disposeTranslationUnit(unit); - if (index) - clang_disposeIndex(index); + clear(); } static void visit(CXCursor c, std::function func) { @@ -172,6 +169,18 @@ visit(cursor(), func); } + void clear() + { + if (unit) { + clang_disposeTranslationUnit(unit); + unit = nullptr; + } + if (index) { + clang_disposeIndex(index); + index = nullptr; + } + } + CXCursor cursor() const { return clang_getTranslationUnitCursor(unit); } bool reparse(CXUnsavedFile *unsaved, int unsavedCount); @@ -297,8 +306,12 @@ clang_disposeString(fn); return Location(); } - const Path p = Path::resolved(cstr); + bool ok; + Path p = Path::resolved(cstr, Path::RealPath, Path(), &ok); clang_disposeString(fn); + if (!ok) { + p.canonicalize(); + } return createLocation(p, line, col, blocked); } Location createLocation(const CXCursor &cursor, CXCursorKind kind = CXCursor_FirstInvalid, bool *blocked = 0, unsigned *offset = 0); diff -Nru rtags-2.31/src/Server.cpp rtags-2.33/src/Server.cpp --- rtags-2.31/src/Server.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Server.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -26,6 +26,7 @@ #include "ClassHierarchyJob.h" #include "CompletionThread.h" +#include "IncludePathJob.h" #include "DependenciesJob.h" #include "ClangThread.h" #include "FileManager.h" @@ -201,7 +202,10 @@ } mJobScheduler.reset(new JobScheduler); - mJobScheduler->setActiveJobs(mOptions.jobCount); + if (!mJobScheduler->start()) { + error() << "Failed to start job scheduler"; + return false; + } if (!load()) return false; @@ -305,31 +309,28 @@ return true; } - for (int i=0; i<10; ++i) { - mUnixServer.reset(new SocketServer); - warning() << "listening" << mOptions.socketFile; - if (mUnixServer->listen(mOptions.socketFile)) { - break; - } - mUnixServer.reset(); - if (!i) { - enum { Timeout = 1000 }; - std::shared_ptr connection = Connection::create(RClient::NumOptions); - if (connection->connectUnix(mOptions.socketFile, Timeout)) { - connection->send(QuitMessage()); - connection->disconnected().connect(std::bind([](){ EventLoop::eventLoop()->quit(); })); - connection->finished().connect(std::bind([](){ EventLoop::eventLoop()->quit(); })); - EventLoop::eventLoop()->exec(Timeout); - } - } else { + if (Path::exists(mOptions.socketFile)) { + enum { Timeout = 1000 }; + std::shared_ptr connection = Connection::create(RClient::NumOptions); + if (connection->connectUnix(mOptions.socketFile, Timeout)) { + connection->send(QuitMessage()); + connection->disconnected().connect(std::bind([](){ EventLoop::eventLoop()->quit(); })); + connection->finished().connect(std::bind([](){ EventLoop::eventLoop()->quit(); })); + EventLoop::eventLoop()->exec(Timeout); sleep(1); } + Path::rm(mOptions.socketFile); } - if (!mUnixServer) + + mUnixServer.reset(new SocketServer); + warning() << "listening" << mOptions.socketFile; + if (!mUnixServer->listen(mOptions.socketFile)) { + error() << "Failed to listen on " << mOptions.socketFile; return false; - mUnixServer->newConnection().connect(std::bind(&Server::onNewConnection, this, std::placeholders::_1)); + } + mUnixServer->newConnection().connect(std::bind(&Server::onNewConnection, this, std::placeholders::_1)); return true; } @@ -340,6 +341,8 @@ project.reset(new Project(path)); if (!project->init()) { Path::rmdir(project->projectDataDir()); + mProjects.erase(path); + return std::shared_ptr(); } } return project; @@ -578,6 +581,7 @@ const auto &env = compileCommandsFileId ? data.compileCommands[compileCommandsFileId].environment : data.environment; SourceList sources = Source::parse(arguments, pwd, env, &unresolvedPaths, cache); bool ret = (sources.isEmpty() && unresolvedPaths.size() == 1 && unresolvedPaths.front() == "-"); + debug() << "Got" << sources.size() << "sources, and" << unresolvedPaths << "from" << arguments; size_t idx = 0; for (Source &source : sources) { const Path path = source.sourceFile(); @@ -612,6 +616,8 @@ if (!list.contains(source)) list.append(source); ret = true; + } else { + debug() << "Shouldn't index" << source; } } return ret; @@ -801,6 +807,9 @@ case QueryMessage::Tokens: tokens(message, conn); break; + case QueryMessage::IncludePath: + includePath(message, conn); + break; } } @@ -1156,6 +1165,34 @@ conn->finish(ret); } +void Server::includePath(const std::shared_ptr &query, const std::shared_ptr &conn) +{ + const Location loc = query->location(); + if (loc.isNull()) { + conn->write("Not indexed"); + conn->finish(RTags::NotIndexed); + return; + } + + std::shared_ptr project = projectForQuery(query); + if (!project) { + error("No project"); + conn->write("Not indexed"); + conn->finish(RTags::NotIndexed); + return; + } + + prepareCompletion(query, loc.fileId(), project); + + { + IncludePathJob job(loc, query, project); + if (!job.run(conn)) { + conn->finish(); + return; + } + } +} + void Server::dependencies(const std::shared_ptr &query, const std::shared_ptr &conn) { Path path; @@ -2100,7 +2137,7 @@ if (project && project->isActiveJob(id)) { assert(message->file() == message->file().resolved()); fileId = Location::insertFile(message->file()); - visit = project->visitFile(fileId, message->file(), id); + visit = project->visitFile(fileId, id); } VisitFileResponseMessage msg(fileId, visit); conn->send(msg); @@ -2561,7 +2598,6 @@ // error() << Location::path(fileId) << "modified" << (mCompletionThread ? (mCompletionThread->isCached(project, fileId) ? 1 : 0) : -1); if (mCompletionThread && mCompletionThread->isCached(project, fileId)) { mCompletionThread->reparse(project, fileId); - } } diff -Nru rtags-2.31/src/Server.h rtags-2.33/src/Server.h --- rtags-2.31/src/Server.h 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Server.h 2019-06-24 15:13:54.000000000 +0000 @@ -87,8 +87,7 @@ Separate32BitAnd64Bit = (1ull << 31), SourceIgnoreIncludePathDifferencesInUsr = (1ull << 32), NoLibClangIncludePath = (1ull << 33), - CompletionDiagnostics = (1ull << 34), - RPDaemon = (1ull << 35) + CompletionDiagnostics = (1ull << 34) }; struct Options { Options() @@ -97,7 +96,7 @@ rpConnectAttempts(0), rpNiceValue(0), maxCrashCount(0), completionCacheSize(0), testTimeout(60 * 1000 * 5), maxFileMapScopeCacheSize(512), pollTimer(0), maxSocketWriteBufferSize(0), - tcpPort(0) + daemonCount(0), tcpPort(0) { } @@ -107,7 +106,7 @@ int rpVisitFileTimeout, rpIndexDataMessageTimeout, rpConnectTimeout, rpConnectAttempts, rpNiceValue, maxCrashCount, completionCacheSize, testTimeout, maxFileMapScopeCacheSize, errorLimit, - pollTimer, maxSocketWriteBufferSize; + pollTimer, maxSocketWriteBufferSize, daemonCount; uint16_t tcpPort; List defaultArguments, excludeFilters; Set blockedArguments; @@ -190,6 +189,7 @@ void codeCompleteAt(const std::shared_ptr &query, const std::shared_ptr &conn); void symbolInfo(const std::shared_ptr &query, const std::shared_ptr &conn); void dependencies(const std::shared_ptr &query, const std::shared_ptr &conn); + void includePath(const std::shared_ptr &query, const std::shared_ptr &conn); void startClangThread(const std::shared_ptr &query, const std::shared_ptr &conn); void dumpFileMaps(const std::shared_ptr &query, const std::shared_ptr &conn); void diagnose(const std::shared_ptr &query, const std::shared_ptr &conn); diff -Nru rtags-2.31/src/Source.cpp rtags-2.33/src/Source.cpp --- rtags-2.31/src/Source.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/Source.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -580,11 +580,18 @@ language = ObjectiveC; } else if (a == "objective-c++") { language = ObjectiveCPlusPlus; + } else if (arg.size() > 2) { + // intel compiler passes compiler options like SSE this way, + // just ignore: + // https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-x-qx + a.clear(); } else { return SourceList(); } - arguments.append("-x"); - arguments.append(a); + if (!a.isEmpty()) { + arguments.append("-x"); + arguments.append(a); + } } else if (arg.startsWith("-D")) { Define define; String def, a; diff -Nru rtags-2.31/src/StatusJob.cpp rtags-2.33/src/StatusJob.cpp --- rtags-2.31/src/StatusJob.cpp 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/src/StatusJob.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -266,13 +266,11 @@ } write(String::format<1024>(" File: %s\n" " Last-Modified: %s (%llu)\n" - " Bytes written: %zu\n" - " Environment: %s\n", + " Bytes written: %zu\n", Location::path(info.first).constData(), String::formatTime(info.second.lastModifiedMs / 1000).constData(), static_cast(info.second.lastModifiedMs), - proj->bytesWritten(), - String::join(info.second.environment, '\n').constData())); + proj->bytesWritten())); } matched = true; diff -Nru rtags-2.31/tests/automated/PrintIncludePathOutput/a.hpp rtags-2.33/tests/automated/PrintIncludePathOutput/a.hpp --- rtags-2.31/tests/automated/PrintIncludePathOutput/a.hpp 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/tests/automated/PrintIncludePathOutput/a.hpp 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,3 @@ +#pragma once + +void bar() {}; diff -Nru rtags-2.31/tests/automated/PrintIncludePathOutput/expectation.json rtags-2.33/tests/automated/PrintIncludePathOutput/expectation.json --- rtags-2.31/tests/automated/PrintIncludePathOutput/expectation.json 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/tests/automated/PrintIncludePathOutput/expectation.json 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,5 @@ +[ + { "name": "print_include_path", + "rc-command": [ "--include-path", "{0}/main.cpp:4:5"], + "expectation": ["main.cpp -> a.hpp"] } +] diff -Nru rtags-2.31/tests/automated/PrintIncludePathOutput/main.cpp rtags-2.33/tests/automated/PrintIncludePathOutput/main.cpp --- rtags-2.31/tests/automated/PrintIncludePathOutput/main.cpp 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/tests/automated/PrintIncludePathOutput/main.cpp 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,5 @@ +#include "a.hpp" + +void foo() { + bar(); +} diff -Nru rtags-2.31/tests/automated/test_runner.py rtags-2.33/tests/automated/test_runner.py --- rtags-2.31/tests/automated/test_runner.py 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/tests/automated/test_runner.py 2019-06-24 15:13:54.000000000 +0000 @@ -61,6 +61,9 @@ return [Location( os.path.join(test_dir, line[0]), line[1], line[2]) for line in lines] +def read_outputs(lines): + """Read output.""" + return [line for line in lines.split("\n") if len(line) > 0] class Location(object): """Class representing location in file.""" @@ -96,6 +99,7 @@ location = 1 parse = 2 completion = 3 + output = 4 def run_location(test_dir, rc_command, expected): """Run location test, and compare with EXPECTED output.""" @@ -121,6 +125,15 @@ for output in outputs: assert_that(expected, has_item(output)) +def run_output(test_dir, rc_command, expected): + """Run output test, and compare with EXPECTED output.""" + actual_outputs = read_outputs(run_rc([c.format(test_dir) for c in rc_command])) + # Compare that we have the same results in length and content + assert_that(actual_outputs, has_length(len(expected))) + for expected_output_string in expected: + expected_output = expected_output_string.format(test_dir) + assert_that(actual_outputs, has_item(expected_output)) + def run(test_dir, rc_command, expected, test_type): """Run test.""" if test_type == TestType.location: @@ -129,7 +142,8 @@ run_parse(test_dir, rc_command, expected) elif test_type == TestType.completion: run_completion(test_dir, rc_command, expected) - + elif test_type == TestType.output: + run_output(test_dir, rc_command, expected) def setup_rdm(test_dir, test_files): """Start rdm and parse the test files.""" @@ -173,6 +187,9 @@ if "Completion" in test_dir: return TestType.completion + if "Output" in test_dir: + return TestType.output + return TestType.location def test_generator(): diff -Nru rtags-2.31/tests/lisp/rtags-test.el rtags-2.33/tests/lisp/rtags-test.el --- rtags-2.31/tests/lisp/rtags-test.el 1970-01-01 00:00:00.000000000 +0000 +++ rtags-2.33/tests/lisp/rtags-test.el 2019-06-24 15:13:54.000000000 +0000 @@ -0,0 +1,39 @@ +;; rtags-test.el --- Tests for rtags.el -*- lexical-binding: t ; -*- + +;; Copyright (c) 2019 Christian Schwarzgruber + +;; Author: Christian Schwarzgruber + +;; This file is not part of GNU Emacs. + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 3, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. + +;;; Commentary: + + +;;; Code: + +(require 'rtags) +(require 'ert) + +(ert-deftest rtags-protocol-version-test () + "Test if the protocol version matches." + (rtags-start-process-unless-running) + (sit-for .5) ;; Uuh, that's nasty :) + (rtags-call-rc "-w")) + + +;;; rtags-test.el ends here diff -Nru rtags-2.31/tests/sbroot/sbroot_test.pl rtags-2.33/tests/sbroot/sbroot_test.pl --- rtags-2.31/tests/sbroot/sbroot_test.pl 2019-03-13 06:02:56.000000000 +0000 +++ rtags-2.33/tests/sbroot/sbroot_test.pl 2019-06-24 15:13:54.000000000 +0000 @@ -264,6 +264,7 @@ my $cmd = ("$rdm ". "--socket-file=$sockFile ". "--no-rc ". + "--enable-compiler-manager ". "--data-dir=$rtagsDir/rtags_db ". "--log-file-log-level=debug ". "--log-file=$rtagsDir/rdm.log ".