Skip to content

Commit

Permalink
[llvm] NFC: Cleanup llvm-yaml-numeric-parser-fuzzer
Browse files Browse the repository at this point in the history
* Use static variables instead of non-trivially destructible global ones.
* Remove unused header.

Differential Revision: https://reviews.llvm.org/D91600
  • Loading branch information
kirillbobyrev committed Feb 15, 2021
1 parent 5fe1593 commit eefd620
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -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;
Expand Down

0 comments on commit eefd620

Please sign in to comment.