[PATCH] D83834: Add test utility 'split-file'

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 09:28:10 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/tools/split-file/split-file.cpp:63
+  const char *end = nullptr;
+  int leadingLines = 0;
+};
----------------
jhenderson wrote:
> Whilst it's probably harmless, I don't think this should be an `int` (and similar comments for other liner number variables, e.g. `lineNo` in `handle`), since it can never be negative. `size_t` or possibly `unsigned` seem more appropriate for the context.
Emm. I think it is debatable whether `undefined` is a suitable type here. See comments starting from https://reviews.llvm.org/D82594#2127217 for some discussions.

I actually perform arithmetic near zero below (`i.line_number() - 1`). int gives me more confidence that things don't go off.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83834



More information about the llvm-commits mailing list