Ensure that move_raw clang tool is well replaced with clang-tidy |
|||
Issue descriptionThe check done by tools/clang/move_raw is contained in clang-tidy: https://clang.llvm.org/extra/clang-tidy/checks/misc-move-const-arg.html. This task tracks: (1) Checking that clang-tidy is actually comparable easy to use as the clang tool. (2) Updating the docs https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md to contain as easy an flow as currently possible. (3) Deleting move_raw it clang-tidy is reasonably useful, or restarting the discussion from https://codereview.chromium.org/2919243002/ is not.
,
Jul 1 2017
I suspect I'm holding it wrong. dcheng@ or thakis@, if you spot what I'm doing wrong, please let me know: Following https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md was actually surprisingly easy, and I ended up with my own clang-tidy compiled and running against my compilation. However, clang-tidy reports just success and does not report any issues. I put the following code inside base/values_unittest.cc (chosen randomly): int F() { return std::move(42); } TEST(ClangTidy, MiscMoveConstArg) { EXPECT_EQ(42, F()); } Then I build base_unittests in debug (also in release, none worked): ninja -C out/gn-dbg/ base_unittests Then I generated the compile DB: tools/clang/scripts/generate_compdb.py -p out/gn-dbg/ > compile_commands.json Then I ran clang-tidy: cd out/gn-dbg export LLVM_DIR=... # The dir with llvm repo under llvm/ and build dir under build/ $LLVM_DIR/llvm/tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -p ../.. -clang-tidy-binary $LLVM_DIR/build/bin/clang-tidy -clang-apply-replacements-binary $LLVM_DIR/build/bin/clang-apply-replacements -checks='-*,misc-move-const-arg' -fix base/values_unittests.cc The output was: ----- Enabled checks: misc-move-const-arg clang-apply-replacements version 5.0.0 Applying fixes ... ----- And no files were changed.
,
Jul 1 2017
I should also say that the code supposed to break was adapted from https://github.com/llvm-mirror/clang-tools-extra/blob/master/test/clang-tidy/misc-move-const-arg.cpp. So I'm sure I do something wrong, I just don't see what it is.
,
Jul 1 2017
(And 'ninja check-clang-tools' in my llvm/build dir passes.)
,
Oct 20 2017
Note for myself: https://crbug.com/403854#c13 contains step-by-step instructions for running clang-tidy. I should try them once I get to retrying #2 here.
,
Apr 6 2018
I don't think I will have time to look into clang-tidy any time soon. The move_raw clang tool is long gone (r531197), so this is not blocking anyone. Therefore, let me close this task. |
|||
►
Sign in to add a comment |
|||
Comment 1 by vabr@chromium.org
, Jun 22 2017