Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/DependencyScan/ScanDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,15 +1272,15 @@ bool swift::dependencies::scanDependencies(CompilerInstance &instance) {
std::string path = opts.InputsAndOutputs.getSingleOutputFilename();
// `-scan-dependencies` invocations use a single new instance
// of a module cache
SwiftDependencyScanningService service;
SwiftDependencyScanningService *service = Context.Allocate<SwiftDependencyScanningService>();
if (opts.ReuseDependencyScannerCache)
deserializeDependencyCache(instance, service);
deserializeDependencyCache(instance, *service);

if (service.setupCachingDependencyScanningService(instance))
if (service->setupCachingDependencyScanningService(instance))
return true;

ModuleDependenciesCache cache(
service, instance.getMainModule()->getNameStr().str(),
*service, instance.getMainModule()->getNameStr().str(),
instance.getInvocation().getFrontendOptions().ExplicitModulesOutputPath,
instance.getInvocation().getModuleScanningHash());

Expand All @@ -1291,7 +1291,7 @@ bool swift::dependencies::scanDependencies(CompilerInstance &instance) {
// Serialize the dependency cache if -serialize-dependency-scan-cache
// is specified
if (opts.SerializeDependencyScannerCache)
serializeDependencyCache(instance, service);
serializeDependencyCache(instance, *service);

if (dependenciesOrErr.getError())
return true;
Expand All @@ -1315,9 +1315,9 @@ bool swift::dependencies::prescanDependencies(CompilerInstance &instance) {
std::string path = opts.InputsAndOutputs.getSingleOutputFilename();
// `-scan-dependencies` invocations use a single new instance
// of a module cache
SwiftDependencyScanningService singleUseService;
SwiftDependencyScanningService *singleUseService = Context.Allocate<SwiftDependencyScanningService>();
ModuleDependenciesCache cache(
singleUseService, instance.getMainModule()->getNameStr().str(),
*singleUseService, instance.getMainModule()->getNameStr().str(),
instance.getInvocation().getFrontendOptions().ExplicitModulesOutputPath,
instance.getInvocation().getModuleScanningHash());

Expand Down
3 changes: 0 additions & 3 deletions test/ScanDependencies/error_path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
// REQUIRES: objc_interop
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -emit-dependencies -emit-dependencies-path %t/deps.d -import-objc-header %S/Inputs/CHeaders/Bridging.h -swift-version 4 2>&1 | %FileCheck %s

// There is a use-after-free in ScanDependencies rdar://131388478
// XFAIL: asan

import P

// CHECK: {{.*}}{{/|\\}}Z.swiftinterface:3:8: error: Unable to find module dependency: 'missing_module'
Expand Down
3 changes: 0 additions & 3 deletions test/ScanDependencies/error_source_locations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import P
import FooBar


// There is a use-after-free in ScanDependencies rdar://131388478
// XFAIL: asan

// CHECK: {{.*}}{{/|\\}}error_source_locations.swift:7:8: error: Unable to find module dependency: 'FooBar'
// CHECK-NEXT: 5 |
// CHECK-NEXT: 6 | import P
Expand Down