[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 4 23:19:46 PDT 2023
https://github.com/PiotrZSL requested changes to this pull request.
It's not so easy, because if result of &[] is used as non-const, then using c_str will make code non-compilable. Some additional checks wuold be required, like checking if object is const, or checking if there is implicit cast to const pointer from an nonconst pointer, only then c_str could be used.
Make "f" function take non-const pointer, then you will see.
Also there can be an issue when for example, container have only-const version of some functions (c_str).
https://github.com/llvm/llvm-project/pull/71304
More information about the cfe-commits
mailing list