[ClangImporter] Pass through diagnostic locations for imports.

If importing a Clang module fails, we should report that at the location of
the import statement. This doesn't do that fully because it isn't transitive
(if Swift module Foo imports Swift module Bar, which fails to import Clang
module Baz, we don't get an error in user source), but it's a step forward
for the simple cases.

Swift SVN r20575
This commit is contained in:
Jordan Rose
2014-07-25 23:01:51 +00:00
parent 51dcd8bf63
commit aae4a3d731
9 changed files with 36 additions and 22 deletions

View File

@@ -198,7 +198,8 @@ FileUnit *SerializedModuleLoader::loadAST(
auto fileUnit = new (Ctx) SerializedASTFile(M, *loadedModuleFile);
M.addFile(*fileUnit);
if (loadedModuleFile->associateWithFileContext(fileUnit)) {
auto diagLocOrInvalid = diagLoc.getValueOr(SourceLoc());
if (loadedModuleFile->associateWithFileContext(fileUnit, diagLocOrInvalid)) {
LoadedModuleFiles.emplace_back(std::move(loadedModuleFile),
Ctx.getCurrentGeneration());
return fileUnit;