[llvm] eefd620 - [llvm] NFC: Cleanup llvm-yaml-numeric-parser-fuzzer
Kirill Bobyrev via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 15 05:53:34 PST 2021
Author: Kirill Bobyrev
Date: 2021-02-15T14:52:53+01:00
New Revision: eefd620a2572d1a640b9085ea60dbf37e680159a
URL: https://github.com/llvm/llvm-project/commit/eefd620a2572d1a640b9085ea60dbf37e680159a
DIFF: https://github.com/llvm/llvm-project/commit/eefd620a2572d1a640b9085ea60dbf37e680159a.diff
LOG: [llvm] NFC: Cleanup llvm-yaml-numeric-parser-fuzzer
* Use static variables instead of non-trivially destructible global ones.
* Remove unused header.
Differential Revision: https://reviews.llvm.org/D91600
Added:
Modified:
llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
index 7ffc75e66a52..c61b509fc5fe 100644
--- a/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
+++ b/llvm/tools/llvm-yaml-numeric-parser-fuzzer/yaml-numeric-parser-fuzzer.cpp
@@ -9,15 +9,14 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/YAMLTraits.h"
-#include <cassert>
#include <string>
-llvm::Regex Infinity("^[-+]?(\\.inf|\\.Inf|\\.INF)$");
-llvm::Regex Base8("^0o[0-7]+$");
-llvm::Regex Base16("^0x[0-9a-fA-F]+$");
-llvm::Regex Float("^[-+]?(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)([eE][-+]?[0-9]+)?$");
-
inline bool isNumericRegex(llvm::StringRef S) {
+ static llvm::Regex Infinity("^[-+]?(\\.inf|\\.Inf|\\.INF)$");
+ static llvm::Regex Base8("^0o[0-7]+$");
+ static llvm::Regex Base16("^0x[0-9a-fA-F]+$");
+ static llvm::Regex Float(
+ "^[-+]?(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)([eE][-+]?[0-9]+)?$");
if (S.equals(".nan") || S.equals(".NaN") || S.equals(".NAN"))
return true;
More information about the llvm-commits
mailing list