Mercurial > projects > ldc
annotate dmd/dump.c @ 1112:829ac3f30103
Updating revisions.pl.in:
- Change the way the LLVM SVN revision is detected, using `svn info` instead
of `svnversion`. This speeds it up significantly on my machine (especially
when the LLVM SVN checkout isn't in disk cache).
- Add "last changed date" to SVN checkouts too, not just unpacked tarballs
- No longer rely on SVN revision to detect release vs trunk checkouts, treat
release checkout the same as unpacked release tarball. (Except for date
determination, which uses SVN date instead of filesystem date)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 13 Mar 2009 16:18:01 +0100 |
parents | 661384d6a936 |
children | eeb8b95ea92e |
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); | |
794
661384d6a936
Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents:
305
diff
changeset
|
55 printf("%p %lld type=%s\n", this, (long long)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 |