[all-commits] [llvm/llvm-project] 0b922d: [clang-tidy] Added support for 3-argument std::str...

Baranov Victor via All-commits all-commits at lists.llvm.org
Mon Feb 10 17:10:19 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b922d66e510de718cba671331bec3ebe42d0b70
      https://github.com/llvm/llvm-project/commit/0b922d66e510de718cba671331bec3ebe42d0b70
  Author: Baranov Victor <70346889+vbvictor at users.noreply.github.com>
  Date:   2025-02-11 (Tue, 11 Feb 2025)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/bugprone/string-constructor.rst
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/string-constructor.cpp

  Log Message:
  -----------
  [clang-tidy] Added support for 3-argument std::string ctor in bugprone-string-constructor check (#123413)

This PR add diagnostics for 3-parameter `std::basic_string(const char*
t, size_type pos, size_type count)` constructor in
bugprone-string-constructor check:

```cpp
  std::string r1("test", 1, 0); // constructor creating an empty string
  std::string r2("test", 0, -4); // negative value used as length parameter
  // more examples in test file
  ```

Fixes false-positives reported in https://github.com/llvm/llvm-project/issues/123198.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list