Mercurial > projects > ldc
annotate lphobos/typeinfo2/ti_C.d @ 1605:1d5721f9ae18
[WIP] Merge DMD r251: bugzilla 111 (appending a dchar to a char[])
This patch needs some work in the code generation, because of the runtime
changes (functions "_d_arrayappendcd" and "_d_arrayappendwd" are added).
This doesn't affect existing code though, it just makes with patch
a little useless, because something like this:
char [] s;
s ~= '\u6211';
That failed to compile with a nice error message previously to this
change, now fails with and ugly error message (a failed assertion).
Apparently there is a regression introduced by this patch too, when
compiling Dil I get this assertion message:
ldc: /home/luca/tesis/ldc/gen/statements.cpp:132: virtual void ReturnStatement::toIR(IRState*): Assertion `p->topfunc()->getReturnType() == llvm::Type::getVoidTy(gIR->context())' failed.
0 ldc 0x08a91628
Thank god we have bisecting capabilities in VCSs now ;)
---
dmd/expression.c | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:19 -0300 |
parents | 79c9ac745fbc |
children |
rev | line source |
---|---|
106 | 1 /* |
2 * Copyright (C) 2004-2005 by Digital Mars, www.digitalmars.com | |
3 * Written by Walter Bright | |
4 * | |
5 * This software is provided 'as-is', without any express or implied | |
6 * warranty. In no event will the authors be held liable for any damages | |
7 * arising from the use of this software. | |
8 * | |
9 * Permission is granted to anyone to use this software for any purpose, | |
10 * including commercial applications, and to alter it and redistribute it | |
11 * freely, in both source and binary form, subject to the following | |
12 * restrictions: | |
13 * | |
14 * o The origin of this software must not be misrepresented; you must not | |
15 * claim that you wrote the original software. If you use this software | |
16 * in a product, an acknowledgment in the product documentation would be | |
17 * appreciated but is not required. | |
18 * o Altered source versions must be plainly marked as such, and must not | |
19 * be misrepresented as being the original software. | |
20 * o This notice may not be removed or altered from any source | |
21 * distribution. | |
22 */ | |
23 | |
119
79c9ac745fbc
[svn r123] Fixed some typeinfo module name mismatches.
lindquist
parents:
106
diff
changeset
|
24 module typeinfo2.ti_C; |
106 | 25 |
26 // Object | |
27 | |
28 class TypeInfo_C : TypeInfo | |
29 { | |
30 hash_t getHash(void *p) | |
31 { | |
32 Object o = *cast(Object*)p; | |
33 assert(o); | |
34 return o.toHash(); | |
35 } | |
36 | |
37 int equals(void *p1, void *p2) | |
38 { | |
39 Object o1 = *cast(Object*)p1; | |
40 Object o2 = *cast(Object*)p2; | |
41 | |
42 return o1 == o2; | |
43 } | |
44 | |
45 int compare(void *p1, void *p2) | |
46 { | |
47 Object o1 = *cast(Object*)p1; | |
48 Object o2 = *cast(Object*)p2; | |
49 int c = 0; | |
50 | |
51 // Regard null references as always being "less than" | |
52 if (!(o1 is o2)) | |
53 { | |
54 if (o1) | |
55 { if (!o2) | |
56 c = 1; | |
57 else | |
58 c = o1.opCmp(o2); | |
59 } | |
60 else | |
61 c = -1; | |
62 } | |
63 return c; | |
64 } | |
65 | |
66 size_t tsize() | |
67 { | |
68 return Object.sizeof; | |
69 } | |
70 | |
71 uint flags() | |
72 { | |
73 return 1; | |
74 } | |
75 } | |
76 |