[ModuleInterface] Create module cache path if we install a forwarding module

If we are installing a forwarding module to something in the prebuilt
cache, make sure to create the module cache directory if it doesn't
exist.

rdar://52964217
This commit is contained in:
Harlan Haskins
2019-07-12 17:15:10 -07:00
parent ca1e808bde
commit db7a726a7f
2 changed files with 18 additions and 1 deletions

View File

@@ -504,7 +504,7 @@ public:
// Note that we don't assume cachePath is the same as the Clang
// module cache path at this point.
if (!moduleCachePath.empty())
(void)llvm::sys::fs::create_directory(moduleCachePath);
(void)llvm::sys::fs::create_directories(moduleCachePath);
configureSubInvocationInputsAndOutputs(OutPath);
@@ -1267,6 +1267,10 @@ class ParseableInterfaceModuleLoaderImpl {
depsAdjustedToMTime.push_back(adjustedDep);
}
// Create the module cache if we haven't created it yet.
StringRef parentDir = path::parent_path(outputPath);
(void)llvm::sys::fs::create_directories(parentDir);
auto hadError = withOutputFile(diags, outputPath,
[&](llvm::raw_pwrite_stream &out) {
llvm::yaml::Output yamlWriter(out);