File tree Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -878,6 +878,8 @@ Module *ClangImporter::Implementation::finishLoadingClangModule(
878
878
// but that's not correct for submodules.
879
879
Identifier name = SwiftContext.getIdentifier ((*clangModule).Name );
880
880
result = Module::create (name, SwiftContext);
881
+ // Silence error messages about testably importing a Clang module.
882
+ result->setTestingEnabled ();
881
883
882
884
wrapperUnit =
883
885
new (SwiftContext) ClangModuleUnit (*result, owner, clangModule);
@@ -1019,6 +1021,8 @@ ClangModuleUnit *ClangImporter::Implementation::getWrapperForModule(
1019
1021
// FIXME: Handle hierarchical names better.
1020
1022
Identifier name = SwiftContext.getIdentifier (underlying->Name );
1021
1023
auto wrapper = Module::create (name, SwiftContext);
1024
+ // Silence error messages about testably importing a Clang module.
1025
+ wrapper->setTestingEnabled ();
1022
1026
1023
1027
auto file = new (SwiftContext) ClangModuleUnit (*wrapper, importer,
1024
1028
underlying);
Original file line number Diff line number Diff line change 1
1
module AttrObjc_FooClangModule { header "attr_objc_foo_clang_module.h" }
2
+ module Testable_ClangModule { header "testable_clang.h" }
Original file line number Diff line number Diff line change
1
+ extern int clangGlobal ;
Original file line number Diff line number Diff line change 1
1
// RUN: rm -rf %t && mkdir %t
2
2
// RUN: %target-swift-frontend -emit-module -enable-testing -o %t %S/../Inputs/empty.swift
3
- // RUN: %target-swift-frontend -parse -I %t %s -verify
4
- // RUN: %target-swift-frontend -parse -I %t %s -disable-testable-attr-requires-testable-module -DIMPORTS_ONLY
3
+ // RUN: %target-swift-frontend -parse -I %t -I %S/Inputs/custom-modules %s -verify
4
+ // RUN: %target-swift-frontend -parse -I %t -I %S/Inputs/custom-modules %s -disable-testable-attr-requires-testable-module -DIMPORTS_ONLY
5
5
6
6
@testable import Swift // expected-error {{module 'Swift' was not compiled for testing}}
7
7
@testable import empty // no-error
8
+ @testable import Testable_ClangModule // no-error
9
+
10
+ _ = clangGlobal
8
11
9
12
#if !IMPORTS_ONLY
10
13
@testable func foo( ) { } // expected-error {{@testable may only be used on 'import' declarations}}
You can’t perform that action at this time.
0 commit comments