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

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 07:10:34 PDT 2016


alexfh added a comment.

A couple of nits for now. Will take a closer look later.


================
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:22
@@ +21,3 @@
+static unsigned int GetCharAt(const StringLiteral *SL, size_t offset) {
+  if (offset >= SL->getLength()) return 0;
+  return SL->getCodeUnit(offset);
----------------
Should this be an assert instead?

================
Comment at: clang-tidy/misc/StringLiteralWithEmbeddedNulCheck.cpp:38
@@ +37,3 @@
+  // The remaining checks only apply to C++.
+  if (!getLangOpts().CPlusPlus) return;
+
----------------
clang-format -style=LLVM (or -style=file), please.


http://reviews.llvm.org/D18783





More information about the cfe-commits mailing list