Issue 1427 - Generated .di files look ugly and are hard to read #538

merged 1 commit into from Nov 20, 2012


None yet

4 participants

9rnsr commented Nov 27, 2011

Use hard tab '\t' for indentation.


I'm working on bringing the DI generation output up to community expectations. Can this be merged? I'd hate to duplicate work.


I did some more more work on this and I can verify that under DMD on Windows when calling the void OutBuffer::write(const void *data, unsigned nbytes) function that DMD throws an Out of Memory exception while compiling Phobos. Also I added a bunch more buf->level changes in addition to what Kenji put in.

My guess is that given the size of Phobos, the number of memory reallocations this code produces that something went wrong somewhere. I removed the second reallocation from this function and everything seems to work as expected.

Note: This is under Windows x64.

The new function is as follows:

void OutBuffer::write(const void *data, unsigned nbytes)
char t = '\t';
reserve(nbytes + level);
if (doindent && linehead)
if (level)
for (size_t i=0; i<level; i++)
memcpy(this->data + offset, &t, sizeof(t));
linehead = 0;
memcpy(this->data + offset, data, nbytes);
offset += nbytes;


LGTM. Please let's review this and merge it in. @LightBender, how does it (a|e)ffect your work?


@andralex I actually used parts of this merge in my pull. So I will have to re-merge it and fix the errors that crop-up... But this one does not affect output beyond formatting. Also, I have been unable to locate the cause of the phobos test failure in my pull either...

@WalterBright WalterBright merged commit 0c93ce2 into dlang:master Nov 20, 2012

1 check was pending

Details default Pending: 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment