Skip to content

lint on all uses of "std::string const&": use string_view instead #29059

@gnzlbg

Description

@gnzlbg
mannequin
Bugzilla Link 28685
Version unspecified
OS All

Extended Description

There should be a lint to detect all usages of std::string const&.

A string_view-like type is always better than a std::string const&.

It would be a nice extra if one could configure which type to use instead (e.g. std::string_view, Boost::string_ref, LLVM's ...).

And also which string types should be detected: std::string, boost::string, Qt's, LLVM, ...

Maybe this should also become a clang-modernize check since string_view is a C++17 feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions