Mercurial > projects > ldc
comparison dmd/mangle.c @ 1103:b30fe7e1dbb9
- Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 12 Mar 2009 20:37:27 +0100 |
parents | 55f6c2e454d7 |
children | eeb8b95ea92e |
comparison
equal
deleted
inserted
replaced
1102:ae950bd712d3 | 1103:b30fe7e1dbb9 |
---|---|
21 #include "mtype.h" | 21 #include "mtype.h" |
22 #include "attrib.h" | 22 #include "attrib.h" |
23 #include "template.h" | 23 #include "template.h" |
24 #include "id.h" | 24 #include "id.h" |
25 #include "module.h" | 25 #include "module.h" |
26 | |
27 #if TARGET_LINUX || TARGET_OSX | |
28 char *cpp_mangle(Dsymbol *s); | |
29 #endif | |
26 | 30 |
27 char *mangle(Declaration *sthis) | 31 char *mangle(Declaration *sthis) |
28 { | 32 { |
29 OutBuffer buf; | 33 OutBuffer buf; |
30 char *id; | 34 char *id; |
108 case LINKintrinsic: | 112 case LINKintrinsic: |
109 | 113 |
110 case LINKc: | 114 case LINKc: |
111 case LINKwindows: | 115 case LINKwindows: |
112 case LINKpascal: | 116 case LINKpascal: |
117 return ident->toChars(); | |
118 | |
113 case LINKcpp: | 119 case LINKcpp: |
120 #if V2 && (TARGET_LINUX || TARGET_OSX) | |
121 return cpp_mangle(this); | |
122 #else | |
123 // Windows C++ mangling is done by C++ back end | |
114 return ident->toChars(); | 124 return ident->toChars(); |
125 #endif | |
115 | 126 |
116 case LINKdefault: | 127 case LINKdefault: |
117 error("forward declaration"); | 128 error("forward declaration"); |
118 return ident->toChars(); | 129 return ident->toChars(); |
119 | 130 |
140 } | 151 } |
141 __body | 152 __body |
142 #endif | 153 #endif |
143 { | 154 { |
144 if (isMain()) | 155 if (isMain()) |
145 return "_Dmain"; | 156 return (char *)"_Dmain"; |
146 | 157 |
147 if (isWinMain() || isDllMain()) | 158 if (isWinMain() || isDllMain()) |
148 return ident->toChars(); | 159 return ident->toChars(); |
149 | 160 |
150 assert(this); | 161 assert(this); |
214 char *p = tempdecl->parent->mangle(); | 225 char *p = tempdecl->parent->mangle(); |
215 if (p[0] == '_' && p[1] == 'D') | 226 if (p[0] == '_' && p[1] == 'D') |
216 p += 2; | 227 p += 2; |
217 buf.writestring(p); | 228 buf.writestring(p); |
218 } | 229 } |
219 buf.printf("%"PRIuSIZE"%s", strlen(id), id); | 230 buf.printf("%zu%s", strlen(id), id); |
220 id = buf.toChars(); | 231 id = buf.toChars(); |
221 buf.data = NULL; | 232 buf.data = NULL; |
222 //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); | 233 //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); |
223 return id; | 234 return id; |
224 } | 235 } |
241 char *p = parent->mangle(); | 252 char *p = parent->mangle(); |
242 if (p[0] == '_' && p[1] == 'D') | 253 if (p[0] == '_' && p[1] == 'D') |
243 p += 2; | 254 p += 2; |
244 buf.writestring(p); | 255 buf.writestring(p); |
245 } | 256 } |
246 buf.printf("%"PRIuSIZE"%s", strlen(id), id); | 257 buf.printf("%zu%s", strlen(id), id); |
247 id = buf.toChars(); | 258 id = buf.toChars(); |
248 buf.data = NULL; | 259 buf.data = NULL; |
249 //printf("TemplateMixin::mangle() %s = %s\n", toChars(), id); | 260 //printf("TemplateMixin::mangle() %s = %s\n", toChars(), id); |
250 return id; | 261 return id; |
251 } | 262 } |
267 char *p = parent->mangle(); | 278 char *p = parent->mangle(); |
268 if (p[0] == '_' && p[1] == 'D') | 279 if (p[0] == '_' && p[1] == 'D') |
269 p += 2; | 280 p += 2; |
270 buf.writestring(p); | 281 buf.writestring(p); |
271 } | 282 } |
272 buf.printf("%"PRIuSIZE"%s", strlen(id), id); | 283 buf.printf("%zu%s", strlen(id), id); |
273 id = buf.toChars(); | 284 id = buf.toChars(); |
274 buf.data = NULL; | 285 buf.data = NULL; |
275 //printf("Dsymbol::mangle() %s = %s\n", toChars(), id); | 286 //printf("Dsymbol::mangle() %s = %s\n", toChars(), id); |
276 return id; | 287 return id; |
277 } | 288 } |