Skip to content

Name offset for type tokens #429

Open
@pgoodman

Description

@pgoodman

We have no way of composing a TokenRange of type tokens with a name. For example, if the type is struct foo *, then composing this with a name would give us struct foo *name, however, composing the type void (*)(void) with a name would give us void (*name)(void). I think we would "engineer" for the type tokens to determine the name offset via the pretty printer. It would require quite the hack, but the idea would be to synthesize a fake clang::ParmVarDecl, set its type to the relevant clang::QualType, set its name/identifier to a synthesized name, and then adopt this and actually rely on the underlying decl printer. Then, when we're post-processing the pasta::PrintedTokenRange, we'd look for the special name token, and then use keep track of its offset in rpc::Type. This would then let us compose type tokens with other tokens to form semantically correct typed names, e.g. for rendering in the UI.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions