@@ -46,12 +46,12 @@ struct Parser::TokenInfo {
46
46
TokenInfo () = default ;
47
47
48
48
// Method to set the kind and text of the token
49
- void set (TokenKind newKind, StringRef newText) {
49
+ void set (TokenKind newKind, llvm:: StringRef newText) {
50
50
kind = newKind;
51
51
text = newText;
52
52
}
53
53
54
- StringRef text;
54
+ llvm:: StringRef text;
55
55
TokenKind kind = TK_Eof;
56
56
SourceRange range;
57
57
VariantValue value;
@@ -60,13 +60,13 @@ struct Parser::TokenInfo {
60
60
class Parser ::CodeTokenizer {
61
61
public:
62
62
// Constructor with matcherCode and error
63
- explicit CodeTokenizer (StringRef & matcherCode, Diagnostics *error)
63
+ explicit CodeTokenizer (llvm:: StringRef matcherCode, Diagnostics *error)
64
64
: code(matcherCode), startOfLine(matcherCode), line(1 ), error(error) {
65
65
nextToken = getNextToken ();
66
66
}
67
67
68
68
// Constructor with matcherCode, error, and codeCompletionOffset
69
- CodeTokenizer (StringRef & matcherCode, Diagnostics *error,
69
+ CodeTokenizer (llvm:: StringRef matcherCode, Diagnostics *error,
70
70
unsigned codeCompletionOffset)
71
71
: code(matcherCode), startOfLine(matcherCode), error(error),
72
72
codeCompletionLocation (matcherCode.data() + codeCompletionOffset) {
@@ -102,9 +102,9 @@ class Parser::CodeTokenizer {
102
102
private:
103
103
// Helper function to get the first character as a new StringRef and drop it
104
104
// from the original string
105
- StringRef firstCharacterAndDrop (StringRef &str) {
105
+ llvm:: StringRef firstCharacterAndDrop (llvm:: StringRef &str) {
106
106
assert (!str.empty ());
107
- StringRef firstChar = str.substr (0 , 1 );
107
+ llvm:: StringRef firstChar = str.substr (0 , 1 );
108
108
str = str.drop_front ();
109
109
return firstChar;
110
110
}
@@ -118,7 +118,7 @@ class Parser::CodeTokenizer {
118
118
// Code completion case
119
119
if (codeCompletionLocation && codeCompletionLocation <= code.data ()) {
120
120
result.set (TokenInfo::TK_CodeCompletion,
121
- StringRef (codeCompletionLocation, 0 ));
121
+ llvm:: StringRef (codeCompletionLocation, 0 ));
122
122
codeCompletionLocation = nullptr ;
123
123
return result;
124
124
}
@@ -186,7 +186,7 @@ class Parser::CodeTokenizer {
186
186
return ;
187
187
}
188
188
}
189
- StringRef errorText = code;
189
+ llvm:: StringRef errorText = code;
190
190
code = code.drop_front (code.size ());
191
191
SourceRange range;
192
192
range.start = result->range .start ;
@@ -228,7 +228,7 @@ class Parser::CodeTokenizer {
228
228
// Consume all leading whitespace from code, except newlines
229
229
void consumeWhitespace () {
230
230
code = code.drop_while (
231
- [](char c) { return StringRef (" \t\v\f\r " ).contains (c); });
231
+ [](char c) { return llvm:: StringRef (" \t\v\f\r " ).contains (c); });
232
232
}
233
233
234
234
// Returns the current location in the source code
@@ -239,8 +239,8 @@ class Parser::CodeTokenizer {
239
239
return location;
240
240
}
241
241
242
- StringRef code;
243
- StringRef startOfLine;
242
+ llvm:: StringRef code;
243
+ llvm:: StringRef startOfLine;
244
244
unsigned line = 1 ;
245
245
Diagnostics *error;
246
246
TokenInfo nextToken;
@@ -486,7 +486,7 @@ bool Parser::parseMatcherExpressionImpl(const TokenInfo &nameToken,
486
486
// completions minus the prefix.
487
487
void Parser::addCompletion (const TokenInfo &compToken,
488
488
const MatcherCompletion &completion) {
489
- if (StringRef (completion.typedText ).startswith (compToken.text )) {
489
+ if (llvm:: StringRef (completion.typedText ).startswith (compToken.text )) {
490
490
completions.emplace_back (completion.typedText .substr (compToken.text .size ()),
491
491
completion.matcherDecl );
492
492
}
@@ -572,7 +572,7 @@ Parser::Parser(CodeTokenizer *tokenizer, Sema *sema,
572
572
Parser::RegistrySema::~RegistrySema () = default ;
573
573
574
574
std::optional<MatcherCtor>
575
- Parser::RegistrySema::lookupMatcherCtor (StringRef matcherName) {
575
+ Parser::RegistrySema::lookupMatcherCtor (llvm:: StringRef matcherName) {
576
576
return Registry::lookupMatcherCtor (matcherName);
577
577
}
578
578
@@ -603,7 +603,7 @@ Parser::RegistrySema::buildMatcherCtor(MatcherCtor ctor, SourceRange nameRange,
603
603
return Registry::buildMatcherCtor (ctor, nameRange, args, error);
604
604
}
605
605
606
- bool Parser::parseExpression (StringRef &code, Sema *sema,
606
+ bool Parser::parseExpression (llvm:: StringRef &code, Sema *sema,
607
607
const NamedValueMap *namedValues,
608
608
VariantValue *value, Diagnostics *error) {
609
609
CodeTokenizer tokenizer (code, error);
@@ -619,7 +619,7 @@ bool Parser::parseExpression(StringRef &code, Sema *sema,
619
619
}
620
620
621
621
std::vector<MatcherCompletion>
622
- Parser::completeExpression (StringRef &code, unsigned completionOffset,
622
+ Parser::completeExpression (llvm:: StringRef &code, unsigned completionOffset,
623
623
Sema *sema, const NamedValueMap *namedValues) {
624
624
Diagnostics error;
625
625
CodeTokenizer tokenizer (code, &error, completionOffset);
@@ -631,7 +631,7 @@ Parser::completeExpression(StringRef &code, unsigned completionOffset,
631
631
}
632
632
633
633
std::optional<DynMatcher>
634
- Parser::parseMatcherExpression (StringRef &code, Sema *sema,
634
+ Parser::parseMatcherExpression (llvm:: StringRef &code, Sema *sema,
635
635
const NamedValueMap *namedValues,
636
636
Diagnostics *error) {
637
637
VariantValue value;
0 commit comments