Mercurial > projects > ldc
view lphobos/std/array.d @ 1506:76936858d1c6
Return `void*` from _d_allocclass so LLVM doesn't do weird things with it...
This allows `-instcombine` followed by `-gvn` to do devirtualization, so add
`-gvn` in strategic places in the default pass order.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sat, 20 Jun 2009 11:39:13 +0200 |
parents | fd32135dca3e |
children |
line wrap: on
line source
module std.array; private import std.c.stdio; class ArrayBoundsError : Error { private: uint linnum; char[] filename; public: this(char[] filename, uint linnum) { this.linnum = linnum; this.filename = filename; char[] buffer = new char[19 + filename.length + linnum.sizeof * 3 + 1]; int len; len = sprintf(buffer.ptr, "ArrayBoundsError %.*s(%u)", filename, linnum); super(buffer[0..len]); } } /******************************************** * Called by the compiler generated module assert function. * Builds an ArrayBoundsError exception and throws it. */ extern (C) static void _d_array_bounds(char[] filename, uint line) { //printf("_d_assert(%s, %d)\n", (char *)filename, line); ArrayBoundsError a = new ArrayBoundsError(filename, line); //printf("assertion %p created\n", a); throw a; }