Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 365d638

Browse files
author
Mike Stump
committedJan 7, 2010
Add a descriptive tag to each line to make the exact differences
easier to understand. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92932 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b672707 commit 365d638

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

‎utils/VtableTest/gen.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,24 @@ void gs(int s) {
124124
for (int i = 0; i < n_funcs; ++i) {
125125
int fn = old_func + random() % FUNCSPACING + 1;
126126
funcs[i] = fn;
127-
g(" virtual void fun"); g(fn); g("(char *t) { mix((char *)this - t); mix("); g(++vfn); gl("); }");
127+
g(" virtual void fun"); g(fn); g("(char *t) { mix(\"vfn this offset\", (char *)this - t); mix(\"vfn uuid\", "); g(++vfn); gl("); }");
128128
old_func = fn;
129129
}
130130

131131
gl("public:");
132132
gl(" void calc(char *t) {");
133133

134134
// mix in the type number
135-
g(" mix("); g(s); gl(");");
135+
g(" mix(\"type num\", "); g(s); gl(");");
136136
// mix in the size
137-
g(" mix(sizeof (s"); g(s); gl("));");
137+
g(" mix(\"type size\", sizeof (s"); g(s); gl("));");
138138
// mix in the this offset
139-
gl(" mix((char *)this - t);");
139+
gl(" mix(\"subobject offset\", (char *)this - t);");
140140
if (n_funcs)
141141
polymorphic = true;
142142
if (polymorphic) {
143143
// mix in offset to the complete object under construction
144-
gl(" mix(t - (char *)dynamic_cast<void*>(this));");
144+
gl(" mix(\"real top v current top\", t - (char *)dynamic_cast<void*>(this));");
145145
}
146146

147147
/* check base layout and overrides */
@@ -153,24 +153,24 @@ void gs(int s) {
153153
/* check dynamic_cast to each direct base */
154154
for (int i = 0; i < n_bases; ++i) {
155155
g(" if ((char *)dynamic_cast<s"); g(bases[i]); gl("*>(this))");
156-
g(" mix(t - (char *)dynamic_cast<s"); g(bases[i]); gl("*>(this));");
157-
gl(" else mix(666);");
156+
g(" mix(\"base dyn cast\", t - (char *)dynamic_cast<s"); g(bases[i]); gl("*>(this));");
157+
gl(" else mix(\"no dyncast\", 666);");
158158
}
159159
}
160160

161161
/* check field layout */
162162
for (int i = 0; i < n_fields; ++i) {
163-
g(" mix((char *)&field"); g(i); gl(" - (char *)this);");
163+
g(" mix(\"field offset\", (char *)&field"); g(i); gl(" - (char *)this);");
164164
}
165165
if (n_fields == 0)
166-
gl(" mix(42);");
166+
gl(" mix(\"no fields\", 42);");
167167

168168
/* check functions */
169169
for (int i = 0; i < n_funcs; ++i) {
170170
g(" fun"); g(funcs[i]); gl("(t);");
171171
}
172172
if (n_funcs == 0)
173-
gl(" mix(13);");
173+
gl(" mix(\"no funcs\", 13);");
174174

175175
gl(" }");
176176

@@ -204,10 +204,10 @@ main(int argc, char **argv) {
204204
gl("extern \"C\" int printf(const char *...);");
205205
gl("");
206206
gl("long long sum;");
207-
gl("void mix(long long i) {");
207+
gl("void mix(const char *desc, long long i) {");
208208
// If this ever becomes too slow, we can remove this after we improve the
209209
// mixing function
210-
gl(" printf(\"%llx\\n\", i);");
210+
gl(" printf(\"%s: %lld\\n\", desc, i);");
211211
gl(" sum += ((sum ^ i) << 3) + (sum<<1) - i;");
212212
gl("}");
213213
gl("");

0 commit comments

Comments
 (0)