Skip to content

DeclPrinter prints 'final' twice #56517

Closed
@kimgr

Description

@tom-anders @sam-mccall

IWYU's hacky forward-declare printer broke yesterday when 9f57b65 landed.

For the following declaration:

template <typename T>
class FinalTemplate final {};

decl->print() generates:

template <typename T> class final FinalTemplate final {\n}

So while it's nice that final ends up in the right place, it's a little annoying that it's printed both before and after the decl name.

The reason for that is DeclPrinter::prettyPrintAttributes, which emits all decl attributes, and is called before the new final code in DeclPrinter::VisitCXXRecordDecl.

There's a bunch of things wrong with our current parsing and rewriting of the decl->print() output, so I'll look into hardening that, but I figured this might hit someone else.

Not sure why it doesn't show up in your tests. Does the Hover code do any additional cleanup?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions