================ @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_REPLACEWITHSTRINGVIEWCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_REPLACEWITHSTRINGVIEWCHECK_H + +#include "../ClangTidyCheck.h" + +namespace clang::tidy::performance { + +/// Looks for functions returning `std::[w|u8|u16|u32]string` and suggests to +/// change it to `std::[...]string_view` if possible and profitable. +/// +/// Example: +/// +/// std::string foo(int i) { // <---- can be replaced to std::string_view f(...) +/// switch(i) { +/// case 1: +/// return "case1"; +/// case 2: +/// return "case2"; +/// default: +/// return {}; +/// } +/// } +/// ---------------- vbvictor wrote:
```suggestion ``` https://github.com/llvm/llvm-project/pull/172170 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
