@@ -5740,6 +5740,7 @@ InputInfo Driver::BuildJobsForActionNoCache(
5740
5740
5741
5741
// Only use pipes when there is exactly one input.
5742
5742
InputInfoList InputInfos;
5743
+ bool JobForPreprocessToStdout = false ;
5743
5744
for (const Action *Input : Inputs) {
5744
5745
// Treat dsymutil and verify sub-jobs as being at the top-level too, they
5745
5746
// shouldn't get temporary output names.
@@ -5750,6 +5751,11 @@ InputInfo Driver::BuildJobsForActionNoCache(
5750
5751
C, Input, TC, BoundArch, SubJobAtTopLevel, MultipleArchs, LinkingOutput,
5751
5752
CachedResults, A->getOffloadingDeviceKind ()));
5752
5753
}
5754
+ // Check if we are in sub-work for preprocessing for host side. If so we will
5755
+ // add another job to print information to terminal later.
5756
+ if (!AtTopLevel && A->getKind () == Action::PreprocessJobClass &&
5757
+ C.getJobs ().size () == 1 )
5758
+ JobForPreprocessToStdout = true ;
5753
5759
5754
5760
// Always use the first input as the base input.
5755
5761
const char *BaseInput = InputInfos[0 ].getBaseInput ();
@@ -5784,6 +5790,7 @@ InputInfo Driver::BuildJobsForActionNoCache(
5784
5790
5785
5791
// Determine the place to write output to, if any.
5786
5792
InputInfo Result;
5793
+ InputInfo ResultForPreprocessToStdout;
5787
5794
InputInfoList UnbundlingResults;
5788
5795
if (auto *UA = dyn_cast<OffloadUnbundlingJobAction>(JA)) {
5789
5796
// If we have an unbundling job, we need to create results for all the
@@ -5945,6 +5952,8 @@ InputInfo Driver::BuildJobsForActionNoCache(
5945
5952
AtTopLevel, MultipleArchs,
5946
5953
OffloadingPrefix),
5947
5954
BaseInput);
5955
+ if (JobForPreprocessToStdout)
5956
+ ResultForPreprocessToStdout = InputInfo (A, " -" , BaseInput);
5948
5957
}
5949
5958
5950
5959
if (CCCPrintBindings && !CCGenDiagnostics) {
@@ -5967,12 +5976,19 @@ InputInfo Driver::BuildJobsForActionNoCache(
5967
5976
llvm::errs () << " ] \n " ;
5968
5977
}
5969
5978
} else {
5970
- if (UnbundlingResults.empty ())
5979
+ if (UnbundlingResults.empty ()) {
5971
5980
T->ConstructJob (
5972
5981
C, *JA, Result, InputInfos,
5973
5982
C.getArgsForToolChain (TC, BoundArch, JA->getOffloadingDeviceKind ()),
5974
5983
LinkingOutput);
5975
- else
5984
+ // Add another job to print information to terminal for host side.
5985
+ if (JobForPreprocessToStdout) {
5986
+ T->ConstructJob (
5987
+ C, *JA, ResultForPreprocessToStdout, InputInfos,
5988
+ C.getArgsForToolChain (TC, BoundArch, JA->getOffloadingDeviceKind ()),
5989
+ LinkingOutput);
5990
+ }
5991
+ } else
5976
5992
T->ConstructJobMultipleOutputs (
5977
5993
C, *JA, UnbundlingResults, InputInfos,
5978
5994
C.getArgsForToolChain (TC, BoundArch, JA->getOffloadingDeviceKind ()),
0 commit comments