Skip to content

Commit ca2078a

Browse files
committed
Productionalize
1 parent 9252498 commit ca2078a

11 files changed

+60
-54
lines changed

lib/IRGen/GenClangDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ clang::Decl *getDeclWithExecutableCode(clang::Decl *decl) {
6161
return initializingDecl;
6262
}
6363
} else if (auto rd = dyn_cast<clang::CXXRecordDecl>(decl)) {
64-
if(rd->getBraceRange().isValid()) {
65-
return rd;
64+
if(rd->hasDefinition()) {
65+
return rd->getDefinition();
6666
}
6767
}
6868

test/Interop/Cxx/members/Inputs/emit-called-constructor.h renamed to test/Interop/Cxx/members/Inputs/call-constructor copy.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
#ifndef TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_CONSTRUCTOR_H
2-
#define TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_CONSTRUCTOR_H
1+
#ifndef TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H
2+
#define TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H
3+
4+
struct Incrementor;
35

46
inline int increment(int t) {
57
return t + 1;
@@ -14,4 +16,4 @@ inline int useIncrementor() {
1416
return Incrementor(41).incrementee;
1517
}
1618

17-
#endif // TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_CONSTRUCTOR_H
19+
#endif // TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H
2+
#define TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H
3+
//struct Incrementor;
4+
5+
inline int increment(int t) {
6+
return t + 1;
7+
}
8+
9+
struct Incrementor {
10+
int incrementee;
11+
Incrementor(int value) : incrementee(increment(value)) {}
12+
};
13+
14+
inline int useIncrementor() {
15+
return Incrementor(41).incrementee;
16+
}
17+
18+
#endif // TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_CONSTRUCTOR_H

test/Interop/Cxx/members/Inputs/emit-called-method.h renamed to test/Interop/Cxx/members/Inputs/call-method.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_METHOD_H
2-
#define TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_METHOD_H
1+
#ifndef TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_METHOD_H
2+
#define TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_METHOD_H
33

44
inline int increment(int t) {
55
return t + 1;
@@ -17,4 +17,4 @@ inline int callMethod() {
1717
return Incrementor(41).callIncrement();
1818
}
1919

20-
#endif // TEST_INTEROP_CXX_MEMBERS_INPUTS_EMIT_CALLED_METHOD_H
20+
#endif // TEST_INTEROP_CXX_MEMBERS_INPUTS_CALL_METHOD_H
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
module ConstructorsInvokingFunctions {
2-
header "constructors-invoking-functions.h"
3-
}
1+
module CallConstructor {
2+
header "call-constructor.h"
3+
}
4+
5+
module CallMethod {
6+
header "call-method.h"
7+
}

test/Interop/Cxx/members/emit-called-constructor-irgen.swift

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/Interop/Cxx/members/emit-called-method-irgen.swift

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s
2+
3+
import CallConstructor
4+
5+
public func getIncrementorValue() -> CInt {
6+
return useIncrementor()
7+
}
8+
9+
// CHECK: define linkonce_odr i32 @_Z9incrementi(i32 %t)

test/Interop/Cxx/members/emit-called-constructor.swift renamed to test/Interop/Cxx/members/emit-from-called-constructor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
//
33
// REQUIRES: executable_test
44

5-
import EmitCalledConstructor
5+
import CallConstructor
66
import StdlibUnittest
77

88
var MembersTestSuite = TestSuite("MembersTestSuite")
99

10-
MembersTestSuite.test("transitive-function-constructor") {
10+
MembersTestSuite.test("emit-from-called-constructor") {
1111
expectEqual(42, useIncrementor())
1212
}
1313

14-
runAllTests()
14+
runAllTests()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-swift-emit-ir %s -I %S/Inputs -enable-cxx-interop | %FileCheck %s
2+
3+
import CallMethod
4+
5+
public func getValueFromMethod() -> CInt {
6+
return callMethod()
7+
}
8+
9+
// CHECK: define linkonce_odr i32 @_Z9incrementi(i32 %t)

test/Interop/Cxx/members/emit-called-method.swift renamed to test/Interop/Cxx/members/emit-from-called-method.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
//
33
// REQUIRES: executable_test
44

5-
import EmitCalledMethod
5+
import CallMethod
66
import StdlibUnittest
77

8-
var TemplatesTestSuite = TestSuite("TemplatesTestSuite")
8+
var MembersTestSuite = TestSuite("MembersTestSuite")
99

10-
TemplatesTestSuite.test("emit-called-method") {
10+
MembersTestSuite.test("emit-from-called-method") {
1111
expectEqual(42, callMethod())
1212
}
1313

14-
runAllTests()
14+
runAllTests()

0 commit comments

Comments
 (0)