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(
148
148
// Use import name here so builtin types such as "int" map to their
149
149
// Swift equivalent ("CInt").
150
150
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
+ }
153
156
return ;
154
157
} else if (arg.getKind () == clang::TemplateArgument::Integral) {
155
158
buffer << " _" ;
Original file line number Diff line number Diff line change @@ -7,9 +7,23 @@ struct MagicWrapper {
7
7
int getValuePlusArg (int arg) const { return t + arg; }
8
8
};
9
9
10
+ template <class M >
11
+ struct DoubleWrapper {
12
+ M m;
13
+ int getValuePlusArg (int arg) const { return m.getValuePlusArg (arg); }
14
+ };
15
+
10
16
typedef MagicWrapper<int > WrappedMagicInt;
17
+ typedef MagicWrapper<const int > WrappedMagicIntConst;
18
+ typedef MagicWrapper<const long > WrappedMagicLongConst;
11
19
typedef MagicWrapper<int *> WrappedMagicIntPtr;
12
20
typedef MagicWrapper<const int *> WrappedMagicIntConstPtr;
13
21
typedef MagicWrapper<int **> WrappedMagicIntPtrPtr;
14
22
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
+
15
29
#endif // TEST_INTEROP_CXX_TEMPLATES_INPUTS_CLASS_TEMPLATE_WITH_PRIMITIVE_ARGUMENT_H
Original file line number Diff line number Diff line change 4
4
// CHECK: struct MagicWrapper<T> {
5
5
// CHECK: }
6
6
7
+ // CHECK: struct DoubleWrapper<M> {
8
+ // CHECK: }
9
+
7
10
// CHECK: typealias WrappedMagicInt = MagicWrapper<CInt>
11
+ // CHECK: typealias WrappedMagicIntConst = MagicWrapper<CInt_const>
12
+ // CHECK: typealias WrappedMagicLongConst = MagicWrapper<CLong_const>
8
13
// CHECK: typealias WrappedMagicIntPtr = MagicWrapper<UnsafeMutablePointer<CInt>>
9
14
// CHECK: typealias WrappedMagicIntConstPtr = MagicWrapper<UnsafePointer<CInt>>
10
15
// 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