We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given the following snippet of code, copied from the example in https://clang.llvm.org/extra/clang-tidy/checks/bugprone-dangling-handle.html
#include <string> #include <string_view> #include <vector> using namespace std; int main() { string_view View = string(); // View will dangle. string A; View = A + "A"; // still dangle. vector<string_view> V; V.push_back(string()); // V[0] is dangling. V.resize(3, string()); // V[1] and V[2] will also dangle. } std::string_view f() { // All these return values will dangle. return string(); string S; return S; char Array[10]{}; return Array; }
Running this command does not catch any of the sample errors:
llvm/llvm-project/build/bin/clang-tidy --extra-arg="--std=c++17" --checks="bugprone-dangling-handle,-clang-diagnostic-dangling-gsl,-clang-diagnostic-return-stack-address" bugprone_dangling_handle.cpp
Expected results: The sample errors should trigger bugprone-dangling-handle checks.
The text was updated successfully, but these errors were encountered:
@llvm/issue-subscribers-clang-tidy
Sorry, something went wrong.
Issues in main are detected once #38779 get fixed. Issues in f functions are still not detected.
f
Looks like support for "return" is not implemented in check.
Fixed by f2e5000
No branches or pull requests
Given the following snippet of code, copied from the example in https://clang.llvm.org/extra/clang-tidy/checks/bugprone-dangling-handle.html
Running this command does not catch any of the sample errors:
Expected results: The sample errors should trigger bugprone-dangling-handle checks.
The text was updated successfully, but these errors were encountered: