[PATCH] D90759: Escape command line arguments in backtraces

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 00:45:27 PST 2020


jhenderson added inline comments.


================
Comment at: llvm/lib/Support/PrettyStackTrace.cpp:257
   // Print the argument list.
-  for (unsigned i = 0, e = ArgC; i != e; ++i)
-    OS << ArgV[i] << ' ';
+  for (int I = 0; I < ArgC; ++I) {
+    const bool HaveSpace = ::strchr(ArgV[I], ' ');
----------------
ldrumm wrote:
> jhenderson wrote:
> > What's the reason for changing the type of `I`? It's being used as an incrementing array index, so size_t seems like the most appropriate thing, if you're going to change it at all.
> I changed it mostly because ArgC is signed, and signed / unsigned
> comparisons make some people (and compilers) unhappy. The bounds of the
> number of programming arguments are strictly within the range of an int,
> so I don't think `size_t` buys anything.
`int` is fine, thanks. Didn't register that it was a strict tracking of the `argc` from `main`.


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

https://reviews.llvm.org/D90759



More information about the llvm-commits mailing list