lebedev.ri added inline comments.

================
Comment at: llvm/include/llvm/Support/YAMLTraits.h:453
 
-inline bool isNumber(StringRef S) {
-  static const char OctalChars[] = "01234567";
-  if (S.startswith("0") &&
-      S.drop_front().find_first_not_of(OctalChars) == StringRef::npos)
-    return true;
-
-  if (S.startswith("0o") &&
-      S.drop_front(2).find_first_not_of(OctalChars) == StringRef::npos)
-    return true;
+inline bool isNumeric(StringRef S) {
+  if (S.empty())
----------------
Passing-by thought, feel free to ignore.

Changes like these are a **great** targets for fuzzers.
Don't just rewrite the implementation, but instead write a new [optimized] 
function,
and add a fuzzer that would feed both of these functions **the same** input,
and assert the equality of their outputs. (and that neither of them crashes).

Would preserve the infinitely more readable code version, too.


https://reviews.llvm.org/D50839



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to