File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -2204,9 +2204,24 @@ static void initGenericClassObjCName(ClassMetadata *theClass) {
22042204
22052205 auto string = Demangle::mangleNodeOld (globalNode);
22062206
2207- auto fullNameBuf = (char *)swift_slowAlloc (string.size () + 1 , 0 );
2207+ // If the class is in the Swift module, add a $ to the end of the ObjC
2208+ // name. The old and new Swift libraries must be able to coexist in
2209+ // the same process, and this avoids warnings due to the ObjC names
2210+ // colliding.
2211+ bool addSuffix = strncmp (string.c_str (), " _TtGCs" , 6 ) == 0 ;
2212+
2213+ size_t allocationSize = string.size () + 1 ;
2214+ if (addSuffix)
2215+ allocationSize += 1 ;
2216+
2217+ auto fullNameBuf = (char *)swift_slowAlloc (allocationSize, 0 );
22082218 memcpy (fullNameBuf, string.c_str (), string.size () + 1 );
22092219
2220+ if (addSuffix) {
2221+ fullNameBuf[string.size ()] = ' $' ;
2222+ fullNameBuf[string.size () + 1 ] = ' \0 ' ;
2223+ }
2224+
22102225 auto theMetaclass = (ClassMetadata *)object_getClass ((id)theClass);
22112226
22122227 getROData (theClass)->Name = fullNameBuf;
You can’t perform that action at this time.
0 commit comments