[PATCH] D145311: Make abseil-redundant-strcat-calls checker use <string> header

Mike Crowe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 4 13:07:53 PST 2023


mikecrowe created this revision.
mikecrowe added a reviewer: carlosgalvezp.
Herald added a project: All.
mikecrowe requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

It's unclear where the "string" in no namespace comes from in this
check. The inheritance from __gnu_cxx implies that it's supposed to be
from libstdc++ but having string outside namespace std hasn't been a
thing in libstdc++ for over twenty years!

The comment says: "Here we mimic the hierarchy of ::string. We need to
do so because we are matching on the fully qualified name of the
methods." However, this doesn't appear to be true since just using the
implementation in Inputs/Headers/string, which lacks any inheritance,
doesn't cause any of the tests to fail.

I don't use Abseil, and have no idea whether this change is appropriate,
but the check does still pass provided all uses of string are changed to
std::string!

Depends on D145310 <https://reviews.llvm.org/D145310>


https://reviews.llvm.org/D145311

Files:
  clang-tools-extra/test/clang-tidy/checkers/abseil/redundant-strcat-calls.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145311.502387.patch
Type: text/x-patch
Size: 6596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230304/dcee588d/attachment-0001.bin>


More information about the cfe-commits mailing list