Handle scoped imports for Clang submodules.

"import func Darwin.C.math.hypot" will now work to just import "hypot".
(Since 'Darwin.C.math' is an implicit submodule of 'Darwin',
 "import func Darwin.hypot" also works. That's okay.)

<rdar://problem/17272311>

Swift SVN r20356
This commit is contained in:
Jordan Rose
2014-07-23 01:12:39 +00:00
parent a0d3d31cc1
commit ed8f1c578e
3 changed files with 47 additions and 13 deletions

View File

@@ -182,7 +182,12 @@ SerializedModuleLoader::validateSerializedAST(StringRef data) {
}
std::string ModuleFile::Dependency::getPrettyPrintedPath() const {
std::string output = RawPath.str();
StringRef pathWithoutScope = RawPath;
if (isScoped()) {
size_t splitPoint = pathWithoutScope.find_last_of('\0');
pathWithoutScope = pathWithoutScope.slice(0, splitPoint);
}
std::string output = pathWithoutScope.str();
std::replace(output.begin(), output.end(), '\0', '.');
return output;
}