File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
test/Interop/Cxx/templates Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,11 @@ std::string swift::importer::printClassTemplateSpecializationName(
148148 // Use import name here so builtin types such as "int" map to their
149149 // Swift equivalent ("CInt").
150150 if (arg.getKind () == clang::TemplateArgument::Type) {
151- auto ty = arg.getAsType ().getTypePtr ();
152- buffer << templateNamePrinter.Visit (ty);
151+ auto ty = arg.getAsType ();
152+ buffer << templateNamePrinter.Visit (ty.getTypePtr ());
153+ if (ty.isConstQualified ()) {
154+ buffer << " _const" ;
155+ }
153156 return ;
154157 } else if (arg.getKind () == clang::TemplateArgument::Integral) {
155158 buffer << " _" ;
Original file line number Diff line number Diff line change @@ -7,9 +7,23 @@ struct MagicWrapper {
77 int getValuePlusArg (int arg) const { return t + arg; }
88};
99
10+ template <class M >
11+ struct DoubleWrapper {
12+ M m;
13+ int getValuePlusArg (int arg) const { return m.getValuePlusArg (arg); }
14+ };
15+
1016typedef MagicWrapper<int > WrappedMagicInt;
17+ typedef MagicWrapper<const int > WrappedMagicIntConst;
18+ typedef MagicWrapper<const long > WrappedMagicLongConst;
1119typedef MagicWrapper<int *> WrappedMagicIntPtr;
1220typedef MagicWrapper<const int *> WrappedMagicIntConstPtr;
1321typedef MagicWrapper<int **> WrappedMagicIntPtrPtr;
1422
23+ typedef DoubleWrapper<MagicWrapper<int >> DoubleWrappedInt;
24+ typedef DoubleWrapper<MagicWrapper<const int >> DoubleWrappedIntConst;
25+ typedef DoubleWrapper<MagicWrapper<const long >> DoubleWrappedLongConst;
26+ typedef DoubleWrapper<MagicWrapper<int *>> DoubleWrappedIntPtr;
27+ typedef DoubleWrapper<MagicWrapper<const int *>> DoubleWrappedIntConstPtr;
28+
1529#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_WITH_PRIMITIVE_ARGUMENT_H
Original file line number Diff line number Diff line change 44// CHECK: struct MagicWrapper<T> {
55// CHECK: }
66
7+ // CHECK: struct DoubleWrapper<M> {
8+ // CHECK: }
9+
710// CHECK: typealias WrappedMagicInt = MagicWrapper<CInt>
11+ // CHECK: typealias WrappedMagicIntConst = MagicWrapper<CInt_const>
12+ // CHECK: typealias WrappedMagicLongConst = MagicWrapper<CLong_const>
813// CHECK: typealias WrappedMagicIntPtr = MagicWrapper<UnsafeMutablePointer<CInt>>
914// CHECK: typealias WrappedMagicIntConstPtr = MagicWrapper<UnsafePointer<CInt>>
1015// CHECK: typealias WrappedMagicIntPtrPtr = MagicWrapper<UnsafeMutablePointer<UnsafeMutablePointer<CInt>>>
16+
17+ // CHECK: typealias DoubleWrappedInt = DoubleWrapper<MagicWrapper<CInt>>
18+ // CHECK: typealias DoubleWrappedIntConst = DoubleWrapper<MagicWrapper<CInt_const>>
19+ // CHECK: typealias DoubleWrappedLongConst = DoubleWrapper<MagicWrapper<CLong_const>>
20+ // CHECK: typealias DoubleWrappedIntPtr = DoubleWrapper<MagicWrapper<UnsafeMutablePointer<CInt>>>
21+ // CHECK: typealias DoubleWrappedIntConstPtr = DoubleWrapper<MagicWrapper<UnsafePointer<CInt>>>
You can’t perform that action at this time.
0 commit comments