[WHLSL] Make generated Metal code should be indented properly to ease reading while debugging
Created attachment 376649 [details] Patch
Created attachment 376650 [details] before.txt
Created attachment 376651 [details] after.txt
Comment on attachment 376649 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=376649&action=review r=me > Source/WTF/wtf/text/StringConcatenate.h:262 > +template<unsigned N> > +struct Indentation { > + unsigned operator++() { return ++value; } > + unsigned operator++(int) { return value++; } > + unsigned operator--() { return --value; } > + unsigned operator--(int) { return value--; } > + > + unsigned value { 0 }; > +}; > + > + > +template<unsigned N> > +struct IndentationScope { > + IndentationScope(Indentation<N>& indentation) > + : m_indentation(indentation) > + { > + ++m_indentation; > + } > + ~IndentationScope() > + { > + --m_indentation; > + } > + > + Indentation<N>& m_indentation; > +}; Sort of a nit, so maybe it doesn't matter, but I kind of think it's nicer to localize ++/-- to increment and decrement by N, instead of making users of Indentation have to consider what N is. For example, below, the StringTypeAdaptor for Indentation has to know what N is (in length and writeTo). If we had other users in the future, they'd also have to concern themselves with what N is and what the "value" field is, instead of just being concerned with what "value" is.
Comment on attachment 376649 [details] Patch Clearing flags on attachment: 376649 Committed r248892: <https://trac.webkit.org/changeset/248892>
All reviewed patches have been landed. Closing bug.
<rdar://problem/54499451>