[clangd] Fix FuzzyMatch tests on windows, NFC
Without specifying the signedness of the underlying type for Action, packing it in a 1-bit field may restrict its range to [-1, 0] which can't represent Match. llvm-svn: 319606
This commit is contained in:
parent
435e647a41
commit
8e97cca149
|
@ -115,7 +115,7 @@ Optional<float> FuzzyMatcher::match(StringRef Word) {
|
|||
// It's not obvious how to segment digits, we treat them as lowercase letters.
|
||||
// As we don't decode UTF-8, we treat bytes over 127 as lowercase too.
|
||||
// This means we require exact (case-sensitive) match.
|
||||
enum FuzzyMatcher::CharType : char {
|
||||
enum FuzzyMatcher::CharType : unsigned char {
|
||||
Empty = 0, // Before-the-start and after-the-end (and control chars).
|
||||
Lower = 1, // Lowercase letters, digits, and non-ASCII bytes.
|
||||
Upper = 2, // Uppercase letters.
|
||||
|
@ -144,7 +144,7 @@ constexpr static uint8_t CharTypes[] = {
|
|||
// e.g. XMLHttpRequest_Async
|
||||
// +--+---+------ +----
|
||||
// ^Head ^Tail ^Separator
|
||||
enum FuzzyMatcher::CharRole : char {
|
||||
enum FuzzyMatcher::CharRole : unsigned char {
|
||||
Unknown = 0, // Stray control characters or impossible states.
|
||||
Tail = 1, // Part of a word segment, but not the first character.
|
||||
Head = 2, // The first character of a word segment.
|
||||
|
|
|
@ -43,9 +43,9 @@ public:
|
|||
private:
|
||||
// We truncate the pattern and the word to bound the cost of matching.
|
||||
constexpr static int MaxPat = 63, MaxWord = 127;
|
||||
enum CharRole : char; // For segmentation.
|
||||
enum CharType : char; // For segmentation.
|
||||
enum Action { Miss = 0, Match = 1 };
|
||||
enum CharRole : unsigned char; // For segmentation.
|
||||
enum CharType : unsigned char; // For segmentation.
|
||||
enum Action : unsigned char { Miss = 0, Match = 1 };
|
||||
|
||||
bool init(llvm::StringRef Word);
|
||||
void buildGraph();
|
||||
|
|
Loading…
Reference in New Issue