Re: [PATCH 04/20] Change some uses of DW_STRING to string method

Simon Marchi
2020-03-30T14:56:59Z

On 2020-03-28 3:21 p.m., Tom Tromey wrote:
> @@ -21247,25 +21247,25 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
> structures or unions. These were of the form "._%d" in GCC 4.1,
> or simply "<anonymous struct>" or "<anonymous union>" in GCC 4.3
> and GCC 4.4. We work around this problem by ignoring these. */
> - if (attr && DW_STRING (attr)
> - && (startswith (DW_STRING (attr), "._")
> - || startswith (DW_STRING (attr), "<anonymous")))
> + if (attr && attr->string ()
> + && (startswith (attr->string (), "._")
> + || startswith (attr->string (), "<anonymous")))

In cases like this, I think it would be worth assigning the result of attr->string
to a local variable, to avoid paying the cost of the check multiple times
unnecessarily.

But otherwise, this LGTM.

Simon