Skip to content

Commit 97b46c4

Browse files
add test for top-level decls of Clang submodules
1 parent e1f568e commit 97b46c4

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,6 +2998,7 @@ class VectorDeclPtrConsumer : public swift::VisibleDeclConsumer {
29982998
};
29992999
} // unnamed namespace
30003000

3001+
// FIXME: should submodules still be crawled for the symbol graph? (SR-15753)
30013002
bool ClangModuleUnit::shouldCollectDisplayDecls() const { return isTopLevel(); }
30023003

30033004
void ClangModuleUnit::getTopLevelDecls(SmallVectorImpl<Decl*> &results) const {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
double outerVar = 1.0;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
double innerVar = 2.0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Mixed {
2+
header "Mixed.h"
3+
export *
4+
5+
explicit module Submodule {
6+
header "Submodule.h"
7+
export *
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/Submodules -emit-module-path %t/Submodules.swiftmodule -enable-objc-interop -module-name Submodules %s -emit-symbol-graph -emit-symbol-graph-dir %t
3+
4+
// REQUIRES: objc_interop
5+
6+
// Don't crash when a module declared an `@_exported import` for a Clang non-top-level module.
7+
8+
@_exported import Mixed
9+
@_exported import Mixed.Submodule
10+
11+
public func someFunc() {}

0 commit comments

Comments
 (0)