We expose the fact that we rely on unsigned wrapping to iterate through
all indexes. This can be confusing. Rather, keeping it as an
implementation detail through an iterator is less confusing and is less
code.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | ||
---|---|---|
838 | You changed this one to auto but left the others unsigned. I think leaving it as unsigned makes more sense since it is not obvious what we expect the type to be here. |
I had another idle thought on this matter: The unsigned overflow here really isn't that weird. It's the same thing as iterating over the range [-1, 0, #args+1]. We could update all these APIs to traffic in plain signed ints, and then there would be no wrapping, just normal index math.
It's probably worth a comment that this operation is expected to overflow & wrap.