@@ -923,6 +923,7 @@ struct CompletionTestToken {
923
923
StringRef Name;
924
924
SmallVector<StringRef, 1 > CheckPrefixes;
925
925
StringRef Skip;
926
+ StringRef Xfail;
926
927
Optional<bool > IncludeKeywords = None;
927
928
Optional<bool > IncludeComments = None;
928
929
@@ -1003,6 +1004,10 @@ struct CompletionTestToken {
1003
1004
Result.Skip = Value;
1004
1005
continue ;
1005
1006
}
1007
+ if (Key == " xfail" ) {
1008
+ Result.Xfail = Value;
1009
+ continue ;
1010
+ }
1006
1011
Error = " unknown option (" + Key.str () + " ) for token" ;
1007
1012
return true ;
1008
1013
}
@@ -1166,6 +1171,7 @@ static int doBatchCodeCompletion(const CompilerInvocation &InitInvok,
1166
1171
1167
1172
// Process tokens.
1168
1173
SmallVector<StringRef, 0 > FailedTokens;
1174
+ SmallVector<StringRef, 0 > UPassTokens;
1169
1175
for (const auto &Token : CCTokens) {
1170
1176
if (!options::CodeCompletionToken.empty () &&
1171
1177
options::CodeCompletionToken != Token.Name )
@@ -1185,6 +1191,11 @@ static int doBatchCodeCompletion(const CompilerInvocation &InitInvok,
1185
1191
continue ;
1186
1192
}
1187
1193
1194
+ bool failureExpected = !Token.Xfail .empty ();
1195
+ if (failureExpected) {
1196
+ llvm::errs () << " Xfail: " << Token.Xfail << " \n " ;
1197
+ }
1198
+
1188
1199
auto IncludeKeywords = CodeCompletionKeywords;
1189
1200
if (Token.IncludeKeywords )
1190
1201
IncludeKeywords = *Token.IncludeKeywords ;
@@ -1291,23 +1302,37 @@ static int doBatchCodeCompletion(const CompilerInvocation &InitInvok,
1291
1302
}
1292
1303
}
1293
1304
1294
- if (isFileCheckFailed) {
1305
+ if (isFileCheckFailed == failureExpected) {
1306
+ // Success. The result may be huge. Remove the result if it's succeeded.
1307
+ llvm::sys::fs::remove (resultFilename);
1308
+ } else if (isFileCheckFailed) {
1309
+ // Unexpectedly failed.
1295
1310
FailedTokens.push_back (Token.Name );
1296
1311
} else {
1297
- // The result may be huge. Remove the result if it's succeeded .
1298
- llvm::sys::fs::remove (resultFilename );
1312
+ // Unexpectedly passed .
1313
+ UPassTokens. push_back (Token. Name );
1299
1314
}
1300
1315
}
1301
1316
1317
+ if (FailedTokens.empty () && UPassTokens.empty ())
1318
+ return 0 ;
1319
+
1320
+ llvm::errs () << " ----\n " ;
1302
1321
if (!FailedTokens.empty ()) {
1303
- llvm::errs () << " ----\n " ;
1304
1322
llvm::errs () << " Unexpected failures: " ;
1305
1323
llvm::interleave (
1306
1324
FailedTokens, [&](StringRef name) { llvm::errs () << name; },
1307
1325
[&]() { llvm::errs () << " , " ; });
1326
+ llvm::errs () << " \n " ;
1308
1327
}
1309
-
1310
- return !FailedTokens.empty ();
1328
+ if (!UPassTokens.empty ()) {
1329
+ llvm::errs () << " Unexpected passes: " ;
1330
+ llvm::interleave (
1331
+ UPassTokens, [&](StringRef name) { llvm::errs () << name; },
1332
+ [&]() { llvm::errs () << " , " ; });
1333
+ llvm::errs () << " \n " ;
1334
+ }
1335
+ return 1 ;
1311
1336
}
1312
1337
1313
1338
static int doREPLCodeCompletion (const CompilerInvocation &InitInvok,
0 commit comments