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

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 06:49:19 PDT 2023


tbaeder added a comment.

Since basically nobody has seen multiple snippet lines being printed, we probably need to fix up a bunch of diagnostics afterwards to be more useful, e.g.

  ./array.cpp:111:5: error: no matching function for call to 'func'
    111 |     func(1, 2, 3, 4), "hah, reason!");
        |     ^~~~
  ./array.cpp:96:16: note: candidate function not viable: requires 7 arguments, but 4 were provided
     96 | consteval bool func(int why,
        |                ^    ~~~~~~~~
     97 |                     int would_my,
        |                     ~~~~~~~~~~~~~
     98 |                     int compiler_complain,
        |                     ~~~~~~~~~~~~~~~~~~~~~~
     99 |                     int about_the_arguments,
        |                     ~~~~~~~~~~~~~~~~~~~~~~~~
    100 |                     int but_not_show_them_to_me,
        |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    101 |                     int if_the_declaration_covers_multiple_lines,
        |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    102 |                     int big_question_mark) {
        |                     ~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

has annoyed me  in the past (using one argument per line is common in some coding styles).


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

https://reviews.llvm.org/D147875



More information about the cfe-commits mailing list