Skip to content

clang-tidy misc-unused-parameters breaks attributes on parameters #122191

@emaxx-google

Description

@emaxx-google

If a parameter has an attribute spelled after it, then after misc-unused-parameters comments out the parameter name the attribute becomes wrongly applied to the type instead.

For example:

// before:
int& f(int& x [[clang::lifetimebound]]) {
}

// after clang-tidy:
int& f(int& /*x*/ [[clang::lifetimebound]]) {
}

The grammar works in a way that the attribute becomes attached to the type, which changes the semantics (e.g., [[clang::lifetimebound]] is silently ignored currently when applied to types, but #96034 will change this to a compilation error).

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