[webkit-reviews] review granted: [Bug 200870] [WHLSL] Generated MSL code should be indented properly to ease reading while debugging : [Attachment 376649] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 19 18:14:48 PDT 2019


Saam Barati <sbarati at apple.com> has granted Sam Weinig <sam at webkit.org>'s
request for review:
Bug 200870: [WHLSL] Generated MSL code should be indented properly to ease
reading while debugging
https://bugs.webkit.org/show_bug.cgi?id=200870

Attachment 376649: Patch

https://bugs.webkit.org/attachment.cgi?id=376649&action=review




--- Comment #4 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 376649
  --> https://bugs.webkit.org/attachment.cgi?id=376649
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.


More information about the webkit-reviews mailing list