[all-commits] [llvm/llvm-project] 9c8bc0: [clang-tidy] Fix readability-redundant-string-cstr...
Mike Crowe via All-commits
all-commits at lists.llvm.org
Fri Mar 10 05:53:42 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9c8bc090a0c291efb41cc4b5c51ea0c340961ad1
https://github.com/llvm/llvm-project/commit/9c8bc090a0c291efb41cc4b5c51ea0c340961ad1
Author: Mike Crowe <mac at mcrowe.com>
Date: 2023-03-10 (Fri, 10 Mar 2023)
Changed paths:
M clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
M clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr.cpp
Log Message:
-----------
[clang-tidy] Fix readability-redundant-string-cstr for smart pointer #576705
Fix the readability-redundant-string-cstr check to correctly replace
calls to c_str() via an overloaded operator-> (such as from an
iterator.)
Previously, the fix for `i->c_str()` would be `*i->`. Using consume_back
to remove any trailing `->` results in the correct `*i`.
Add some lit check test cases too.
Fixes: https://github.com/llvm/llvm-project/issues/56705
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D145730
More information about the All-commits
mailing list