Skip to content

Commit 9bd0426

Browse files
committed
[test] Ensure we set an input file for -print-header
This ensures we don't violate the invariant that a ModuleDecl isn't empty.
1 parent 8879ae5 commit 9bd0426

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tools/swift-ide-test/swift-ide-test.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -3099,10 +3099,12 @@ static int doPrintModules(const CompilerInvocation &InitInvok,
30993099
}
31003100

31013101
static int doPrintHeaders(const CompilerInvocation &InitInvok,
3102+
StringRef SourceFilename,
31023103
const std::vector<std::string> HeadersToPrint,
3103-
const PrintOptions &Options,
3104-
bool AnnotatePrint) {
3104+
const PrintOptions &Options, bool AnnotatePrint) {
31053105
CompilerInvocation Invocation(InitInvok);
3106+
Invocation.getFrontendOptions().InputsAndOutputs.addPrimaryInputFile(
3107+
SourceFilename);
31063108

31073109
CompilerInstance CI;
31083110
// Display diagnostics to stderr.
@@ -4780,9 +4782,9 @@ int main(int argc, char *argv[]) {
47804782
break;
47814783
}
47824784
case ActionType::PrintHeader: {
4783-
ExitCode = doPrintHeaders(
4784-
InitInvok, options::HeaderToPrint, PrintOpts,
4785-
options::AnnotatePrint);
4785+
ExitCode = doPrintHeaders(InitInvok, options::SourceFilename,
4786+
options::HeaderToPrint, PrintOpts,
4787+
options::AnnotatePrint);
47864788
break;
47874789
}
47884790

0 commit comments

Comments
 (0)