LLVM: lib/Support/DJB.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

18

19using namespace llvm;

20

23 const UTF8 *const Begin8Const =

24 reinterpret_cast<const UTF8 *>(Buffer.begin());

25 const UTF8 *Begin8 = Begin8Const;

27

28

29

33 Buffer = Buffer.drop_front(Begin8 - Begin8Const);

34 return C;

35}

36

38 const UTF32 *Begin32 = &C;

40

41

42

46 (void)CR;

47 return StringRef(reinterpret_cast<char *>(Storage.begin()),

48 Begin8 - Storage.begin());

49}

50

52

53

54

55 if (C == 0x130 || C == 0x131)

56 return 'i';

58}

59

62 bool AllASCII = true;

63 for (unsigned char C : Buffer) {

64 H = H * 33 + ('A' <= C && C <= 'Z' ? C - 'A' + 'a' : C);

65 AllASCII &= C <= 0x7f;

66 }

67 if (AllASCII)

68 return H;

69 return std::nullopt;

70}

71

74 return *Result;

75

76 std::array<UTF8, UNI_MAX_UTF8_BYTES_PER_CODE_POINT> Storage;

77 while (!Buffer.empty()) {

81 }

82 return H;

83}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static std::optional< uint32_t > fastCaseFoldingDjbHash(StringRef Buffer, uint32_t H)

Definition DJB.cpp:60

static UTF32 foldCharDwarf(UTF32 C)

Definition DJB.cpp:51

static StringRef toUTF8(UTF32 C, MutableArrayRef< UTF8 > Storage)

Definition DJB.cpp:37

static UTF32 chopOneUTF32(StringRef &Buffer)

Definition DJB.cpp:21

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

StringRef - Represent a constant reference to a string, i.e.

constexpr bool empty() const

empty - Check if the string is empty.

StringRef drop_front(size_t N=1) const

Return a StringRef equal to 'this' but with the first N elements dropped.

@ C

The default llvm calling convention, compatible with C.

LLVM_ABI int foldCharSimple(int C)

Fold input unicode character according the Simple unicode case folding rules.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)

Convert a partial UTF8 sequence to UTF32.

LLVM_ABI uint32_t caseFoldingDjbHash(StringRef Buffer, uint32_t H=5381)

Computes the Bernstein hash after folding the input according to the Dwarf 5 standard case folding ru...

Definition DJB.cpp:72

LLVM_ABI ConversionResult ConvertUTF32toUTF8(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)

uint32_t djbHash(StringRef Buffer, uint32_t H=5381)

The Bernstein hash function used by the DWARF accelerator tables.