On Thu, Nov 30, 2017 at 1:26 PM, David Malcolm <dmalc...@redhat.com> wrote:
> +/* Test if EXP is merely a wrapper node, added to express a location_t
> +   on behalf of the node's child (e.g. by maybe_wrap_with_location).
> +
> +   A wrapper node has code NON_LVALUE_EXPR or VIEW_CONVERT_EXPR, and the
> +   same type as its operand.
> +
> +   NON_LVALUE_EXPR is used for wrapping constants.
> +   VIEW_CONVERT_EXPR is used for wrapping non-constants.
> +
> +   A subtlety is that we may have to test whether we have the correct
> +   TREE_CODE for the wrapped TREE_CODE.  Otherwise, e.g. the C++ expression:
> +     reinterpret_cast<int>(some_int_var)
> +   is a NON_LVALUE_EXPR around a non-constant of the same type, and
> +   could thus be mischaracterized as a location wrapper node.
> +
> +   Hence we need to check CONSTANT_CLASS_P (TREE_OPERAND (EXP, 0))
> +   for a NON_LVALUE_EXPR for EXP to be a wrapper.
> +   We don't need to check a VIEW_CONVERT_EXPR that wraps the same type
> +   for !CONSTANT_CLASS_P; such instances of VIEW_CONVERT_EXPR are always
> +   wrappers.  */

I think most of this comment (everything after the first paragraph)
belongs inside the function rather than before it.  OK with that
change.

Jason

Reply via email to