C++11 解决与clang tidy的冲突使用
在整个CMake项目中,我使用clang tidy中的modernize use use using checker,通过run-clang-tidy-3.9.py脚本(我使用CMake生成的compile_commands.json文件) 这对于其他现代化检查器(自动、for循环、override等)非常有效,但是使用现代化检查器会发现“冲突”,例如:C++11 解决与clang tidy的冲突使用,c++11,clang-format,clang-static-analyzer,C++11,Clang Format,Clang Static Analyzer,在整个CMake项目中,我使用clang tidy中的modernize use use using checker,通过run-clang-tidy-3.9.py脚本(我使用CMake生成的compile_commands.json文件) 这对于其他现代化检查器(自动、for循环、override等)非常有效,但是使用现代化检查器会发现“冲突”,例如: There are conflicting changes to /home/OTB/git/otb/Modules/Filterin
There are conflicting changes to /home/OTB/git/otb/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h:
The following changes conflict:
Replace 48:3-48:84 with "using RealType = typename itk::NumericTraits<typename TInput::ValueType>::RealType"
Replace 48:3-48:84 with "using RealType = typename itk::NumericTraits<typename VariableLengthVector<double>::ValueType>::RealType"
Replace 48:3-48:84 with "using RealType = typename itk::NumericTraits<typename VariableLengthVector<float>::ValueType>::RealType"
对/home/OTB/git/OTB/Modules/Filtering/ImageManipulation/include/otbVectorRescaleIntensityImageFilter.h的更改存在冲突:
以下更改相互冲突:
将48:3-48:84替换为“使用RealType=typename itk::NumericTraits::RealType”
将48:3-48:84替换为“使用RealType=typename itk::NumericTraits::RealType”
将48:3-48:84替换为“使用RealType=typename itk::NumericTraits::RealType”
看看源代码,我不明白为什么会有这样的冲突,但问题是,因为这些,没有其他修复应用到我的项目。相对于修复的数量来说,这些冲突很少,但是我找不到一种方法来强制ClangTidy应用其余的
当单独运行时,clang tidy工具有一个-fix errors选项,但这对于使用CMake命令文件的run clang tidy脚本不可用
如有任何建议,将不胜感激
谢谢
从LLVM 5.0开始运行clangtidy.py
似乎使用-fix
作为其命令行标志来应用修复。这就是您想要的吗?还是您需要完整的-修复错误功能?如果是后者,可以将其添加到添加-fix
参数的行后面的run clang tidy.py
文件中,这样fix errors
也可以作为参数使用。虽然我还没有试过,但它似乎应该能起作用。