@@ -3223,7 +3223,7 @@ static int doPrintUSRs(const CompilerInvocation &InitInvok,
3223
3223
return 0 ;
3224
3224
}
3225
3225
3226
- static int doTestCreateCompilerInvocation (ArrayRef<const char *> Args) {
3226
+ static int doTestCreateCompilerInvocation (ArrayRef<const char *> Args, bool ForceNoOutputs ) {
3227
3227
PrintingDiagnosticConsumer PDC;
3228
3228
SourceManager SM;
3229
3229
DiagnosticEngine Diags (SM);
@@ -3232,8 +3232,13 @@ static int doTestCreateCompilerInvocation(ArrayRef<const char *> Args) {
3232
3232
CompilerInvocation CI;
3233
3233
bool HadError = driver::getSingleFrontendInvocationFromDriverArguments (
3234
3234
Args, Diags, [&](ArrayRef<const char *> FrontendArgs) {
3235
+ llvm::outs () << " Frontend Arguments BEGIN\n " ;
3236
+ for (const char *arg : FrontendArgs) {
3237
+ llvm::outs () << arg << " \n " ;
3238
+ }
3239
+ llvm::outs () << " Frontend Arguments END\n " ;
3235
3240
return CI.parseArgs (FrontendArgs, Diags);
3236
- });
3241
+ }, ForceNoOutputs );
3237
3242
3238
3243
if (HadError) {
3239
3244
llvm::errs () << " error: unable to create a CompilerInvocation\n " ;
@@ -3271,8 +3276,13 @@ int main(int argc, char *argv[]) {
3271
3276
// llvm::cl::ParseCommandLineOptions.
3272
3277
StringRef FirstArg (argv[1 ]);
3273
3278
if (FirstArg == " -test-createCompilerInvocation" ) {
3279
+ bool ForceNoOutputs = false ;
3274
3280
ArrayRef<const char *> Args (argv + 2 , argc - 2 );
3275
- return doTestCreateCompilerInvocation (Args);
3281
+ if (argc > 2 && StringRef (argv[2 ]) == " -force-no-outputs" ) {
3282
+ ForceNoOutputs = true ;
3283
+ Args = Args.drop_front ();
3284
+ }
3285
+ return doTestCreateCompilerInvocation (Args, ForceNoOutputs);
3276
3286
}
3277
3287
}
3278
3288
0 commit comments