[PATCH] D147875: [clang][Diagnostics] WIP: Show line numbers when printing code snippets

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 09:47:59 PDT 2023


aaron.ballman added a comment.

GCC emits line numbers by default these days, so it seems reasonable for Clang to do so as well. Having a way to disable the feature is important though as some folks have scripts that scrap diagnostic results and changing the format may break those scripts in challenging ways. GCC supports `-fno-diagnostics-show-line-numbers` and we should do the same. GCC also supports `-fdiagnostics-minimum-margin-width=width` which we might want to consider supporting up front as well.

As for `-fcaret-diagnostics-max-lines`, I think I agree that the current default of `1` makes this functionality a bit less than useful, but perhaps we want to change that default value now? Alternatively, do we want to tie this option to the number of max lines? e.g., if the max lines is one, then we disable line numbers by default, but if the max lines is > 1, we enable line numbers by default?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147875/new/

https://reviews.llvm.org/D147875



More information about the cfe-commits mailing list