diff options
author | Kazu Hirata <kazu@google.com> | 2021-01-22 23:25:03 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2021-01-22 23:25:03 -0800 |
commit | 5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7 (patch) | |
tree | 44d93e9532c5597d593fd66e844976d494838cb4 /llvm/utils | |
parent | a3254904b28cbc392baa8011f1da8172538ff077 (diff) | |
download | llvm-5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7.zip llvm-5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7.tar.gz llvm-5f843b2dd2ee1f36162a861ef02b2b4bc4dc79b7.tar.bz2 |
[llvm] Use isAlpha/isAlnum (NFC)
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/AsmMatcherEmitter.cpp | 4 | ||||
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 4 | ||||
-rw-r--r-- | llvm/utils/TableGen/AsmWriterInst.cpp | 7 |
3 files changed, 3 insertions, 12 deletions
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp index 48b7014..9d30491 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -1112,9 +1112,7 @@ static std::string getEnumNameForToken(StringRef Str) { case '-': Res += "_MINUS_"; break; case '#': Res += "_HASH_"; break; default: - if ((*it >= 'A' && *it <= 'Z') || - (*it >= 'a' && *it <= 'z') || - (*it >= '0' && *it <= '9')) + if (isAlnum(*it)) Res += *it; else Res += "_" + utostr((unsigned) *it) + "_"; diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index a09ea77..92df204 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -713,9 +713,7 @@ public: ++Next; } else { // $name, just eat the usual suspects. - while (I != End && - ((*I >= 'a' && *I <= 'z') || (*I >= 'A' && *I <= 'Z') || - (*I >= '0' && *I <= '9') || *I == '_')) + while (I != End && (isAlnum(*I) || *I == '_')) ++I; Next = I; } diff --git a/llvm/utils/TableGen/AsmWriterInst.cpp b/llvm/utils/TableGen/AsmWriterInst.cpp index 24d29ff..cf24f79 100644 --- a/llvm/utils/TableGen/AsmWriterInst.cpp +++ b/llvm/utils/TableGen/AsmWriterInst.cpp @@ -18,12 +18,7 @@ using namespace llvm; -static bool isIdentChar(char C) { - return (C >= 'a' && C <= 'z') || - (C >= 'A' && C <= 'Z') || - (C >= '0' && C <= '9') || - C == '_'; -} +static bool isIdentChar(char C) { return isAlnum(C) || C == '_'; } std::string AsmWriterOperand::getCode(bool PassSubtarget) const { if (OperandType == isLiteralTextOperand) { |