Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit e390ba7

Browse files
Geod24dlang-bot
authored andcommitted
Replace usages of classinfo with typeid
See dlang/dmd#11033
1 parent 84a1ada commit e390ba7

File tree

8 files changed

+24
-23
lines changed

8 files changed

+24
-23
lines changed

benchmark/gcbench/vdparser.extra/vdc/ast/node.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class NodeAllocData
7474
for(byte* p = beg; p < end && *cast(size_t*)p != 0; p += sz)
7575
{
7676
Node n = cast(Node) p;
77-
sz = n.classinfo.init.length;
77+
sz = typeid(n).initializer.length;
7878
sz = (sz + 15) & ~15;
7979
assert(sz > 0);
8080
clear(n); // calls rt_finalize
@@ -223,7 +223,7 @@ class Node
223223

224224
final Node _cloneShallow()
225225
{
226-
Node n = static_cast!Node(this.classinfo.create());
226+
Node n = static_cast!Node(typeid(this).create());
227227

228228
n.id = id;
229229
n.attr = attr;
@@ -244,7 +244,7 @@ class Node
244244

245245
bool compare(const(Node) n) const
246246
{
247-
if(this.classinfo !is n.classinfo)
247+
if (typeid(this) !is typeid(n))
248248
return false;
249249

250250
if(n.id != id || n.attr != attr || n.annotation != annotation)
@@ -307,7 +307,7 @@ class Node
307307
////////////////////////////////////////////////////////////
308308
abstract void toD(CodeWriter writer)
309309
{
310-
writer(this.classinfo.name);
310+
writer(typeid(this).name);
311311
writer.nl();
312312

313313
auto indent = CodeIndenter(writer);

benchmark/gcbench/vdparser.extra/vdc/ast/type.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ class TypeIndirection : Type
753753
return true;
754754

755755
Type nextThis = getNextType();
756-
if(this.classinfo != from.classinfo)
756+
if (typeid(this) != typeid(from))
757757
return false;
758758
auto ifrom = static_cast!TypeIndirection(from);
759759
_assert(ifrom !is null);
@@ -906,7 +906,7 @@ class TypeDynamicArray : TypeIndirection
906906
if(super.convertableFrom(from, flags))
907907
return true;
908908

909-
if(from.classinfo == typeid(TypeStaticArray))
909+
if (typeid(from) is typeid(TypeStaticArray))
910910
{
911911
Type nextThis = getNextType();
912912
auto arrfrom = static_cast!TypeStaticArray(from);

benchmark/gcbench/vdparser.extra/vdc/interpret.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ class Value
229229
version(none)
230230
Value opassign(string op)(Value v)
231231
{
232-
TypeInfo ti1 = this.classinfo;
233-
TypeInfo ti2 = v.classinfo;
232+
TypeInfo ti1 = typeid(this);
233+
TypeInfo ti2 = typeid(v);
234234
foreach(iv1; BasicTypeValues)
235235
{
236236
if(ti1 is typeid(iv1))
@@ -260,8 +260,8 @@ class Value
260260
version(none)
261261
Value opBinOp(string op)(Value v)
262262
{
263-
TypeInfo ti1 = this.classinfo;
264-
TypeInfo ti2 = v.classinfo;
263+
TypeInfo ti1 = typeid(this);
264+
TypeInfo ti2 = typeid(v);
265265
foreach(iv1; BasicTypeValues)
266266
{
267267
if(ti1 is typeid(iv1))
@@ -298,7 +298,7 @@ class Value
298298
version(none)
299299
Value opUnOp(string op)()
300300
{
301-
TypeInfo ti1 = this.classinfo;
301+
TypeInfo ti1 = typeid(this);
302302
foreach(iv1; BasicTypeValues)
303303
{
304304
if(ti1 is typeid(iv1))
@@ -338,7 +338,7 @@ class Value
338338
{
339339
Value binOp(Value v)
340340
{
341-
TypeInfo ti = v.classinfo;
341+
TypeInfo ti = typeid(v);
342342
foreach(iv2; Types)
343343
{
344344
if(ti is typeid(iv2))
@@ -374,7 +374,7 @@ class Value
374374
if(!mutable)
375375
return semanticErrorValue(this, " value is not mutable");
376376

377-
TypeInfo ti = v.classinfo;
377+
TypeInfo ti = typeid(v);
378378
foreach(iv2; Types)
379379
{
380380
if(ti is typeid(iv2))
@@ -610,7 +610,7 @@ class ValueT(T) : Value
610610
if(!mutable) // doCast changes this value
611611
return semanticErrorValue(this, " value is not mutable");
612612

613-
TypeInfo ti = v.classinfo;
613+
TypeInfo ti = typeid(v);
614614
foreach(iv2; RHS_BasicTypeValues)
615615
{
616616
if(ti is typeid(iv2))

benchmark/gcbench/vdparser.extra/vdc/logger.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ version(enableLog) {
8181
if(gLogFile.length == 0)
8282
OutputDebugStringA(toStringz(s));
8383
else
84-
synchronized(logSync.classinfo)
84+
synchronized(typeid(logSync))
8585
{
8686
if(gLogFirst)
8787
{

src/core/internal/gc/impl/conservative/gc.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4571,7 +4571,7 @@ string debugTypeName(const(TypeInfo) ti) nothrow
45714571
else
45724572
return debugTypeName(ci.next);
45734573
else
4574-
name = ti.classinfo.name;
4574+
name = typeid(ti).name;
45754575
return name;
45764576
}
45774577

src/object.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ void setSameMutex(shared Object ownee, shared Object owner)
537537
*/
538538
struct Interface
539539
{
540-
TypeInfo_Class classinfo; /// .classinfo for this interface (not for containing class)
540+
/// Class info returned by `typeid` for this interface (not for containing class)
541+
TypeInfo_Class classinfo;
541542
void*[] vtbl;
542543
size_t offset; /// offset to Interface 'this' from Object 'this'
543544
}
@@ -1542,7 +1543,7 @@ private extern (C) int _d_isbaseof(scope TypeInfo_Class child,
15421543
/**
15431544
* Runtime type information about a class.
15441545
* Can be retrieved from an object instance by using the
1545-
* $(DDSUBLINK spec/property,classinfo, .classinfo) property.
1546+
* $(DDSUBLINK spec/expression,typeid_expressions,typeid expression).
15461547
*/
15471548
class TypeInfo_Class : TypeInfo
15481549
{

src/rt/dmain2.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ extern (C) void _d_print_throwable(Throwable t)
613613
{
614614
WSink caption;
615615
if (t)
616-
caption.sink(t.classinfo.name);
616+
caption.sink(typeid(t).name);
617617

618618
// Avoid static user32.dll dependency for console applications
619619
// by loading it dynamically as needed

src/rt/dwarfeh.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ ClassInfo getClassInfo(_Unwind_Exception* exceptionObject, const(ubyte)* current
576576
{
577577
ExceptionHeader* eh = ExceptionHeader.toExceptionHeader(exceptionObject);
578578
Throwable ehobject = eh.object;
579-
debug (EH_personality) writeln("start: %p '%.*s'", ehobject, cast(int)ehobject.classinfo.info.name.length, ehobject.classinfo.info.name.ptr);
579+
debug (EH_personality) writeln("start: %p '%.*s'", ehobject, cast(int)(typeid(ehobject).info.name.length), ehobject.classinfo.info.name.ptr);
580580
for (ExceptionHeader* ehn = eh.next; ehn; ehn = ehn.next)
581581
{
582582
// like __dmd_personality_v0, don't combine when the exceptions are from different functions
@@ -587,15 +587,15 @@ ClassInfo getClassInfo(_Unwind_Exception* exceptionObject, const(ubyte)* current
587587
break;
588588
}
589589

590-
debug (EH_personality) writeln("ehn = %p '%.*s'", ehn.object, cast(int)ehn.object.classinfo.info.name.length, ehn.object.classinfo.info.name.ptr);
590+
debug (EH_personality) writeln("ehn = %p '%.*s'", ehn.object, cast(int)(typeid(ehn.object).info.name.length), ehn.object.classinfo.info.name.ptr);
591591
Error e = cast(Error)ehobject;
592592
if (e is null || (cast(Error)ehn.object) !is null)
593593
{
594594
ehobject = ehn.object;
595595
}
596596
}
597597
debug (EH_personality) writeln("end : %p", ehobject);
598-
return ehobject.classinfo;
598+
return typeid(ehobject);
599599
}
600600

601601
/******************************
@@ -925,7 +925,7 @@ int actionTableLookup(_Unwind_Exception* exceptionObject, uint actionRecordPtr,
925925
entry = *cast(_Unwind_Ptr*)entry;
926926

927927
ClassInfo ci = cast(ClassInfo)cast(void*)(entry);
928-
if (ci.classinfo is __cpp_type_info_ptr.classinfo)
928+
if (typeid(ci) is typeid(__cpp_type_info_ptr))
929929
{
930930
if (exceptionClass == cppExceptionClass || exceptionClass == cppExceptionClass1)
931931
{

0 commit comments

Comments
 (0)