[PATCH] D113148: Add new clang-tidy check for string_view(nullptr)
CJ Johnson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 3 14:47:36 PDT 2021
CJ-Johnson created this revision.
CJ-Johnson added a reviewer: ymandel.
Herald added subscribers: carlosgalvezp, abrachet, phosek, mgorny.
CJ-Johnson requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Checks for various ways that the nullptr literal can be passed into the const char* constructor of basic_string_view and replaces them with the default constructor in most cases. For the comparison operators, braced initializer list does not compile so instead the empty string is used. Also, == and != are replaced with calls to .empty()
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113148
Files:
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.cpp
clang-tools-extra/clang-tidy/bugprone/StringviewNullptrCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-stringview-nullptr.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/checkers/bugprone-stringview-nullptr.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113148.384591.patch
Type: text/x-patch
Size: 110290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211103/45d25bce/attachment-0001.bin>
More information about the cfe-commits
mailing list