Permalink
Browse files

Convert x.classinfo to typeid(x)

  • Loading branch information...
1 parent 560e2c1 commit 2605232c8d11c77f9fa8d7dec74ad6398155c6e8 @yebblies yebblies committed Nov 18, 2013
Showing with 35 additions and 35 deletions.
  1. +2 −2 src/core/demangle.d
  2. +3 −3 src/core/exception.d
  3. +2 −2 src/core/sys/windows/stacktrace.d
  4. +1 −1 src/core/thread.d
  5. +1 −1 src/gc/gc.d
  6. +1 −1 src/gc/proxy.d
  7. +4 −4 src/object_.d
  8. +3 −3 src/rt/aaA.d
  9. +3 −3 src/rt/cast_.d
  10. +1 −1 src/rt/deh.d
  11. +1 −1 src/rt/deh_win32.d
  12. +1 −1 src/rt/invariant.d
  13. +12 −12 src/rt/lifetime.d
View
@@ -92,7 +92,7 @@ private struct Demangle
//throw new ParseException( msg );
debug(info) printf( "error: %.*s\n", cast(int) msg.length, msg.ptr );
throw __ctfe ? new ParseException(msg)
- : cast(ParseException) cast(void*) ParseException.classinfo.init;
+ : cast(ParseException) cast(void*) typeid(ParseException).init;
}
@@ -101,7 +101,7 @@ private struct Demangle
{
//throw new OverflowException( msg );
debug(info) printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );
- throw cast(OverflowException) cast(void*) OverflowException.classinfo.init;
+ throw cast(OverflowException) cast(void*) typeid(OverflowException).init;
}
View
@@ -498,7 +498,7 @@ extern (C) void onFinalizeError( ClassInfo info, Exception e, string file = __FI
*/
extern (C) void onHiddenFuncError( Object o ) @safe pure nothrow
{
- throw new HiddenFuncError( o.classinfo );
+ throw new HiddenFuncError( typeid(o) );
}
@@ -513,7 +513,7 @@ extern (C) void onOutOfMemoryError() @trusted pure nothrow
{
// NOTE: Since an out of memory condition exists, no allocation must occur
// while generating this object.
- throw cast(OutOfMemoryError) cast(void*) OutOfMemoryError.classinfo.init;
+ throw cast(OutOfMemoryError) cast(void*) typeid(OutOfMemoryError).init;
}
@@ -529,7 +529,7 @@ extern (C) void onInvalidMemoryOperationError() @trusted pure nothrow
// The same restriction applies as for onOutOfMemoryError. The GC is in an
// undefined state, thus no allocation must occur while generating this object.
throw cast(InvalidMemoryOperationError)
- cast(void*) InvalidMemoryOperationError.classinfo.init;
+ cast(void*) typeid(InvalidMemoryOperationError).init;
}
@@ -111,7 +111,7 @@ public:
*/
static ulong[] trace(size_t skip = 0, CONTEXT* context = null)
{
- synchronized( StackTrace.classinfo )
+ synchronized( typeid(StackTrace) )
{
return traceNoSync(skip, context);
}
@@ -126,7 +126,7 @@ public:
*/
static char[][] resolve(const(ulong)[] addresses)
{
- synchronized( StackTrace.classinfo )
+ synchronized( typeid(StackTrace) )
{
return resolveNoSync(addresses);
}
View
@@ -1424,7 +1424,7 @@ private:
{
foreach (ref lock; _locks)
{
- lock[] = Mutex.classinfo.init[];
+ lock[] = typeid(Mutex).init[];
(cast(Mutex)lock.ptr).__ctor();
}
}
View
@@ -246,7 +246,7 @@ class GC
void initialize()
{
- mutexStorage[] = GCMutex.classinfo.init[];
+ mutexStorage[] = typeid(GCMutex).init[];
gcLock = cast(GCMutex) mutexStorage.ptr;
gcLock.__ctor();
gcx = cast(Gcx*)cstdlib.calloc(1, Gcx.sizeof);
View
@@ -107,7 +107,7 @@ extern (C)
{
version (GCCLASS)
{ void* p;
- ClassInfo ci = GC.classinfo;
+ ClassInfo ci = typeid(GC);
p = malloc(ci.init.length);
(cast(byte*)p)[0 .. ci.init.length] = ci.init[];
View
@@ -78,7 +78,7 @@ class Object
*/
string toString()
{
- return this.classinfo.name;
+ return typeid(this).name;
}
/**
@@ -104,7 +104,7 @@ class Object
// BUG: this prevents a compacting GC from working, needs to be fixed
//return cast(int)cast(void*)this - cast(int)cast(void*)o;
- throw new Exception("need opCmp for class " ~ this.classinfo.name);
+ throw new Exception("need opCmp for class " ~ typeid(this).name);
//return this !is o;
}
@@ -900,7 +900,7 @@ class TypeInfo_Interface : TypeInfo
if (this is o)
return true;
auto c = cast(const TypeInfo_Interface)o;
- return c && this.info.name == c.classinfo.name;
+ return c && this.info.name == typeid(c).name;
}
override size_t getHash(in void* p) @trusted const
@@ -1364,7 +1364,7 @@ class Throwable : Object
{
SizeStringBuff tmpBuff = void;
- sink(this.classinfo.name);
+ sink(typeid(this).name);
if (file)
{
sink("@"); sink(file);
View
@@ -570,7 +570,7 @@ Impl* _d_assocarrayliteralTX(const TypeInfo_AssociativeArray ti, void[] keys, vo
Impl* result;
//printf("_d_assocarrayliteralT(keysize = %d, valuesize = %d, length = %d)\n", keysize, valuesize, length);
- //printf("tivalue = %.*s\n", ti.next.classinfo.name);
+ //printf("tivalue = %.*s\n", typeid(ti.next).name);
assert(length == values.length);
if (length == 0 || valuesize == 0 || keysize == 0)
{
@@ -666,8 +666,8 @@ const(TypeInfo_AssociativeArray) _aaUnwrapTypeInfo(const(TypeInfo) tiRaw) pure n
int _aaEqual(in TypeInfo tiRaw, in AA e1, in AA e2)
{
//printf("_aaEqual()\n");
- //printf("keyti = %.*s\n", ti.key.classinfo.name);
- //printf("valueti = %.*s\n", ti.next.classinfo.name);
+ //printf("keyti = %.*s\n", typeid(ti.key).name);
+ //printf("valueti = %.*s\n", typeid(ti.next).name);
if (e1.impl is e2.impl)
return 1;
View
@@ -29,7 +29,7 @@ Object _d_toObject(void* p)
return null;
Object o = cast(Object) p;
- ClassInfo oc = o.classinfo;
+ ClassInfo oc = typeid(o);
Interface* pi = **cast(Interface***) p;
/* Interface.offset lines up with ClassInfo.name.ptr,
@@ -68,7 +68,7 @@ void* _d_dynamic_cast(Object o, ClassInfo c)
void* res = null;
size_t offset = 0;
- if(o && _d_isbaseof2(o.classinfo, c, offset))
+ if(o && _d_isbaseof2(typeid(o), c, offset))
{
debug(cast_) printf("\toffset = %d\n", offset);
res = cast(void*) o + offset;
@@ -143,7 +143,7 @@ void* _d_interface_vtbl(ClassInfo ic, Object o)
assert(o);
- foreach(iface; o.classinfo.interfaces)
+ foreach(iface; typeid(o).interfaces)
if(iface.classinfo is ic)
return cast(void*) iface.vtbl;
View
@@ -19,7 +19,7 @@ extern (C)
auto t = cast(Throwable) o;
if (t !is null && t.info is null &&
- cast(byte*) t !is t.classinfo.init.ptr)
+ cast(byte*) t !is typeid(t).init.ptr)
{
t.info = _d_traceContext(context);
}
View
@@ -468,7 +468,7 @@ EXCEPTION_DISPOSITION _d_framehandler(
masterClassInfo = ci;
break;
}
- if (_d_isbaseof(ci, Error.classinfo))
+ if (_d_isbaseof(ci, typeid(Error)))
{ // It's derived from Error. This _may_ be the master.
master = er;
masterClassInfo = ci;
View
@@ -24,7 +24,7 @@ void _d_invariant(Object o)
// BUG: needs to be filename/line of caller, not library routine
assert(o !is null); // just do null check, not invariant check
- c = o.classinfo;
+ c = typeid(o);
do
{
if (c.classInvariant)
View
@@ -617,7 +617,7 @@ in
body
{
// step 1, get the block
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
auto bic = !isshared ? __getBlkInfo((*p).ptr) : null;
auto info = bic ? *bic : gc_query((*p).ptr);
auto size = ti.next.tsize;
@@ -822,7 +822,7 @@ extern (C) void[] _d_newarrayT(const TypeInfo ti, size_t length)
// update the length of the array
auto arrstart = __arrayStart(info);
memset(arrstart, 0, size);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, size, isshared);
result = arrstart[0..length];
}
@@ -900,7 +900,7 @@ extern (C) void[] _d_newarrayiT(const TypeInfo ti, size_t length)
memcpy(arrstart + u, q, isize);
}
}
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, size, isshared);
result = arrstart[0..length];
}
@@ -937,7 +937,7 @@ void[] _d_newarrayOpT(alias op)(const TypeInfo ti, size_t ndims, va_list q)
{
auto allocsize = (void[]).sizeof * dim;
auto info = gc_qalloc(allocsize + __arrayPad(allocsize));
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, allocsize, isshared);
auto p = __arrayStart(info)[0 .. dim];
@@ -1339,7 +1339,7 @@ body
debug(PRINTF) printf("newsize = %x, newlength = %x\n", newsize, newlength);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
if ((*p).ptr)
{
@@ -1519,7 +1519,7 @@ body
size_t size = (*p).length * sizeelem;
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
if ((*p).ptr)
{
newdata = (*p).ptr;
@@ -1799,7 +1799,7 @@ byte[] _d_arrayappendcTX(const TypeInfo ti, ref byte[] px, size_t n)
// only optimize array append where ti is not a shared type
auto sizeelem = ti.next.tsize; // array element size
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
auto bic = !isshared ? __getBlkInfo(px.ptr) : null;
auto info = bic ? *bic : gc_query(px.ptr);
auto length = px.length;
@@ -2025,7 +2025,7 @@ body
// do postblit processing
__doPostblit(p, xlen + ylen, ti.next);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, len, isshared);
return p[0 .. x.length + y.length];
}
@@ -2077,7 +2077,7 @@ extern (C) void[] _d_arraycatnT(const TypeInfo ti, uint n, ...)
auto allocsize = length * size;
auto info = gc_qalloc(allocsize + __arrayPad(allocsize), !(ti.next.flags & 1) ? BlkAttr.NO_SCAN | BlkAttr.APPENDABLE : BlkAttr.APPENDABLE);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, allocsize, isshared);
void *a = __arrayStart (info);
@@ -2151,7 +2151,7 @@ void* _d_arrayliteralTX(const TypeInfo ti, size_t length)
{
auto allocsize = length * sizeelem;
auto info = gc_qalloc(allocsize + __arrayPad(allocsize), !(ti.next.flags & 1) ? BlkAttr.NO_SCAN | BlkAttr.APPENDABLE : BlkAttr.APPENDABLE);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, allocsize, isshared);
result = __arrayStart(info);
}
@@ -2173,7 +2173,7 @@ extern (C) void* _d_arrayliteralT(const TypeInfo ti, size_t length, ...)
{
auto allocsize = length * sizeelem;
auto info = gc_qalloc(allocsize + __arrayPad(allocsize), !(ti.next.flags & 1) ? BlkAttr.NO_SCAN | BlkAttr.APPENDABLE : BlkAttr.APPENDABLE);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, allocsize, isshared);
result = __arrayStart(info);
@@ -2252,7 +2252,7 @@ body
auto sizeelem = ti.next.tsize; // array element size
auto size = a.length * sizeelem;
auto info = gc_qalloc(size + __arrayPad(size), !(ti.next.flags & 1) ? BlkAttr.NO_SCAN | BlkAttr.APPENDABLE : BlkAttr.APPENDABLE);
- auto isshared = ti.classinfo is TypeInfo_Shared.classinfo;
+ auto isshared = typeid(ti) is typeid(TypeInfo_Shared);
__setArrayAllocLength(info, size, isshared);
r.ptr = __arrayStart(info);
r.length = a.length;

0 comments on commit 2605232

Please sign in to comment.