[PATCH] D54943: [clang-tidy] implement const-transformation for cppcoreguidelines-const-correctness

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 03:02:21 PDT 2020


JonasToth added a comment.

In D54943#2255358 <https://reviews.llvm.org/D54943#2255358>, @AlexanderLanin wrote:

> 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"))`.

Hey alex,
thanks for testing the check out and reporting the issue.
Could you please provide me a full reproducer (optimally without dependencies on includes/libraries)?
I am currently trying to go through everything again, as there are simply some cases not handled correctly :/

Best Regards, Jonas


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