[PATCH] D104459: [clang][lex] Ensure minimizer output is never larger than input
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 17 14:13:11 PDT 2021
dexonsmith added a comment.
Another thing to consider: a client that wants the minimized source to be "no bigger than" the original source can use the original source if it ends up growing. For example, https://reviews.llvm.org/D104462 could check the resulting size, and just return the original source in the (extremely unlikely?) corner case where the minimized sources are bigger.
In that case, we wouldn't need this patch's assertion.
I bet some of these changes are good to do anyway (like dropping the `/*invalid*/` comment, which was useful as a canary-in-the-coal-mine when testing the prototype on large bodies of sources (and maybe has outlived its usefulness)), but you could skip the fiddly changes here that complicate the logic and make the output less canonical and harder to read, like "maintain 0 whitespace after macro names" and "maintain missing newline at EOF".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104459/new/
https://reviews.llvm.org/D104459
More information about the cfe-commits
mailing list