Mercurial > projects > ldc
annotate dmd/dump.c @ 715:30b42a283c8e
Removed TypeOpaque from DMD.
Changed runtime functions taking opaque[] to void[].
Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[].
Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86.
Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing.
Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way...
Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8.
Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:55:33 +0200 |
parents | 2b72433d5c8c |
children | 661384d6a936 |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2006 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #include <stdio.h> | |
12 #include <ctype.h> | |
13 #include <assert.h> | |
14 | |
15 #include "mars.h" | |
16 #include "mtype.h" | |
17 #include "declaration.h" | |
18 #include "expression.h" | |
19 #include "template.h" | |
20 | |
21 static void indent(int indent) | |
22 { | |
23 int i; | |
24 | |
25 for (i = 0; i < indent; i++) | |
26 printf(" "); | |
27 } | |
28 | |
29 static char *type_print(Type *type) | |
30 { | |
31 return type ? type->toChars() : (char *) "null"; | |
32 } | |
33 | |
34 void dumpExpressions(int i, Expressions *exps) | |
35 { | |
36 for (size_t j = 0; j < exps->dim; j++) | |
37 { Expression *e = (Expression *)exps->data[j]; | |
38 indent(i); | |
39 printf("(\n"); | |
40 e->dump(i + 2); | |
41 indent(i); | |
42 printf(")\n"); | |
43 } | |
44 } | |
45 | |
46 void Expression::dump(int i) | |
47 { | |
48 indent(i); | |
49 printf("%p %s type=%s\n", this, Token::toChars(op), type_print(type)); | |
50 } | |
51 | |
52 void IntegerExp::dump(int i) | |
53 { | |
54 indent(i); | |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
1
diff
changeset
|
55 printf("%p %lld type=%s\n", this, (intmax_t)value, type_print(type)); |
1 | 56 } |
57 | |
58 void IdentifierExp::dump(int i) | |
59 { | |
60 indent(i); | |
61 printf("%p ident '%s' type=%s\n", this, ident->toChars(), type_print(type)); | |
62 } | |
63 | |
64 void DsymbolExp::dump(int i) | |
65 { | |
66 indent(i); | |
67 printf("%p %s type=%s\n", this, s->toChars(), type_print(type)); | |
68 } | |
69 | |
70 void VarExp::dump(int i) | |
71 { | |
72 indent(i); | |
73 printf("%p %s var=%s type=%s\n", this, Token::toChars(op), var->toChars(), type_print(type)); | |
74 } | |
75 | |
76 void UnaExp::dump(int i) | |
77 { | |
78 indent(i); | |
79 printf("%p %s type=%s e1=%p\n", this, Token::toChars(op), type_print(type), e1); | |
80 if (e1) | |
81 e1->dump(i + 2); | |
82 } | |
83 | |
84 void CallExp::dump(int i) | |
85 { | |
86 UnaExp::dump(i); | |
87 dumpExpressions(i, arguments); | |
88 } | |
89 | |
90 void SliceExp::dump(int i) | |
91 { | |
92 indent(i); | |
93 printf("%p %s type=%s e1=%p\n", this, Token::toChars(op), type_print(type), e1); | |
94 if (e1) | |
95 e1->dump(i + 2); | |
96 if (lwr) | |
97 lwr->dump(i + 2); | |
98 if (upr) | |
99 upr->dump(i + 2); | |
100 } | |
101 | |
102 void DotIdExp::dump(int i) | |
103 { | |
104 indent(i); | |
105 printf("%p %s type=%s ident=%s e1=%p\n", this, Token::toChars(op), type_print(type), ident->toChars(), e1); | |
106 if (e1) | |
107 e1->dump(i + 2); | |
108 } | |
109 | |
110 void DotVarExp::dump(int i) | |
111 { | |
112 indent(i); | |
113 printf("%p %s type=%s var='%s' e1=%p\n", this, Token::toChars(op), type_print(type), var->toChars(), e1); | |
114 if (e1) | |
115 e1->dump(i + 2); | |
116 } | |
117 | |
118 void DotTemplateInstanceExp::dump(int i) | |
119 { | |
120 indent(i); | |
121 printf("%p %s type=%s ti='%s' e1=%p\n", this, Token::toChars(op), type_print(type), ti->toChars(), e1); | |
122 if (e1) | |
123 e1->dump(i + 2); | |
124 } | |
125 | |
126 void DelegateExp::dump(int i) | |
127 { | |
128 indent(i); | |
129 printf("%p %s func=%s type=%s e1=%p\n", this, Token::toChars(op), func->toChars(), type_print(type), e1); | |
130 if (e1) | |
131 e1->dump(i + 2); | |
132 } | |
133 | |
134 void BinExp::dump(int i) | |
135 { | |
136 indent(i); | |
137 printf("%p %s type=%s e1=%p e2=%p\n", this, Token::toChars(op), type_print(type), e1, e2); | |
138 if (e1) | |
139 e1->dump(i + 2); | |
140 if (e2) | |
141 e2->dump(i + 2); | |
142 } | |
143 | |
144 |