Skip to content

performance-unnecessary-value-param.AllowedTypes has inconsistent behavior when namespaces and type aliases are involved #145032

Open
@nvartolomei

Description

@nvartolomei

Example:

---
Checks: '-*,performance-*'
CheckOptions:
  - key:             performance-unnecessary-value-param.AllowedTypes
    value:           a::dt;
namespace a {

struct dt {
  ~dt(){};
};

using a_dt_alias = a::dt;

} // namespace a

void f1(a::dt in) {};

void f2(a::a_dt_alias in) {};
warning: the parameter 'in' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
   13 | void f2(a::a_dt_alias in) {};
      |                       ^
      |         const        &

If namespace is removed from code and from clang-tidy config then no warnings are generated.

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