[PATCH] D147875: [clang][Diagnostics] Show line numbers when printing code snippets
Konrad Wilhelm Kleine via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 4 14:17:42 PDT 2023
kwk added a comment.
@tbaeder I have a small suggestion.
================
Comment at: clang/lib/Frontend/TextDiagnostic.cpp:1121-1138
+static unsigned getNumDisplayWidth(unsigned N) {
+ if (N < 10)
+ return 1;
+ if (N < 100)
+ return 2;
+ if (N < 1'000)
+ return 3;
----------------
This function screamed at me to be generalized so I gave it a try: https://gist.github.com/kwk/7e408065ea291e49fea4a83cf90a9cdf
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147875/new/
https://reviews.llvm.org/D147875
More information about the cfe-commits
mailing list