Provide the correct primary file name to IRGenOpts.

Previously, we were always using the first file name as the main source
file name in the debug info, which was completely wrong and led to only
that file having debug info.

<rdar://problem/15786017>, again.

Swift SVN r13665
This commit is contained in:
Jordan Rose
2014-02-08 00:13:45 +00:00
parent d75da69b2f
commit cb83bb02a8
3 changed files with 13 additions and 2 deletions

View File

@@ -691,8 +691,12 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
// TODO: investigate whether these should be removed, in favor of definitions
// in other classes.
if (!FrontendOpts.InputFilenames.empty())
Opts.MainInputFilename = FrontendOpts.InputFilenames[0];
if (FrontendOpts.PrimaryInput && FrontendOpts.PrimaryInput->isFilename()) {
unsigned Index = FrontendOpts.PrimaryInput->Index;
Opts.MainInputFilename = FrontendOpts.InputFilenames[Index];
} else if (FrontendOpts.InputFilenames.size() == 1) {
Opts.MainInputFilename = FrontendOpts.InputFilenames.front();
}
Opts.OutputFilename = FrontendOpts.OutputFilename;
Opts.ModuleName = FrontendOpts.ModuleName;