[PATCH] D18703: [clang-tidy] Add new checker for comparison with runtime string functions.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 16:03:41 PDT 2016

alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with a couple of nits. Thank you!

Comment at: clang-tidy/misc/SuspiciousStringCompareCheck.cpp:25
@@ +24,3 @@
+static const char *KnownStringCompareFunctions = "__builtin_memcmp;"
+                                                 "__builtin_strcasecmp;"
The variable is not const right now. I recently started preferring the `constexpr char X[] = ...` way of defining string constants.

Comment at: clang-tidy/misc/SuspiciousStringCompareCheck.cpp:108
@@ +107,3 @@
+  std::vector<std::string> FuntionNames;
+  ParseFunctionNames(KnownStringCompareFunctions, &FuntionNames);
+  ParseFunctionNames(StringCompareLikeFunctions, &FuntionNames);
nit: FuntionNames -> FunctionNames


More information about the cfe-commits mailing list