[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2024-06-15 Thread Eli Black via cfe-commits
neoncube2 wrote: @5chmidti Ah, no, I no longer plan to work on this, sorry. It turns out that C++ compilers are too far out of the range of my experience, haha. Should I close this pull request? Or if someone wants to use my branch as a base for a new PR, feel free! :) https://github.com/llvm

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
neoncube2 wrote: @PiotrZSL Thanks for the quick review! :) I think #54076 covers the `const` issue. Since `container-data-pointer` is already broken for code such as `char *t = str.data();`, I think merging this PR wouldn't cause additional issues, but I could be wrong about that! :) I'd like

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
@@ -111,16 +115,18 @@ void ContainerDataPointerCheck::check(const MatchFinder::MatchResult &Result) { MemberExpr>(CE)) ReplacementText = "(" + ReplacementText + ")"; - if (CE->getType()->isPointerType()) -ReplacementText += "->data()"; - else -Replace

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
@@ -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

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
https://github.com/neoncube2 updated https://github.com/llvm/llvm-project/pull/71304 >From ab1e2e7487fdc7b1e16e563c63e225a3dd39da05 Mon Sep 17 00:00:00 2001 From: Eli Black Date: Sun, 5 Nov 2023 13:43:20 +0800 Subject: [PATCH] [clang-tidy] Improve `container-data-pointer` check to use `c_str()

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
https://github.com/neoncube2 deleted https://github.com/llvm/llvm-project/pull/71304 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-05 Thread Eli Black via cfe-commits
@@ -111,16 +115,18 @@ void ContainerDataPointerCheck::check(const MatchFinder::MatchResult &Result) { MemberExpr>(CE)) ReplacementText = "(" + ReplacementText + ")"; - if (CE->getType()->isPointerType()) -ReplacementText += "->data()"; - else -Replace

[clang-tools-extra] [clang-tidy] Improve `container-data-pointer` check to use `c_str()` (PR #71304)

2023-11-04 Thread Eli Black via cfe-commits
https://github.com/neoncube2 created https://github.com/llvm/llvm-project/pull/71304 Improve clang-tidy's `container-data-pointer` check to use `c_str()`, when available. Fixes #55026 This is my first Clang PR! :) >From 08fa26a6d6f0fbc242ec803f537110694d645e93 Mon Sep 17 00:00:00 2001 From: