mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[frontend] Begin moving search path-related options into SearchPathOptions.
Added a new SearchPathOptions class to swiftAST, which will contain options like import search paths and the SDK path. Moved the RuntimeIncludePath from CompilerInvocation into SearchPathOptions. For now, at least, the RuntimeIncludePath is handled separately from other ImportSearchPaths, since we can’t yet guarantee that RuntimeIncludePath is set up before we parse the ImportSearchPaths. Added a SearchPathOptions member to ASTContext. Updated findModule() in SourceLoader.cpp and SerializedModuleLoader.cpp to check RuntimeIncludePath after everything else if no module was found. (This matches existing behavior, which had RuntimeIncludedPath at the end of ImportSearchPaths.) Swift SVN r11213
This commit is contained in:
@@ -85,6 +85,16 @@ static llvm::error_code findModule(ASTContext &ctx, AccessPathElem moduleID,
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, check the runtime include path.
|
||||
inputFilename = ctx.SearchPathOpts.RuntimeIncludePath;
|
||||
llvm::sys::path::append(inputFilename, moduleFilename.str());
|
||||
err = llvm::MemoryBuffer::getFile(inputFilename.str(), bufferRef);
|
||||
if (!err) {
|
||||
buffer.reset(bufferRef.take());
|
||||
return err;
|
||||
}
|
||||
|
||||
// If we get here, we couldn't find the module, so return our most recent err.
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user