mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #81536 from cachemeifyoucan/eng/PR-151395300
[Caching] Clear benign CodeGen options when building modules
This commit is contained in:
@@ -90,6 +90,7 @@
|
||||
#include "clang/Serialization/ASTReader.h"
|
||||
#include "clang/Serialization/ASTWriter.h"
|
||||
#include "clang/Serialization/ObjectFilePCHContainerReader.h"
|
||||
#include "clang/Tooling/DependencyScanning/ModuleDepCollector.h"
|
||||
#include "clang/Tooling/DependencyScanning/ScanAndUpdateArgs.h"
|
||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
@@ -4232,11 +4233,12 @@ ClangImporter::getSwiftExplicitModuleDirectCC1Args() const {
|
||||
PPOpts.MacroIncludes.clear();
|
||||
PPOpts.Includes.clear();
|
||||
|
||||
// CodeGenOptions.
|
||||
auto &CGOpts = instance.getCodeGenOpts();
|
||||
CGOpts.DebugCompilationDir.clear();
|
||||
// Clear benign CodeGenOptions.
|
||||
clang::tooling::dependencies::resetBenignCodeGenOptions(
|
||||
clang::frontend::ActionKind::GenerateModule, instance.getLangOpts(),
|
||||
instance.getCodeGenOpts());
|
||||
|
||||
// FileSystemOptions.
|
||||
// FileSystemOptions.
|
||||
auto &FSOpts = instance.getFileSystemOpts();
|
||||
FSOpts.WorkingDir.clear();
|
||||
|
||||
|
||||
28
test/CAS/coverage-dir.swift
Normal file
28
test/CAS/coverage-dir.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t
|
||||
|
||||
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O -I %t/include \
|
||||
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
|
||||
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -profile-coverage-mapping -profile-generate
|
||||
|
||||
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
|
||||
// RUN: %swift_frontend_plain @%t/shim.cmd
|
||||
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
|
||||
// RUN: %swift_frontend_plain @%t/A.cmd
|
||||
|
||||
// RUN: %FileCheck %s --input-file=%t/shim.cmd
|
||||
// RUN: %FileCheck %s --input-file=%t/A.cmd
|
||||
|
||||
// CHECK: -direct-clang-cc1-module-build
|
||||
// CHECK-NOT: -fcoverage-compilation-dir
|
||||
|
||||
//--- main.swift
|
||||
import A
|
||||
func test() {
|
||||
a();
|
||||
}
|
||||
|
||||
//--- include/A.swiftinterface
|
||||
// swift-interface-format-version: 1.0
|
||||
// swift-module-flags: -module-name A -O -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -user-module-version 1.0
|
||||
public func a() { }
|
||||
Reference in New Issue
Block a user