File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -684,10 +684,10 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const {
684
684
std::string s (1 , ' \01 ' );
685
685
s += asmLabel->getLabel ();
686
686
return s;
687
- } else if (namedClangDecl->hasAttr <clang::OverloadableAttr>()) {
687
+ } else if (namedClangDecl->hasAttr <clang::OverloadableAttr>() ||
688
+ getDecl ()->getASTContext ().LangOpts .EnableCXXInterop ) {
688
689
std::string storage;
689
690
llvm::raw_string_ostream SS (storage);
690
- // FIXME: When we can import C++, use Clang's mangler all the time.
691
691
mangleClangDecl (SS, namedClangDecl, getDecl ()->getASTContext ());
692
692
return SS.str ();
693
693
}
Original file line number Diff line number Diff line change @@ -29,3 +29,8 @@ class Methods {
29
29
30
30
static int SimpleStaticMethod (int );
31
31
};
32
+
33
+ class Methods2 {
34
+ public:
35
+ int SimpleMethod (int );
36
+ };
Original file line number Diff line number Diff line change @@ -50,3 +50,12 @@ func basicMethodsConst(a: UnsafeMutablePointer<Methods>) -> Int32 {
50
50
func basicMethodsStatic( ) -> Int32 {
51
51
return Methods . SimpleStaticMethod ( 5 )
52
52
}
53
+
54
+ // CHECK-LABEL: define hidden swiftcc i32 @"$s6cxx_ir12basicMethods1as5Int32VSpySo8Methods2VG_tF"(i8*)
55
+ // CHECK: [[THIS_PTR1:%.*]] = bitcast i8* %0 to %TSo8Methods2V*
56
+ // CHECK: [[THIS_PTR2:%.*]] = bitcast %TSo8Methods2V* [[THIS_PTR1]] to %class.Methods2*
57
+ // CHECK: [[RESULT:%.*]] = call i32 @{{_ZN8Methods212SimpleMethodEi|"\?SimpleMethod@Methods2@@QEAAHH@Z"}}(%class.Methods2* [[THIS_PTR2]], i32 4)
58
+ // CHECK: ret i32 [[RESULT]]
59
+ func basicMethods( a: UnsafeMutablePointer < Methods2 > ) -> Int32 {
60
+ return a. pointee. SimpleMethod ( 4 )
61
+ }
You can’t perform that action at this time.
0 commit comments