@@ -419,7 +419,7 @@ namespace driver {
419
419
// / TaskFinishedResponse::ContinueExecution from any of the constituent
420
420
// / calls.
421
421
TaskFinishedResponse
422
- unpackAndFinishBatch (ProcessId Pid, int ReturnCode, StringRef Output,
422
+ unpackAndFinishBatch (int ReturnCode, StringRef Output,
423
423
StringRef Errors, const BatchJob *B) {
424
424
if (Comp.ShowJobLifecycle )
425
425
llvm::outs () << " Batch job finished: " << LogJob (B) << " \n " ;
@@ -428,7 +428,8 @@ namespace driver {
428
428
if (Comp.ShowJobLifecycle )
429
429
llvm::outs () << " ==> Unpacked batch constituent finished: "
430
430
<< LogJob (J) << " \n " ;
431
- auto r = taskFinished (Pid, ReturnCode, Output, Errors, (void *)J);
431
+ auto r = taskFinished (llvm::sys::ProcessInfo::InvalidPid, ReturnCode, Output,
432
+ Errors, (void *)J);
432
433
if (r != TaskFinishedResponse::ContinueExecution)
433
434
res = r;
434
435
}
@@ -443,26 +444,29 @@ namespace driver {
443
444
StringRef Errors, void *Context) {
444
445
const Job *FinishedCmd = (const Job *)Context;
445
446
446
- if (Comp.ShowDriverTimeCompilation ) {
447
- DriverTimers[FinishedCmd]->stopTimer ();
447
+ if (Pid != llvm::sys::ProcessInfo::InvalidPid) {
448
+
449
+ if (Comp.ShowDriverTimeCompilation ) {
450
+ DriverTimers[FinishedCmd]->stopTimer ();
451
+ }
452
+
453
+ if (Comp.Level == OutputLevel::Parseable) {
454
+ // Parseable output was requested.
455
+ parseable_output::emitFinishedMessage (llvm::errs (), *FinishedCmd, Pid,
456
+ ReturnCode, Output);
457
+ } else {
458
+ // Otherwise, send the buffered output to stderr, though only if we
459
+ // support getting buffered output.
460
+ if (TaskQueue::supportsBufferingOutput ())
461
+ llvm::errs () << Output;
462
+ }
448
463
}
449
464
450
465
if (BatchJobs.count (FinishedCmd) != 0 ) {
451
- return unpackAndFinishBatch (Pid, ReturnCode, Output, Errors,
466
+ return unpackAndFinishBatch (ReturnCode, Output, Errors,
452
467
static_cast <const BatchJob *>(FinishedCmd));
453
468
}
454
469
455
- if (Comp.Level == OutputLevel::Parseable) {
456
- // Parseable output was requested.
457
- parseable_output::emitFinishedMessage (llvm::errs (), *FinishedCmd, Pid,
458
- ReturnCode, Output);
459
- } else {
460
- // Otherwise, send the buffered output to stderr, though only if we
461
- // support getting buffered output.
462
- if (TaskQueue::supportsBufferingOutput ())
463
- llvm::errs () << Output;
464
- }
465
-
466
470
// In order to handle both old dependencies that have disappeared and new
467
471
// dependencies that have arisen, we need to reload the dependency file.
468
472
// Do this whether or not the build succeeded.
@@ -505,30 +509,6 @@ namespace driver {
505
509
return TaskFinishedResponse::ContinueExecution;
506
510
}
507
511
508
- // / Unpack a \c BatchJob that has finished into its constituent \c Job
509
- // / members, and call \c taskSignalled on each, propagating any \c
510
- // / TaskFinishedResponse other than \c
511
- // / TaskFinishedResponse::ContinueExecution from any of the constituent
512
- // / calls.
513
- TaskFinishedResponse
514
- unpackAndSignalBatch (ProcessId Pid, StringRef ErrorMsg, StringRef Output,
515
- StringRef Errors, const BatchJob *B,
516
- Optional<int > Signal) {
517
- if (Comp.ShowJobLifecycle )
518
- llvm::outs () << " Batch job signalled: " << LogJob (B) << " \n " ;
519
- auto res = TaskFinishedResponse::ContinueExecution;
520
- for (const Job *J : B->getCombinedJobs ()) {
521
- if (Comp.ShowJobLifecycle )
522
- llvm::outs () << " ==> Unpacked batch constituent signalled: "
523
- << LogJob (J) << " \n " ;
524
- auto r = taskSignalled (Pid, ErrorMsg, Output, Errors,
525
- (void *)J, Signal);
526
- if (r != TaskFinishedResponse::ContinueExecution)
527
- res = r;
528
- }
529
- return res;
530
- }
531
-
532
512
TaskFinishedResponse
533
513
taskSignalled (ProcessId Pid, StringRef ErrorMsg, StringRef Output,
534
514
StringRef Errors, void *Context, Optional<int > Signal) {
@@ -538,12 +518,6 @@ namespace driver {
538
518
DriverTimers[SignalledCmd]->stopTimer ();
539
519
}
540
520
541
- if (BatchJobs.count (SignalledCmd) != 0 ) {
542
- return unpackAndSignalBatch (Pid, ErrorMsg, Output, Errors,
543
- static_cast <const BatchJob *>(SignalledCmd),
544
- Signal);
545
- }
546
-
547
521
if (Comp.Level == OutputLevel::Parseable) {
548
522
// Parseable output was requested.
549
523
parseable_output::emitSignalledMessage (llvm::errs (), *SignalledCmd,
@@ -554,7 +528,6 @@ namespace driver {
554
528
if (TaskQueue::supportsBufferingOutput ())
555
529
llvm::errs () << Output;
556
530
}
557
-
558
531
if (!ErrorMsg.empty ())
559
532
Comp.Diags .diagnose (SourceLoc (), diag::error_unable_to_execute_command,
560
533
ErrorMsg);
0 commit comments