File tree Expand file tree Collapse file tree 2 files changed +55
-6
lines changed Expand file tree Collapse file tree 2 files changed +55
-6
lines changed Original file line number Diff line number Diff line change @@ -399,15 +399,16 @@ ASTBuilder::findModule(const Demangle::NodePointer &node) {
399
399
400
400
Demangle::NodePointer
401
401
ASTBuilder::findModuleNode (const Demangle::NodePointer &node) {
402
- if (node->getKind () == Demangle::Node::Kind::Module)
403
- return node;
402
+ auto child = node;
403
+ while (child->hasChildren () &&
404
+ child->getKind () != Demangle::Node::Kind::Module) {
405
+ child = child->getFirstChild ();
406
+ }
404
407
405
- if (!node->hasChildren ()) return nullptr ;
406
- const auto &child = node->getFirstChild ();
407
- if (child->getKind () != Demangle::Node::Kind::DeclContext)
408
+ if (child->getKind () != Demangle::Node::Kind::Module)
408
409
return nullptr ;
409
410
410
- return findModuleNode ( child-> getFirstChild ()) ;
411
+ return child;
411
412
}
412
413
413
414
Optional<ASTBuilder::ForeignModuleKind>
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+
3
+ // RUN: %target-build-swift -emit-executable %s -g -o %t/local_types -emit-module
4
+ // RUN: sed -ne '/\/\/ *DEMANGLE: /s/\/\/ *DEMANGLE: *//p' < %s > %t/input
5
+ // RUN: %lldb-moduleimport-test %t/local_types -type-from-mangled=%t/input | %FileCheck %s
6
+
7
+ func blackHole( _: Any ... ) { }
8
+
9
+ func foo( ) {
10
+ struct Outer {
11
+ struct Inner { }
12
+ struct GenericInner < T> { }
13
+ }
14
+
15
+ do {
16
+ let x1 = Outer ( )
17
+ let x2 = Outer . Inner ( )
18
+ let x3 = Outer . GenericInner < Int > ( )
19
+
20
+ blackHole ( x1, x2, x3)
21
+ }
22
+
23
+ do {
24
+ let x1 = Outer . self
25
+ let x2 = Outer . Inner. self
26
+ let x3 = Outer . GenericInner< Int> . self
27
+
28
+ blackHole ( x1, x2, x3)
29
+ }
30
+ }
31
+
32
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_VD
33
+ // CHECK: Outer
34
+
35
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_V5InnerVD
36
+ // CHECK: Outer.Inner
37
+
38
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_V12GenericInnerVy_SiGD
39
+ // CHECK: Outer.GenericInner<Int>
40
+
41
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_VmD
42
+ // CHECK: Outer.Type
43
+
44
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_V5InnerVmD
45
+ // CHECK: Outer.Inner.Type
46
+
47
+ // DEMANGLE: $s11local_types3fooyyF5OuterL_V12GenericInnerVy_SiGmD
48
+ // CHECK: Outer.GenericInner<Int>.Type
You can’t perform that action at this time.
0 commit comments