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

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 01:46:44 PDT 2016


bkramer added a subscriber: bkramer.

================
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:21
@@ +20,3 @@
+// Retrieve the character at offset |offset| of the string literal |SL|.
+static unsigned int GetCharAt(const StringLiteral *SL, size_t offset) {
+  if (offset >= SL->getLength()) return 0;
----------------
Isn't this identical to StringLiteral::getCodeUnit? Also returning 0 for unknown sizes is not a good idea imo.


http://reviews.llvm.org/D18783





More information about the cfe-commits mailing list