Factor code from tools & move input conversion.

This commit is contained in:
David Ungar
2017-11-14 14:23:46 -08:00
parent 72ad29a5fb
commit 3f3d784144
14 changed files with 340 additions and 194 deletions

View File

@@ -780,7 +780,7 @@ static bool performCompile(CompilerInstance &Instance,
if (opts.Inputs.haveAPrimaryInputFile()) {
FileUnit *PrimaryFile = PrimarySourceFile;
if (!PrimaryFile) {
auto Index = opts.Inputs.getPrimaryInput().getValue().Index;
auto Index = opts.Inputs.getOptionalPrimaryInput()->Index;
PrimaryFile = Instance.getMainModule()->getFiles()[Index];
}
astGuaranteedToCorrespondToSIL = !fileIsSIB(PrimaryFile);