【问题标题】:Apply Clang's fix-it hints automatically from command line从命令行自动应用 Clang 的修复提示
【发布时间】:2018-04-10 08:35:09
【问题描述】:

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

【问题讨论】:

  • 除了问是否可以,我们还需要问是否应该。 DWIM 是一种隐藏错误的优秀方法。我们都知道我们希望那些尽可能隐藏:P
  • 为什么要问“我们是否应该”而不是“它是否有可能的特定用途”?

标签: c++ clang


【解决方案1】:

是的。

 -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

【讨论】:

  • 找到了,需要在-Xclang之后通过。
猜你喜欢
  • 2019-09-18
  • 2018-12-21
  • 1970-01-01
  • 2021-02-12
  • 1970-01-01
  • 2017-02-26
  • 1970-01-01
  • 2012-03-16
  • 2017-06-26
相关资源
最近更新 更多