[clang-tools-extra] [clang-tidy] Add a new check 'modernize-use-string-view' (PR #172170)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 28 06:54:58 PST 2025
================
@@ -363,3 +363,23 @@ std::string
my_function() {
return handle_or_string();
}
+
+
+namespace TemplatedFunctions {
+template <typename MojoType>
+extern std::string GetErrorString(const MojoType& mojo_type);
+
+class A{};
+class B{};
+
+template <>
+std::string GetErrorString(const A& a) {
+ return "Can be string_view";
+}
+
+template <>
+std::string GetErrorString(const B& a) {
+ std::string s("Cannot be string_view");
+ return s;
+}
+}
----------------
EugeneZelenko wrote:
```suggestion
} // namespace TemplatedFunctions
```
https://github.com/llvm/llvm-project/pull/172170
More information about the cfe-commits
mailing list