mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-24 07:01:35 +00:00
[TableGen] Rewrite an assert to not do a bunch unsigned math and then try to ensure the result is a positive number.
I think the fact that it was explicitly excluding 0 kept this from being a tautology. The exclusion of 0 for the old math was also a bug that's easily hit if the description gets split into multiple lines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238186 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
88008cb710
commit
c9739ec212
@ -22,11 +22,11 @@ const size_t MAX_LINE_LEN = 80U;
|
||||
static void printLine(raw_ostream &OS, const Twine &Prefix, char Fill,
|
||||
StringRef Suffix) {
|
||||
size_t Pos = (size_t)OS.tell();
|
||||
assert((MAX_LINE_LEN - Prefix.str().size() - Suffix.size() > 0) &&
|
||||
assert((Prefix.str().size() + Suffix.size() <= MAX_LINE_LEN) &&
|
||||
"header line exceeds max limit");
|
||||
OS << Prefix;
|
||||
const size_t e = MAX_LINE_LEN - Suffix.size();
|
||||
for (size_t i = (size_t)OS.tell() - Pos; i < e; ++i)
|
||||
for (size_t i = (size_t)OS.tell() - Pos, e = MAX_LINE_LEN - Suffix.size();
|
||||
i < e; ++i)
|
||||
OS << Fill;
|
||||
OS << Suffix << '\n';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user