#define LLVM_BITSTREAM_BITCODES_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
}
/// isChar6 - Return true if this character is legal in the Char6 encoding.
- static bool isChar6(char C) {
- if (C >= 'a' && C <= 'z') return true;
- if (C >= 'A' && C <= 'Z') return true;
- if (C >= '0' && C <= '9') return true;
- if (C == '.' || C == '_') return true;
- return false;
- }
+ static bool isChar6(char C) { return isAlnum(C) || C == '.' || C == '_'; }
static unsigned EncodeChar6(char C) {
if (C >= 'a' && C <= 'z') return C-'a';
if (C >= 'A' && C <= 'Z') return C-'A'+26;
#include "llvm/IR/Mangler.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DataLayout.h"
// Check if the name needs quotes to be safe for the linker to interpret.
static bool canBeUnquotedInDirective(char C) {
- return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
- (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@';
+ return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@';
}
static bool canBeUnquotedInDirective(StringRef Name) {
}
bool MCAsmInfo::isAcceptableChar(char C) const {
- return (C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
- (C >= '0' && C <= '9') || C == '_' || C == '$' || C == '.' || C == '@';
+ return isAlnum(C) || C == '_' || C == '$' || C == '.' || C == '@';
}
bool MCAsmInfo::isValidUnquotedName(StringRef Name) const {
Current = Final;
}
-static bool is_ns_hex_digit(const char C) {
- return (C >= '0' && C <= '9')
- || (C >= 'a' && C <= 'z')
- || (C >= 'A' && C <= 'Z');
-}
+static bool is_ns_hex_digit(const char C) { return isAlnum(C); }
-static bool is_ns_word_char(const char C) {
- return C == '-'
- || (C >= 'a' && C <= 'z')
- || (C >= 'A' && C <= 'Z');
-}
+static bool is_ns_word_char(const char C) { return C == '-' || isAlpha(C); }
void Scanner::scan_ns_uri_char() {
while (true) {
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) + "_";
++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;
}
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) {