Skip to content

Add emission of Frontend parseable-output in WMO jobs. #58422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2022

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Apr 26, 2022

Frontend emitting parsable output, as implemented, emitted began/finished messages on a per-primary basis. Which means that -frontend-parseable-output had no effect in contexts where no primary inputs are specified, such as WMO. This change fixes that by also emitting began/finished messages when no primary outputs are specified.

Resolves rdar://91999048

@artemcm
Copy link
Contributor Author

artemcm commented Apr 26, 2022

@swift-ci please test

@artemcm artemcm force-pushed the ParseableWMOOutput branch from 41afdc5 to bef7970 Compare April 26, 2022 22:43
@artemcm
Copy link
Contributor Author

artemcm commented Apr 26, 2022

@swift-ci please test

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, but I'm otherwise happy with this.

Comment on lines 2211 to +2218
const char *const Delim = "";
std::ostringstream JoinedDiags;
std::copy(PrimaryDiags.begin(), PrimaryDiags.end(),
std::copy(AllDiagnostics.begin(), AllDiagnostics.end(),
std::ostream_iterator<std::string>(JoinedDiags, Delim));

emitFinishedMessage(llvm::errs(),
mapFrontendInvocationToAction(Invocation),
JoinedDiags.str(), r, Pid - idx, ProcInfo);
return false;
});
JoinedDiags.str(), r, OSPid, ProcInfo);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I notice that this code is essentially duplicated between the two branches, just with slightly different parameters to emitFinishedMessage(). Do you think there's a way you could combine them?

Comment on lines 612 to 618
// Outputs for Primary Inputs
for (const auto &input : PrimaryInputs) {
auto OutputFile = input.outputFilename();
Outputs.push_back(OutputPair(file_types::lookupTypeForExtension(
llvm::sys::path::extension(OutputFile)),
OutputFile));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct for WMO invocations that produce a single main output? In that case, I believe the first input has the main output + supplementary outputs associated with it, and the remaining inputs have empty outputs. Should we be using forEachOutputFilename and forEachInputProducingSupplementaryOutput here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will be equivalent to what the code does now already. Right below this code-block we iterate over all the inputs again and gather supplementary outputs per-input. So while the iteration may be redundant, we should not miss any outputs. I've updated the test with an additional supplementary output just to make sure it is consistently shown in both WMO and non-WMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right yeah, we won't miss any outputs, but I believe we'll be writing out empty outputs for all but the first input in a WMO invocation with multiple inputs and a single main output. Is that expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, of course, now I see it. Will fix, thank you.

@artemcm artemcm force-pushed the ParseableWMOOutput branch from bef7970 to 4348fdd Compare April 27, 2022 21:12
@artemcm
Copy link
Contributor Author

artemcm commented Apr 27, 2022

@swift-ci please test

@artemcm artemcm force-pushed the ParseableWMOOutput branch from 4348fdd to 9e787f2 Compare April 27, 2022 21:54
@artemcm
Copy link
Contributor Author

artemcm commented Apr 27, 2022

@swift-ci please test

…shed messages on a per-primary basis. Which means that `-frontend-parseable-output` had no effect in contexts where no primary inputs are specified, such as WMO. This change fixes that by also emitting began/finished messages when no primary outputs are specified.

Resolves rdar://91999048
@artemcm artemcm force-pushed the ParseableWMOOutput branch from 9e787f2 to 9d2aecb Compare April 28, 2022 20:24
@artemcm
Copy link
Contributor Author

artemcm commented Apr 28, 2022

@swift-ci please smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Apr 28, 2022

@swift-ci please smoke test Windows platform

@artemcm
Copy link
Contributor Author

artemcm commented Apr 28, 2022

@swift-ci please smoke test Linux platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants