@@ -269,10 +269,10 @@ bool FileCheckPattern::EvaluateExpression(StringRef Expr, std::string &Value) co
269
269
// / there is a match, the size of the matched string is returned in \p
270
270
// / MatchLen.
271
271
// /
272
- // / The \p VariableTable StringMap provides the current values of filecheck
273
- // / variables and is updated if this match defines new values.
274
- size_t FileCheckPattern::Match (StringRef Buffer, size_t &MatchLen,
275
- StringMap<StringRef> &VariableTable ) const {
272
+ // / The GlobalVariableTable StringMap in the FileCheckPatternContext class
273
+ // / instance provides the current values of FileCheck variables and is updated
274
+ // / if this match defines new values.
275
+ size_t FileCheckPattern::match (StringRef Buffer, size_t &MatchLen ) const {
276
276
// If this is the EOF pattern, match it immediately.
277
277
if (CheckTy == Check::CheckEOF) {
278
278
MatchLen = 0 ;
@@ -302,14 +302,14 @@ size_t FileCheckPattern::Match(StringRef Buffer, size_t &MatchLen,
302
302
if (!EvaluateExpression (VariableUse.first , Value))
303
303
return StringRef::npos;
304
304
} else {
305
- StringMap <StringRef>::iterator it =
306
- VariableTable. find (VariableUse.first );
305
+ llvm::Optional <StringRef> ValueRef =
306
+ Context-> getVarValue (VariableUse.first );
307
307
// If the variable is undefined, return an error.
308
- if (it == VariableTable. end () )
308
+ if (!ValueRef )
309
309
return StringRef::npos;
310
310
311
311
// Look up the value and escape it so that we can put it into the regex.
312
- Value += Regex::escape (it-> second );
312
+ Value += Regex::escape (*ValueRef );
313
313
}
314
314
315
315
// Plop it into the regex at the adjusted offset.
@@ -333,7 +333,8 @@ size_t FileCheckPattern::Match(StringRef Buffer, size_t &MatchLen,
333
333
// If this defines any variables, remember their values.
334
334
for (const auto &VariableDef : VariableDefs) {
335
335
assert (VariableDef.second < MatchInfo.size () && " Internal paren error" );
336
- VariableTable[VariableDef.first ] = MatchInfo[VariableDef.second ];
336
+ Context->GlobalVariableTable [VariableDef.first ] =
337
+ MatchInfo[VariableDef.second ];
337
338
}
338
339
339
340
// Like CHECK-NEXT, CHECK-EMPTY's match range is considered to start after
@@ -344,13 +345,10 @@ size_t FileCheckPattern::Match(StringRef Buffer, size_t &MatchLen,
344
345
return FullMatch.data () - Buffer.data () + MatchStartSkip;
345
346
}
346
347
347
-
348
348
// / Computes an arbitrary estimate for the quality of matching this pattern at
349
349
// / the start of \p Buffer; a distance of zero should correspond to a perfect
350
350
// / match.
351
- unsigned
352
- FileCheckPattern::ComputeMatchDistance (StringRef Buffer,
353
- const StringMap<StringRef> &VariableTable) const {
351
+ unsigned FileCheckPattern::computeMatchDistance (StringRef Buffer) const {
354
352
// Just compute the number of matching characters. For regular expressions, we
355
353
// just compare against the regex itself and hope for the best.
356
354
//
@@ -367,9 +365,8 @@ FileCheckPattern::ComputeMatchDistance(StringRef Buffer,
367
365
return BufferPrefix.edit_distance (ExampleString);
368
366
}
369
367
370
- void FileCheckPattern::PrintVariableUses (const SourceMgr &SM, StringRef Buffer,
371
- const StringMap<StringRef> &VariableTable,
372
- SMRange MatchRange) const {
368
+ void FileCheckPattern::printVariableUses (const SourceMgr &SM, StringRef Buffer,
369
+ SMRange MatchRange) const {
373
370
// If this was a regular expression using variables, print the current
374
371
// variable values.
375
372
if (!VariableUses.empty ()) {
@@ -388,16 +385,16 @@ void FileCheckPattern::PrintVariableUses(const SourceMgr &SM, StringRef Buffer,
388
385
OS.write_escaped (Var) << " \" " ;
389
386
}
390
387
} else {
391
- StringMap <StringRef>::const_iterator it = VariableTable. find (Var);
388
+ llvm::Optional <StringRef> VarValue = Context-> getVarValue (Var);
392
389
393
390
// Check for undefined variable references.
394
- if (it == VariableTable. end () ) {
391
+ if (!VarValue ) {
395
392
OS << " uses undefined variable \" " ;
396
393
OS.write_escaped (Var) << " \" " ;
397
394
} else {
398
395
OS << " with variable \" " ;
399
396
OS.write_escaped (Var) << " \" equal to \" " ;
400
- OS.write_escaped (it-> second ) << " \" " ;
397
+ OS.write_escaped (*VarValue ) << " \" " ;
401
398
}
402
399
}
403
400
@@ -429,9 +426,8 @@ static SMRange ProcessMatchResult(FileCheckDiag::MatchType MatchTy,
429
426
return Range;
430
427
}
431
428
432
- void FileCheckPattern::PrintFuzzyMatch (
429
+ void FileCheckPattern::printFuzzyMatch (
433
430
const SourceMgr &SM, StringRef Buffer,
434
- const StringMap<StringRef> &VariableTable,
435
431
std::vector<FileCheckDiag> *Diags) const {
436
432
// Attempt to find the closest/best fuzzy match. Usually an error happens
437
433
// because some string in the output didn't exactly match. In these cases, we
@@ -453,7 +449,7 @@ void FileCheckPattern::PrintFuzzyMatch(
453
449
454
450
// Compute the "quality" of this match as an arbitrary combination of the
455
451
// match distance and the number of lines skipped to get to this match.
456
- unsigned Distance = ComputeMatchDistance (Buffer.substr (i), VariableTable );
452
+ unsigned Distance = computeMatchDistance (Buffer.substr (i));
457
453
double Quality = Distance + (NumLinesForward / 100 .);
458
454
459
455
if (Quality < BestQuality || Best == StringRef::npos) {
@@ -477,6 +473,15 @@ void FileCheckPattern::PrintFuzzyMatch(
477
473
}
478
474
}
479
475
476
+ llvm::Optional<StringRef>
477
+ FileCheckPatternContext::getVarValue (StringRef VarName) {
478
+ auto VarIter = GlobalVariableTable.find (VarName);
479
+ if (VarIter == GlobalVariableTable.end ())
480
+ return llvm::None;
481
+
482
+ return VarIter->second ;
483
+ }
484
+
480
485
// / Finds the closing sequence of a regex variable usage or definition.
481
486
// /
482
487
// / \p Str has to point in the beginning of the definition (right after the
@@ -747,9 +752,11 @@ FindFirstMatchingPrefix(Regex &PrefixRE, StringRef &Buffer,
747
752
// /
748
753
// / The strings are added to the CheckStrings vector. Returns true in case of
749
754
// / an error, false otherwise.
750
- bool llvm::FileCheck::ReadCheckFile (SourceMgr &SM, StringRef Buffer,
751
- Regex &PrefixRE,
752
- std::vector<FileCheckString> &CheckStrings) {
755
+ bool llvm::FileCheck::ReadCheckFile (
756
+ SourceMgr &SM, StringRef Buffer, Regex &PrefixRE,
757
+ std::vector<FileCheckString> &CheckStrings) {
758
+ PatternContext.defineCmdlineVariables (Req.GlobalDefines );
759
+
753
760
std::vector<FileCheckPattern> ImplicitNegativeChecks;
754
761
for (const auto &PatternString : Req.ImplicitCheckNot ) {
755
762
// Create a buffer with fake command line content in order to display the
@@ -763,7 +770,8 @@ bool llvm::FileCheck::ReadCheckFile(SourceMgr &SM, StringRef Buffer,
763
770
CmdLine->getBuffer ().substr (Prefix.size (), PatternString.size ());
764
771
SM.AddNewSourceBuffer (std::move (CmdLine), SMLoc ());
765
772
766
- ImplicitNegativeChecks.push_back (FileCheckPattern (Check::CheckNot));
773
+ ImplicitNegativeChecks.push_back (
774
+ FileCheckPattern (Check::CheckNot, &PatternContext));
767
775
ImplicitNegativeChecks.back ().ParsePattern (PatternInBuffer,
768
776
" IMPLICIT-CHECK" , SM, 0 , Req);
769
777
}
@@ -826,7 +834,7 @@ bool llvm::FileCheck::ReadCheckFile(SourceMgr &SM, StringRef Buffer,
826
834
SMLoc PatternLoc = SMLoc::getFromPointer (Buffer.data ());
827
835
828
836
// Parse the pattern.
829
- FileCheckPattern P (CheckTy);
837
+ FileCheckPattern P (CheckTy, &PatternContext );
830
838
if (P.ParsePattern (Buffer.substr (0 , EOL), UsedPrefix, SM, LineNumber, Req))
831
839
return true ;
832
840
@@ -870,8 +878,9 @@ bool llvm::FileCheck::ReadCheckFile(SourceMgr &SM, StringRef Buffer,
870
878
// Add an EOF pattern for any trailing CHECK-DAG/-NOTs, and use the first
871
879
// prefix as a filler for the error message.
872
880
if (!DagNotMatches.empty ()) {
873
- CheckStrings.emplace_back (FileCheckPattern (Check::CheckEOF), *Req.CheckPrefixes .begin (),
874
- SMLoc::getFromPointer (Buffer.data ()));
881
+ CheckStrings.emplace_back (
882
+ FileCheckPattern (Check::CheckEOF, &PatternContext),
883
+ *Req.CheckPrefixes .begin (), SMLoc::getFromPointer (Buffer.data ()));
875
884
std::swap (DagNotMatches, CheckStrings.back ().DagNotStrings );
876
885
}
877
886
@@ -896,8 +905,7 @@ bool llvm::FileCheck::ReadCheckFile(SourceMgr &SM, StringRef Buffer,
896
905
897
906
static void PrintMatch (bool ExpectedMatch, const SourceMgr &SM,
898
907
StringRef Prefix, SMLoc Loc, const FileCheckPattern &Pat,
899
- int MatchedCount, StringRef Buffer,
900
- StringMap<StringRef> &VariableTable, size_t MatchPos,
908
+ int MatchedCount, StringRef Buffer, size_t MatchPos,
901
909
size_t MatchLen, const FileCheckRequest &Req,
902
910
std::vector<FileCheckDiag> *Diags) {
903
911
bool PrintDiag = true ;
@@ -929,24 +937,22 @@ static void PrintMatch(bool ExpectedMatch, const SourceMgr &SM,
929
937
Loc, ExpectedMatch ? SourceMgr::DK_Remark : SourceMgr::DK_Error, Message);
930
938
SM.PrintMessage (MatchRange.Start , SourceMgr::DK_Note, " found here" ,
931
939
{MatchRange});
932
- Pat.PrintVariableUses (SM, Buffer, VariableTable , MatchRange);
940
+ Pat.printVariableUses (SM, Buffer, MatchRange);
933
941
}
934
942
935
943
static void PrintMatch (bool ExpectedMatch, const SourceMgr &SM,
936
944
const FileCheckString &CheckStr, int MatchedCount,
937
- StringRef Buffer, StringMap<StringRef> &VariableTable ,
938
- size_t MatchPos, size_t MatchLen, FileCheckRequest &Req,
945
+ StringRef Buffer, size_t MatchPos, size_t MatchLen ,
946
+ FileCheckRequest &Req,
939
947
std::vector<FileCheckDiag> *Diags) {
940
948
PrintMatch (ExpectedMatch, SM, CheckStr.Prefix , CheckStr.Loc , CheckStr.Pat ,
941
- MatchedCount, Buffer, VariableTable, MatchPos, MatchLen, Req,
942
- Diags);
949
+ MatchedCount, Buffer, MatchPos, MatchLen, Req, Diags);
943
950
}
944
951
945
952
static void PrintNoMatch (bool ExpectedMatch, const SourceMgr &SM,
946
953
StringRef Prefix, SMLoc Loc,
947
954
const FileCheckPattern &Pat, int MatchedCount,
948
- StringRef Buffer, StringMap<StringRef> &VariableTable,
949
- bool VerboseVerbose,
955
+ StringRef Buffer, bool VerboseVerbose,
950
956
std::vector<FileCheckDiag> *Diags) {
951
957
bool PrintDiag = true ;
952
958
if (!ExpectedMatch) {
@@ -982,19 +988,18 @@ static void PrintNoMatch(bool ExpectedMatch, const SourceMgr &SM,
982
988
SM.PrintMessage (SearchRange.Start , SourceMgr::DK_Note, " scanning from here" );
983
989
984
990
// Allow the pattern to print additional information if desired.
985
- Pat.PrintVariableUses (SM, Buffer, VariableTable );
991
+ Pat.printVariableUses (SM, Buffer);
986
992
987
993
if (ExpectedMatch)
988
- Pat.PrintFuzzyMatch (SM, Buffer, VariableTable , Diags);
994
+ Pat.printFuzzyMatch (SM, Buffer, Diags);
989
995
}
990
996
991
997
static void PrintNoMatch (bool ExpectedMatch, const SourceMgr &SM,
992
998
const FileCheckString &CheckStr, int MatchedCount,
993
- StringRef Buffer, StringMap<StringRef> &VariableTable,
994
- bool VerboseVerbose,
999
+ StringRef Buffer, bool VerboseVerbose,
995
1000
std::vector<FileCheckDiag> *Diags) {
996
1001
PrintNoMatch (ExpectedMatch, SM, CheckStr.Prefix , CheckStr.Loc , CheckStr.Pat ,
997
- MatchedCount, Buffer, VariableTable, VerboseVerbose, Diags);
1002
+ MatchedCount, Buffer, VerboseVerbose, Diags);
998
1003
}
999
1004
1000
1005
// / Count the number of newlines in the specified range.
@@ -1023,7 +1028,6 @@ static unsigned CountNumNewlinesBetween(StringRef Range,
1023
1028
// / Match check string and its "not strings" and/or "dag strings".
1024
1029
size_t FileCheckString::Check (const SourceMgr &SM, StringRef Buffer,
1025
1030
bool IsLabelScanMode, size_t &MatchLen,
1026
- StringMap<StringRef> &VariableTable,
1027
1031
FileCheckRequest &Req,
1028
1032
std::vector<FileCheckDiag> *Diags) const {
1029
1033
size_t LastPos = 0 ;
@@ -1035,7 +1039,7 @@ size_t FileCheckString::Check(const SourceMgr &SM, StringRef Buffer,
1035
1039
// over the block again (including the last CHECK-LABEL) in normal mode.
1036
1040
if (!IsLabelScanMode) {
1037
1041
// Match "dag strings" (with mixed "not strings" if any).
1038
- LastPos = CheckDag (SM, Buffer, NotStrings, VariableTable, Req, Diags);
1042
+ LastPos = CheckDag (SM, Buffer, NotStrings, Req, Diags);
1039
1043
if (LastPos == StringRef::npos)
1040
1044
return StringRef::npos;
1041
1045
}
@@ -1050,18 +1054,17 @@ size_t FileCheckString::Check(const SourceMgr &SM, StringRef Buffer,
1050
1054
StringRef MatchBuffer = Buffer.substr (LastMatchEnd);
1051
1055
size_t CurrentMatchLen;
1052
1056
// get a match at current start point
1053
- size_t MatchPos = Pat.Match (MatchBuffer, CurrentMatchLen, VariableTable );
1057
+ size_t MatchPos = Pat.match (MatchBuffer, CurrentMatchLen);
1054
1058
if (i == 1 )
1055
1059
FirstMatchPos = LastPos + MatchPos;
1056
1060
1057
1061
// report
1058
1062
if (MatchPos == StringRef::npos) {
1059
- PrintNoMatch (true , SM, *this , i, MatchBuffer, VariableTable,
1060
- Req.VerboseVerbose , Diags);
1063
+ PrintNoMatch (true , SM, *this , i, MatchBuffer, Req.VerboseVerbose , Diags);
1061
1064
return StringRef::npos;
1062
1065
}
1063
- PrintMatch (true , SM, *this , i, MatchBuffer, VariableTable, MatchPos ,
1064
- CurrentMatchLen, Req, Diags);
1066
+ PrintMatch (true , SM, *this , i, MatchBuffer, MatchPos, CurrentMatchLen, Req ,
1067
+ Diags);
1065
1068
1066
1069
// move start point after the match
1067
1070
LastMatchEnd += MatchPos + CurrentMatchLen;
@@ -1096,7 +1099,7 @@ size_t FileCheckString::Check(const SourceMgr &SM, StringRef Buffer,
1096
1099
1097
1100
// If this match had "not strings", verify that they don't exist in the
1098
1101
// skipped region.
1099
- if (CheckNot (SM, SkippedRegion, NotStrings, VariableTable, Req, Diags))
1102
+ if (CheckNot (SM, SkippedRegion, NotStrings, Req, Diags))
1100
1103
return StringRef::npos;
1101
1104
}
1102
1105
@@ -1170,22 +1173,21 @@ bool FileCheckString::CheckSame(const SourceMgr &SM, StringRef Buffer) const {
1170
1173
bool FileCheckString::CheckNot (
1171
1174
const SourceMgr &SM, StringRef Buffer,
1172
1175
const std::vector<const FileCheckPattern *> &NotStrings,
1173
- StringMap<StringRef> &VariableTable, const FileCheckRequest &Req,
1174
- std::vector<FileCheckDiag> *Diags) const {
1176
+ const FileCheckRequest &Req, std::vector<FileCheckDiag> *Diags) const {
1175
1177
for (const FileCheckPattern *Pat : NotStrings) {
1176
1178
assert ((Pat->getCheckTy () == Check::CheckNot) && " Expect CHECK-NOT!" );
1177
1179
1178
1180
size_t MatchLen = 0 ;
1179
- size_t Pos = Pat->Match (Buffer, MatchLen, VariableTable );
1181
+ size_t Pos = Pat->match (Buffer, MatchLen);
1180
1182
1181
1183
if (Pos == StringRef::npos) {
1182
1184
PrintNoMatch (false , SM, Prefix, Pat->getLoc (), *Pat, 1 , Buffer,
1183
- VariableTable, Req.VerboseVerbose , Diags);
1185
+ Req.VerboseVerbose , Diags);
1184
1186
continue ;
1185
1187
}
1186
1188
1187
- PrintMatch (false , SM, Prefix, Pat->getLoc (), *Pat, 1 , Buffer, VariableTable ,
1188
- Pos, MatchLen, Req, Diags);
1189
+ PrintMatch (false , SM, Prefix, Pat->getLoc (), *Pat, 1 , Buffer, Pos, MatchLen ,
1190
+ Req, Diags);
1189
1191
1190
1192
return true ;
1191
1193
}
@@ -1197,7 +1199,6 @@ bool FileCheckString::CheckNot(
1197
1199
size_t
1198
1200
FileCheckString::CheckDag (const SourceMgr &SM, StringRef Buffer,
1199
1201
std::vector<const FileCheckPattern *> &NotStrings,
1200
- StringMap<StringRef> &VariableTable,
1201
1202
const FileCheckRequest &Req,
1202
1203
std::vector<FileCheckDiag> *Diags) const {
1203
1204
if (DagNotStrings.empty ())
@@ -1238,19 +1239,19 @@ FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
1238
1239
// CHECK-DAG group.
1239
1240
for (auto MI = MatchRanges.begin (), ME = MatchRanges.end (); true ; ++MI) {
1240
1241
StringRef MatchBuffer = Buffer.substr (MatchPos);
1241
- size_t MatchPosBuf = Pat.Match (MatchBuffer, MatchLen, VariableTable );
1242
+ size_t MatchPosBuf = Pat.match (MatchBuffer, MatchLen);
1242
1243
// With a group of CHECK-DAGs, a single mismatching means the match on
1243
1244
// that group of CHECK-DAGs fails immediately.
1244
1245
if (MatchPosBuf == StringRef::npos) {
1245
1246
PrintNoMatch (true , SM, Prefix, Pat.getLoc (), Pat, 1 , MatchBuffer,
1246
- VariableTable, Req.VerboseVerbose , Diags);
1247
+ Req.VerboseVerbose , Diags);
1247
1248
return StringRef::npos;
1248
1249
}
1249
1250
// Re-calc it as the offset relative to the start of the original string.
1250
1251
MatchPos += MatchPosBuf;
1251
1252
if (Req.VerboseVerbose )
1252
- PrintMatch (true , SM, Prefix, Pat.getLoc (), Pat, 1 , Buffer,
1253
- VariableTable, MatchPos, MatchLen, Req, Diags);
1253
+ PrintMatch (true , SM, Prefix, Pat.getLoc (), Pat, 1 , Buffer, MatchPos,
1254
+ MatchLen, Req, Diags);
1254
1255
MatchRange M{MatchPos, MatchPos + MatchLen};
1255
1256
if (Req.AllowDeprecatedDagOverlap ) {
1256
1257
// We don't need to track all matches in this mode, so we just maintain
@@ -1297,8 +1298,8 @@ FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
1297
1298
MatchPos = MI->End ;
1298
1299
}
1299
1300
if (!Req.VerboseVerbose )
1300
- PrintMatch (true , SM, Prefix, Pat.getLoc (), Pat, 1 , Buffer, VariableTable ,
1301
- MatchPos, MatchLen, Req, Diags);
1301
+ PrintMatch (true , SM, Prefix, Pat.getLoc (), Pat, 1 , Buffer, MatchPos ,
1302
+ MatchLen, Req, Diags);
1302
1303
1303
1304
// Handle the end of a CHECK-DAG group.
1304
1305
if (std::next (PatItr) == PatEnd ||
@@ -1309,7 +1310,7 @@ FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
1309
1310
// region.
1310
1311
StringRef SkippedRegion =
1311
1312
Buffer.slice (StartPos, MatchRanges.begin ()->Pos );
1312
- if (CheckNot (SM, SkippedRegion, NotStrings, VariableTable, Req, Diags))
1313
+ if (CheckNot (SM, SkippedRegion, NotStrings, Req, Diags))
1313
1314
return StringRef::npos;
1314
1315
// Clear "not strings".
1315
1316
NotStrings.clear ();
@@ -1373,16 +1374,22 @@ Regex llvm::FileCheck::buildCheckPrefixRegex() {
1373
1374
return Regex (PrefixRegexStr);
1374
1375
}
1375
1376
1376
- // Remove local variables from \p VariableTable. Global variables
1377
- // (start with '$') are preserved.
1378
- static void ClearLocalVars (StringMap<StringRef> &VariableTable) {
1379
- SmallVector<StringRef, 16 > LocalVars;
1380
- for (const auto &Var : VariableTable)
1377
+ void FileCheckPatternContext::defineCmdlineVariables (
1378
+ std::vector<std::string> &CmdlineDefines) {
1379
+ assert (GlobalVariableTable.empty () &&
1380
+ " Overriding defined variable with command-line variable definitions" );
1381
+ for (StringRef CmdlineDef : CmdlineDefines)
1382
+ GlobalVariableTable.insert (CmdlineDef.split (' =' ));
1383
+ }
1384
+
1385
+ void FileCheckPatternContext::clearLocalVars () {
1386
+ SmallVector<StringRef, 16 > LocalPatternVars, LocalNumericVars;
1387
+ for (const StringMapEntry<StringRef> &Var : GlobalVariableTable)
1381
1388
if (Var.first ()[0 ] != ' $' )
1382
- LocalVars .push_back (Var.first ());
1389
+ LocalPatternVars .push_back (Var.first ());
1383
1390
1384
- for (const auto &Var : LocalVars )
1385
- VariableTable .erase (Var);
1391
+ for (const auto &Var : LocalPatternVars )
1392
+ GlobalVariableTable .erase (Var);
1386
1393
}
1387
1394
1388
1395
// / Check the input to FileCheck provided in the \p Buffer against the \p
@@ -1394,12 +1401,6 @@ bool llvm::FileCheck::CheckInput(SourceMgr &SM, StringRef Buffer,
1394
1401
std::vector<FileCheckDiag> *Diags) {
1395
1402
bool ChecksFailed = false ;
1396
1403
1397
- // / VariableTable - This holds all the current filecheck variables.
1398
- StringMap<StringRef> VariableTable;
1399
-
1400
- for (const auto & Def : Req.GlobalDefines )
1401
- VariableTable.insert (StringRef (Def).split (' =' ));
1402
-
1403
1404
unsigned i = 0 , j = 0 , e = CheckStrings.size ();
1404
1405
while (true ) {
1405
1406
StringRef CheckRegion;
@@ -1414,10 +1415,10 @@ bool llvm::FileCheck::CheckInput(SourceMgr &SM, StringRef Buffer,
1414
1415
1415
1416
// Scan to next CHECK-LABEL match, ignoring CHECK-NOT and CHECK-DAG
1416
1417
size_t MatchLabelLen = 0 ;
1417
- size_t MatchLabelPos = CheckLabelStr. Check (
1418
- SM, Buffer, true , MatchLabelLen, VariableTable , Req, Diags);
1418
+ size_t MatchLabelPos =
1419
+ CheckLabelStr. Check ( SM, Buffer, true , MatchLabelLen, Req, Diags);
1419
1420
if (MatchLabelPos == StringRef::npos)
1420
- // Immediately bail of CHECK-LABEL fails, nothing else we can do.
1421
+ // Immediately bail if CHECK-LABEL fails, nothing else we can do.
1421
1422
return false ;
1422
1423
1423
1424
CheckRegion = Buffer.substr (0 , MatchLabelPos + MatchLabelLen);
@@ -1426,16 +1427,16 @@ bool llvm::FileCheck::CheckInput(SourceMgr &SM, StringRef Buffer,
1426
1427
}
1427
1428
1428
1429
if (Req.EnableVarScope )
1429
- ClearLocalVars (VariableTable );
1430
+ PatternContext. clearLocalVars ( );
1430
1431
1431
1432
for (; i != j; ++i) {
1432
1433
const FileCheckString &CheckStr = CheckStrings[i];
1433
1434
1434
1435
// Check each string within the scanned region, including a second check
1435
1436
// of any final CHECK-LABEL (to verify CHECK-NOT and CHECK-DAG)
1436
1437
size_t MatchLen = 0 ;
1437
- size_t MatchPos = CheckStr. Check (SM, CheckRegion, false , MatchLen,
1438
- VariableTable , Req, Diags);
1438
+ size_t MatchPos =
1439
+ CheckStr. Check (SM, CheckRegion, false , MatchLen , Req, Diags);
1439
1440
1440
1441
if (MatchPos == StringRef::npos) {
1441
1442
ChecksFailed = true ;
0 commit comments