diff options
author | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-19 07:45:53 -0500 |
---|---|---|
committer | Mitchell Balan <mitchell@stellarscience.com> | 2019-11-19 07:52:31 -0500 |
commit | 1315f4e009b097d7d1a2a5cf116c1ad55ed5c190 (patch) | |
tree | 53ad3dc833d60411ef781b4ea87ec850fb4fb17c /lldb/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py | |
parent | f8901aff4a8f1809d62e0d676a1035099c8f734a (diff) | |
download | bcm5719-llvm-1315f4e009b097d7d1a2a5cf116c1ad55ed5c190.tar.gz bcm5719-llvm-1315f4e009b097d7d1a2a5cf116c1ad55ed5c190.zip |
[clang-tidy] Fix readability-redundant-string-init for c++17/c++2a
Summary:
`readability-redundant-string-init` was one of several clang-tidy checks documented as failing for C++17. (The failure mode in C++17 is that it changes `std::string Name = ""`; to `std::string Name = Name;`, which actually compiles but crashes at run-time.)
Analyzing the AST with `clang -Xclang -ast-dump` showed that the outer `CXXConstructExprs` that previously held the correct SourceRange were being elided in C++17/2a, but the containing `VarDecl` expressions still had all the relevant information. So this patch changes the fix to get its source ranges from `VarDecl`.
It adds one test `std::string g = "u", h = "", i = "uuu", j = "", k;` to confirm proper warnings and fixit replacements in a single `DeclStmt` where some strings require replacement and others don't. The readability-redundant-string-init.cpp and readability-redundant-string-init-msvc.cpp tests now pass for C++11/14/17/2a.
Reviewers: gribozavr, etienneb, alexfh, hokein, aaron.ballman, gribozavr2
Patch by: poelmanc
Subscribers: NoQ, MyDeveloperDay, Eugene.Zelenko, dylanmckay, cfe-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D69238
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py')
0 files changed, 0 insertions, 0 deletions