whisperity added inline comments.
================
Comment at:
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:364-365
+ StringRef S2) {
+ StringRef S1Prefix = S1.take_front(S1.size() - N),
+ S2Prefix = S2.take_front(S2.size() - N);
+ return S1Prefix == S2Prefix && !S1Prefix.empty();
----------------
aaron.ballman wrote:
> Should we be checking that `.size() - N` doesn't cause wraparound?
Wraparound as in underflow? Like `2 - 8` becoming multiple millions? The
incoming strings are padded to the common length.
`take_xxx` won't let you go out of bounds, even if the parameter is greater
than the string's length. It will just silently return the entire string.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97297/new/
https://reviews.llvm.org/D97297
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits