llvm / llvm/llvm-project

[clang-tidy] modernize-use-string-view may result in uncompiled code

Open Beginner friendly
#218,260 5 comments 0 reactions 0 assignees View on GitHub
clang-tidy documentation
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```c++
#include
#include
#include

std::string foo() {
return "foo";
}

int main() {
return strlen(foo().c_str());
}
```

`std::string_view` doesn't have `c_str` method.

Since it's impossible to fix, it should be reflected as known limitation

Contributor guide

Open the contributing guide

Research direction

Start by reading the clang-tidy modernize-use-string-view documentation and checking how the supplied C++ example is transformed. Document the c_str limitation as a known limitation, with the example showing that the transformed code does not compile.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.