def update_unnamed_class(decls):
for decl in decls:<EOL><INDENT>if isinstance(decl, declarations.typedef_t):<EOL><INDENT>referent = decl.decl_type<EOL>if isinstance(referent, declarations.elaborated_t):<EOL><INDENT>referent = referent.base<EOL><DEDENT>if not isinstance(referent, declarations.declarated_t):<EOL><INDENT>continue<EOL><DEDENT>referent = referent.declaration<EOL>if referent.name or not isinstance(referent, declarations.class_t):<EOL><INDENT>continue<EOL><DEDENT>referent.name = decl.name<EOL><DEDENT><DEDENT>
Adds name to class_t declarations.

If CastXML is being used, the type definitions with an unnamed
class/struct are split across two nodes in the XML tree. For example,

    typedef struct {} cls;

produces

    <Struct id="_7" name="" context="_1" .../>
    <Typedef id="_8" name="cls" type="_7" context="_1" .../>

For each typedef, we look at which class it refers to, and update the name
accordingly. This helps the matcher classes finding these declarations.
This was the behaviour with gccxml too, so this is important for
backward compatibility.

If the castxml epic version 1 is used, there is even an elaborated type
declaration between the typedef and the struct/class, that also needs to be
taken care of.

Args:
    decls (list[declaration_t]): a list of declarations to be patched.
Returns:
    None