Open llvmbot opened 5 years ago
One more thing: it's impossible to disable those fix-its in clang-tidy. They are always enabled.
Use-Case: I'm creating separate commits for each clang-tidy fixit while ~100 other people write more code. So the result is that sometimes a clang fix-it sneaks into one of my commits. E.g. I want a commit with only modernize-use-equals-default, but I have (correct) improvements about "return std::move(...)" --> "return ..." in the same commit. I have to remove them manually in order to apply them separately later.
Clang itself emits the same warning and suggestion, but there is no way to fix-it from there.
This can be accomplished today by using the -fixit flag. Right now that's not exposed by the driver, so you need to use -Xclang -fixit; maybe we should consider exposing it for end user use.
Extended Description
Hello,
clang-tidy can not only be used to improve code, but also to make it work in the first place.
Taking an example from https://github.com/llvm-mirror/clang/blob/master/test/SemaTemplate/dependent-template-recover.cpp
Clang-tidy is capable of fixing that error. However it’s not possible to fix it without running any other checks?! e.g. this works fine: clang-tidy --checks="*" test.cpp -fix-errors but it performs all sorts of other changes.
The best approach seems to be to pick some checker that doesn’t find anything in order to fix only errors ?!
Clang itself emits the same warning and suggestion, but there is no way to fix-it from there. See https://godbolt.org/z/iXXy4o
According to http://lists.llvm.org/pipermail/cfe-dev/2019-October/063703.html I'm hereby trying to file the idea here to have either some clang -fix option or clang-tidy running without mandatory checkers.