[PATCH] D18783: [clang-tidy] add new checker for string literal with NUL character.
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 6 01:10:23 PDT 2016
On Tue, Apr 05, 2016 at 05:27:45PM +0000, Ben Craig via cfe-commits wrote:
> bcraig added a subscriber: bcraig.
> bcraig added a comment.
>
> Is this checker able to connect a std::string with a pre-declared string literal (i.e. constant propagation)? For example...
>
> const char *bad_chars = "\0\1\2\3";
> std::string bad_str = bad_chars;
>
> I've had real code make that mistake before.
In that case, it would be nice if it also handles the correct pattern
of:
const char bad_chars[] = "\0\1\2\3";
std::string bad_str(bad_chars, sizeof bad_chars);
Joerg
More information about the cfe-commits
mailing list