Lines Matching refs:StringRef
65 StringRef FixedStr;
77 std::vector<std::pair<StringRef, unsigned> > VariableUses;
82 std::map<StringRef, unsigned> VariableDefs;
92 bool ParsePattern(StringRef PatternStr, SourceMgr &SM, unsigned LineNumber);
100 size_t Match(StringRef Buffer, size_t &MatchLen,
101 StringMap<StringRef> &VariableTable) const;
105 void PrintFailureInfo(const SourceMgr &SM, StringRef Buffer,
106 const StringMap<StringRef> &VariableTable) const;
109 static void AddFixedStringToRegEx(StringRef FixedStr, std::string &TheStr);
110 bool AddRegExToRegEx(StringRef RS, unsigned &CurParen, SourceMgr &SM);
116 unsigned ComputeMatchDistance(StringRef Buffer,
117 const StringMap<StringRef> &VariableTable) const;
121 bool EvaluateExpression(StringRef Expr, std::string &Value) const;
128 size_t FindRegexVarEnd(StringRef Str);
132 bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM, in ParsePattern()
152 (PatternStr.find("{{") == StringRef::npos && in ParsePattern()
153 PatternStr.find("[[") == StringRef::npos)) { in ParsePattern()
169 if (End == StringRef::npos) { in ParsePattern()
201 if (End == StringRef::npos) { in ParsePattern()
208 StringRef MatchStr = PatternStr.substr(2, End); in ParsePattern()
213 StringRef Name = MatchStr.substr(0, NameEnd); in ParsePattern()
227 if (NameEnd != StringRef::npos) { in ParsePattern()
252 if (NameEnd == StringRef::npos) { in ParsePattern()
292 void Pattern::AddFixedStringToRegEx(StringRef FixedStr, std::string &TheStr) { in AddFixedStringToRegEx()
319 bool Pattern::AddRegExToRegEx(StringRef RS, unsigned &CurParen, in AddRegExToRegEx()
341 bool Pattern::EvaluateExpression(StringRef Expr, std::string &Value) const { in EvaluateExpression()
345 Expr = Expr.substr(StringRef("@LINE").size()); in EvaluateExpression()
362 size_t Pattern::Match(StringRef Buffer, size_t &MatchLen, in Match()
363 StringMap<StringRef> &VariableTable) const { in Match()
380 StringRef RegExToMatch = RegExStr; in Match()
391 return StringRef::npos; in Match()
393 StringMap<StringRef>::iterator it = in Match()
397 return StringRef::npos; in Match()
414 SmallVector<StringRef, 4> MatchInfo; in Match()
416 return StringRef::npos; in Match()
420 StringRef FullMatch = MatchInfo[0]; in Match()
423 for (std::map<StringRef, unsigned>::const_iterator I = VariableDefs.begin(), in Match()
434 unsigned Pattern::ComputeMatchDistance(StringRef Buffer, in ComputeMatchDistance()
435 const StringMap<StringRef> &VariableTable) const { in ComputeMatchDistance()
442 StringRef ExampleString(FixedStr); in ComputeMatchDistance()
447 StringRef BufferPrefix = Buffer.substr(0, ExampleString.size()); in ComputeMatchDistance()
452 void Pattern::PrintFailureInfo(const SourceMgr &SM, StringRef Buffer, in PrintFailureInfo()
453 const StringMap<StringRef> &VariableTable) const{ in PrintFailureInfo()
460 StringRef Var = VariableUses[i].first; in PrintFailureInfo()
472 StringMap<StringRef>::const_iterator it = VariableTable.find(Var); in PrintFailureInfo()
495 size_t Best = StringRef::npos; in PrintFailureInfo()
513 if (Quality < BestQuality || Best == StringRef::npos) { in PrintFailureInfo()
522 if (Best && Best != StringRef::npos && BestQuality < 50) { in PrintFailureInfo()
531 size_t Pattern::FindRegexVarEnd(StringRef Str) { in FindRegexVarEnd()
561 return StringRef::npos; in FindRegexVarEnd()
651 StringRef Buffer = F->getBuffer(); in ReadCheckFile()
662 if (PrefixLoc == StringRef::npos) in ReadCheckFile()
749 StringRef Buffer, in PrintCheckFailed()
750 StringMap<StringRef> &VariableTable) { in PrintCheckFailed()
768 static unsigned CountNumNewlinesBetween(StringRef Range) { in CountNumNewlinesBetween()
820 StringMap<StringRef> VariableTable; in main()
824 StringRef Buffer = F->getBuffer(); in main()
831 StringRef SearchFrom = Buffer; in main()
839 if (MatchPos == StringRef::npos) { in main()
844 StringRef SkippedRegion(LastMatch, Buffer.data()-LastMatch); in main()
883 if (Pos == StringRef::npos) continue; in main()