[PATCH] D18783: [clang-tidy] add new checker for string literal with NUL character.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 7 08:45:59 PDT 2016


alexfh requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst:6
@@ +5,3 @@
+
+Find occurences of string literal with embedded NUL character and validate
+their usage.
----------------
Please use third-person form (Finds, validates, etc.).

================
Comment at: docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst:27
@@ +26,3 @@
+String-like classes can manipulate strings with embedded NUL as they are
+keeping track of the bytes and the length. This is not the case for an
+``char*`` (NUL-terminated) string.
----------------
s/an/a/

================
Comment at: docs/clang-tidy/checks/misc-string-literal-with-embedded-nul.rst:30
@@ +29,3 @@
+
+A common mistake is to pass a string-literal (NUL-terminated) to a string
+constructor. The bytes after the first NUL character are truncated.
----------------
There doesn't seem to be anything bad with `NUL-terminated`. Did you mean `with embedded NUL character`?


http://reviews.llvm.org/D18783





More information about the cfe-commits mailing list