[PATCH] D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness
Alexander Lanin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 3 13:39:54 PDT 2020
AlexanderLanin added a comment.
Observed behavior:
Change: `for(string_view token : split_into_views(file_content, " \t\r\n"))` --> `for(string_view const token : split_into_views(file_content, " \t\r\n"))`.
Note: `std::vector<string_view> split_into_views(string_view input, const char* separators);`
Problem: Now it triggers `error: loop variable 'token' of type 'const nonstd::sv_lite::string_view' (aka 'const basic_string_view<char>') creates a copy from type 'const nonstd::sv_lite::string_view' [-Werror,-Wrange-loop-analysis]`
Fixed manually by making it `for(std::string_view& const token : split_into_views(file_content, " \t\r\n"))`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54943/new/
https://reviews.llvm.org/D54943
More information about the cfe-commits
mailing list