File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,12 @@ class ClangDeclFinder
9595 return true ;
9696 }
9797
98+ bool VisitCXXInheritedCtorInitExpr (clang::CXXInheritedCtorInitExpr *CIE) {
99+ if (auto ctor = CIE->getConstructor ())
100+ callback (ctor);
101+ return true ;
102+ }
103+
98104 // Do not traverse unevaluated expressions. Doing to might result in compile
99105 // errors if we try to instantiate an un-instantiatable template.
100106
Original file line number Diff line number Diff line change 1+ // RUN: rm -rf %t
2+ // RUN: split-file %s %t
3+ // RUN: %target-swiftxx-frontend -emit-ir -I %t/Inputs -validate-tbd-against-ir=none %t/test.swift | %FileCheck %s
4+
5+ //--- Inputs/module.modulemap
6+ module BaseConstructor {
7+ header " test.h "
8+ requires cplusplus
9+ }
10+ //--- Inputs/test.h
11+
12+ extern void referencedSymbol( ) ;
13+ inline void emittedIntoSwiftObject( ) { referencedSymbol ( ) ; }
14+
15+ class BaseClass {
16+ public:
17+ inline BaseClass( ) : x( 0 ) { }
18+ inline BaseClass( bool v, const BaseClass & ) {
19+ if ( v)
20+ emittedIntoSwiftObject ( ) ;
21+ }
22+
23+ int x;
24+ } ;
25+
26+ class DerivedClass: public BaseClass {
27+ int y;
28+ public:
29+ using BaseClass: : BaseClass;
30+
31+ inline DerivedClass( int y) : y( y) { }
32+
33+ inline int test( ) const {
34+ DerivedClass m( true , * this) ;
35+ return m. x;
36+ }
37+ } ;
38+
39+ //--- test.swift
40+
41+ import BaseConstructor
42+
43+ public func test( ) {
44+ let i = DerivedClass ( 0 )
45+ let v = i. test ( )
46+ }
47+
48+ // Make sure we reach clang declarations accessible from base constructors:
49+
50+ // CHECK: define linkonce_odr{{( dso_local)?}} void @{{_Z22emittedIntoSwiftObjectv|"\?emittedIntoSwiftObject@@YAXXZ"}}
You can’t perform that action at this time.
0 commit comments