Thank you for your answer.

In the mean-time I have been thinking some more and what I am afraid of is that the result will not be correct if the flags to clang-tidy change.

A typical command run by make looks like this:

cd /home/dev/erx-soft/cmake-build-debug/modules/utils && ccache /home/dev/clion-2020.1.3/bin/cmake/linux/bin/cmake -E __run_co_compile --launcher=ccache --tidy="clang-tidy-10;-warnings-as-errors=*;-header-filter=/home/dev/erx-soft/modules/utils/*;--checks=-*,bugprone-argument-comment,bugprone-assert-side-effect,bugprone-bad-signal-to-kill-thread,bugprone-bool-pointer-implicit-conversion,bugprone-branch-clone,bugprone-copy-constructor-init,bugprone-dangling-handle,bugprone-dynamic-static-initializers,bugprone-exception-escape,bugprone-fold-init-type,bugprone-forward-declaration-namespace,bugprone-forwarding-reference-overload,bugprone-inaccurate-erase,bugprone-incorrect-roundings,bugprone-infinite-loop,bugprone-integer-division,bugprone-lambda-function-name,bugprone-macro-parentheses,bugprone-macro-repeated-side-effects,bugprone-misplaced-operator-in-strlen-in-alloc,bugprone-misplaced-pointer-arithmetic-in-alloc,bugprone-misplaced-widening-cast,bugprone-move-forwarding-reference,bugprone-multiple-statement-macro,bugprone-not-null-terminated-result,bugprone-parent-virtual-call,bugprone-posix-return,bugprone-reserved-identifier,bugprone-signed-char-misuse,bugprone-sizeof-container,bugprone-sizeof-expression,bugprone-spuriously-wake-up-functions,bugprone-string-constructor,bugprone-string-integer-assignment,bugprone-string-literal-with-embedded-nul,bugprone-suspicious-enum-usage,bugprone-suspicious-include,bugprone-suspicious-memset-usage,bugprone-suspicious-missing-comma,bugprone-suspicious-semicolon,bugprone-suspicious-string-compare,bugprone-swapped-arguments,bugprone-terminating-continue,bugprone-throw-keyword-missing,bugprone-too-small-loop-variable,bugprone-undefined-memory-manipulation,bugprone-undelegated-constructor,bugprone-unhandled-self-assignment,bugprone-unused-raii,bugprone-unused-return-value,bugprone-use-after-move,bugprone-virtual-near-miss" --source=/home/dev/erx-soft/modules/utils/src/DevSerialHelper.cpp -- /usr/bin/clang++-10 -DASSETS_LOCATION_DIR=\"/home/dev/erx-soft/assets/\" -DCPU_ONLY -DLOG_DIR=\"/mnt/erxssd/runs/current/\" -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -I/home/dev/erx-soft/cmake-build-debug -I/home/dev/erx-soft/modules/utils/include -I/home/dev/erx-soft/modules/utils/src -I/home/dev/erx-soft/libs/serializable_objects/cpp/include -I/home/dev/erx-soft/cmake-build-debug/libs/serializable_objects/cpp/generated_fbs -I/home/dev/erx-soft/external/jsoncpp/src/lib_json/../../include -I/home/dev/erx-soft/cmake-build-debug/external/jsoncpp/include/json -I/home/dev/erx-soft/external/spdlog/include -I/home/dev/erx-soft/external/fmt/include -I/home/dev/erx-soft/modules/logger/include -isystem /opt/erx/include -isystem /opt/erx/include/opencv  -Werror -Wall -Wshadow-all -Wunreachable-code -Wno-error=undefined-inline -Wno-error=#pragma-messages -fno-limit-debug-info -fcolor-diagnostics -g   -Werror -pthread -std=gnu++17 -o CMakeFiles/utils.dir/src/DevSerialHelper.cpp.o -c /home/dev/erx-soft/modules/utils/src/DevSerialHelper.cpp


In other words: it seems like ccache could also hash the flags to clang-tidy. The question: does it?

Now that I am looking at the above command line: Will this require to also modify the cmake binary to generate other command lines?

Maybe I'll find the time to look more into this in two weeks.

Regards,
Christian

On 02.08.20 19:28, Joel Rosdahl wrote:
On Sun, 2 Aug 2020 at 18:55, Christian Ledergerber via ccache
<ccache@lists.samba.org> wrote:
[...]
To me it seems like the following should work:

1. try to use ccache

2. if no hit:

- run clang-tidy

- run clang

For this I would need to know whether ccache generated a hit - lets say
as return code of the executable.
I don't think there's a good way of accomplishing this without adding
code to ccache to optionally exit with failure on a cache miss. But it
would be easy to add it.

Regards,
Joel


_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to