Closed regehr closed 8 months ago
c-reduce output for reference
bool a, b;
#include <algorithm>
void c(bool d, char e, char f[][0][0][0]) {
char g = 0;
#pragma clang loop vectorize(enable)
for (signed h = 0; h < 2; h += d) {
if (f[0][0][0][h])
a = 0;
b = f[0][0][0][h] ? std::min(f[0][0][0][h], std::max(g, e)) : 0;
}
}
Hmm. Shrink ray does have a pass that does essentially this for braces. I guess maybe I forgot to have it do the same for brackets, which does seem an obvious clear win. It's probably bordering on a one-line change.
Also that Shrink Ray output for your example is clear evidence that I need to do some more work on the formatter, or just call clang-format at the end maybe. Yuck.
yeah, my preference for formatting would be best-effort, based on whatever external tools happen to be in the current PATH. so for example, you might guarantee that if I'm reducing a .c, .cpp, .cxx, or whatever, and clang-format is in the path, then that'll get called at the end.
Yeah that's more or less my current plan. There's #1 which requests setting a custom format tool, which I do plan to implement at some point, but I think probably there's going to end up also being a hard coded list of different formatters and how to invoke them properly.
can confirm that this is fixed for my example
yeah, my preference for formatting would be best-effort, based on whatever external tools happen to be in the current PATH. so for example, you might guarantee that if I'm reducing a .c, .cpp, .cxx, or whatever, and clang-format is in the path, then that'll get called at the end.
This is now implemented!
I just watched shrinkray work on a C++ program and I'd say that its major problem all though was getting rid of parens -- there were extra ones at basically all stages of reduction (including the final output, below). C-Reduce gets a lot of mileage out of a pass that removes matched pairs of delimiters, without disturbing the stuff inside -- if you don't have that pass, then it seems like a good candidate for the short list.