[clang-tools-extra] [clang-tidy] Add modernize-substr-to-starts-with check (PR #116033)

Helmut Januschka via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 14 07:23:48 PST 2024


hjanuschka wrote:

refactored and integrated into existing checker. seems to work, with my local test.cpp files.
however i am struggling, adding tests.

https://github.com/llvm/llvm-project/pull/116033/files#diff-da808871a68f05cbe09bd3761e5092a51a46608bd2206db26c2a98f93e75f68cR274

.substr() is undefined.

```
error: no member named 'substr' in 'std::basic_string<char>' [clang-diagnostic-error]
  268 |   s.substr(0, 5) == "hello";
```


any advice? or sample where i can take a look how to get a real std::string or how to mock it? 



https://github.com/llvm/llvm-project/pull/116033


More information about the cfe-commits mailing list