[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:14:25 PDT 2023


================
@@ -3,13 +3,9 @@
 readability-container-data-pointer
 ==================================
 
-Finds cases where code could use ``data()`` rather than the address of the
-element at index 0 in a container. This pattern is commonly used to materialize
-a pointer to the backing data of a container. ``std::vector`` and
-``std::string`` provide a ``data()`` accessor to retrieve the data pointer which
-should be preferred.
+Finds cases where code references the address of the element at index 0 in a container and replaces them with calls to ``data()`` or ``c_str()``.
----------------
PiotrZSL wrote:

Wrap on 80 column,
And first sentence of documentation should be in sync with class description.

https://github.com/llvm/llvm-project/pull/71304


More information about the cfe-commits mailing list