从命令行自动应用 Clang 的修复提示

Apply Clang's fix-it hints automatically from command line

本文关键字:提示 Clang 应用 命令行      更新时间:2023-10-16

Clang(和GCC(编译错误可以附带有关如何修复它们的建议:"修复提示"。Clang(或者另一个LLVM工具(是否有应用这些提示的选项?我在 https://clang.llvm.org/docs/UsersManual.html 中看不到一个。显然,这样的程序可以使用-fdiagnostics-parseable-fixits编写;这不是我要问的。

是的。

 -fix-only-warnings      Apply fix-it advice only for warnings, not errors
 -fix-what-you-can       Apply fix-it advice even in the presence of unfixable errors
 -fixit-recompile        Apply fix-it changes and recompile
 -fixit-to-temporary     Apply fix-it changes to temporary files
 -fixit=<value>          Apply fix-it advice creating a file with the given suffix
 -fixit                  Apply fix-it advice to the input source