@@ -697,10 +697,14 @@ extension Driver {
697697 }
698698 let updatedPath = plainPath. parentDirectory. appending ( component: " \( plainPath. basenameWithoutExt) - \( contextHash) . \( plainPath. extension!) " )
699699 dependencyGraph. modules [ moduleId] !. modulePath = TextualVirtualPath ( path: updatedPath. intern ( ) )
700- } else if case . clang( let clangDetails) = moduleInfo. details {
701- let contextHash = clangDetails. contextHash
702- let updatedPath = plainPath. parentDirectory. appending ( component: " \( plainPath. basenameWithoutExt) - \( contextHash) . \( plainPath. extension!) " )
703- dependencyGraph. modules [ moduleId] !. modulePath = TextualVirtualPath ( path: updatedPath. intern ( ) )
700+ }
701+ // TODO: Remove this once toolchain is updated
702+ else if case . clang( let clangDetails) = moduleInfo. details {
703+ if !moduleInfo. modulePath. path. description. contains ( clangDetails. contextHash) {
704+ let contextHash = clangDetails. contextHash
705+ let updatedPath = plainPath. parentDirectory. appending ( component: " \( plainPath. basenameWithoutExt) - \( contextHash) . \( plainPath. extension!) " )
706+ dependencyGraph. modules [ moduleId] !. modulePath = TextualVirtualPath ( path: updatedPath. intern ( ) )
707+ }
704708 }
705709 }
706710 }
@@ -711,17 +715,28 @@ extension Driver {
711715 throws {
712716 for (moduleId, moduleInfo) in dependencyGraph. modules {
713717 // Output path on the main module is determined by the invocation arguments.
714- if case . swift( let name) = moduleId,
715- name == dependencyGraph. mainModuleName {
716- continue
718+ if case . swift( let name) = moduleId {
719+ if name == dependencyGraph. mainModuleName {
720+ continue
721+ }
722+ let modulePath = VirtualPath . lookup ( moduleInfo. modulePath. path)
723+ // Use VirtualPath to get the OS-specific path separators right.
724+ let modulePathInCache =
725+ try VirtualPath ( path: moduleCachePath)
726+ . appending ( component: modulePath. basename)
727+ dependencyGraph. modules [ moduleId] !. modulePath =
728+ TextualVirtualPath ( path: modulePathInCache. intern ( ) )
729+ }
730+ // TODO: Remove this once toolchain is updated
731+ else if case . clang( _) = moduleId {
732+ let modulePath = VirtualPath . lookup ( moduleInfo. modulePath. path)
733+ // Use VirtualPath to get the OS-specific path separators right.
734+ let modulePathInCache =
735+ try VirtualPath ( path: moduleCachePath)
736+ . appending ( component: modulePath. basename)
737+ dependencyGraph. modules [ moduleId] !. modulePath =
738+ TextualVirtualPath ( path: modulePathInCache. intern ( ) )
717739 }
718- let modulePath = VirtualPath . lookup ( moduleInfo. modulePath. path)
719- // Use VirtualPath to get the OS-specific path separators right.
720- let modulePathInCache =
721- try VirtualPath ( path: moduleCachePath)
722- . appending ( component: modulePath. basename)
723- dependencyGraph. modules [ moduleId] !. modulePath =
724- TextualVirtualPath ( path: modulePathInCache. intern ( ) )
725740 }
726741 }
727742
0 commit comments