<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 30/05/2012 07:06, John McCall wrote:<br>
<blockquote
cite="mid:877F9462-792E-4C28-A0C1-6623A16BA202@apple.com"
type="cite">
<div>Is this the rule used by MSVC? For example, does a vtordisp
still get emitted even if a ctor "obviously" doesn't call any
virtual functions, like if it's defined in the class definition
and obviously empty? Please test both an empty ctor and an
empty dtor.</div>
<div><br>
</div>
</blockquote>
I think MSVC doesn`t analyze ctor or dtor body. I wrote next test
cases:<br>
1. No vtordisp.<br>
<blockquote>class first {<br>
public:<br>
virtual void asdf(){}<br>
};<br>
class second : public virtual first{<br>
public :<br>
virtual void asdf(){}<br>
};<br>
</blockquote>
2. Vtordisp.<br>
<blockquote>class first {<br>
public:<br>
virtual void asdf(){}<br>
};<br>
class second : public virtual first{<br>
public :<br>
virtual void asdf(){}<br>
~second(){}<br>
};<br>
</blockquote>
3. Vtordisp.<br>
<blockquote>class first {<br>
public:<br>
virtual void asdf(){}<br>
};<br>
class second : public virtual first{<br>
public :<br>
virtual void asdf(){}<br>
second(){}<br>
};<br>
</blockquote>
<blockquote
cite="mid:877F9462-792E-4C28-A0C1-6623A16BA202@apple.com"
type="cite">
<div>Please also add testcases verifying that we do the right
thing in further-derived classes that provide ctors. For
example:</div>
<div> struct A { virtual void foo(); };</div>
<div> struct B : virtual A { virtual void foo(); }; // no
vtordisp</div>
<div> struct Test1 : B { Test1(); };</div>
<div> struct Test2 : virtual B { Test2(); };</div>
<div> struct Test3 : B { Test3(); virtual void foo(); };</div>
<div> struct Test4 : virtual B { Test4(); virtual void foo(); };</div>
<br>
</blockquote>
Test3 and Test4 have vtordisps for virtual base A. At now clang(with
my patch, I test this on my working copy) add vtordisp only in Test4
for B, not for A.<br>
I add new patch. Problem was in
undecidedVBases.erase(overriddenBase). In Test3 overriddenBase == B
but undecidedVBases contains A.<br>
Also I test<br>
<blockquote> struct A { virtual void foo(); };<br>
struct B : A { virtual void foo(); };<br>
struct Test1 : B { Test1(); };<br>
struct Test2 : virtual B { Test2(); };<br>
struct Test3 : B { Test3(); virtual void foo(); };<br>
struct Test4 : virtual B { Test4(); virtual void foo(); };<br>
</blockquote>
Only Test4 has vtordisp for B same as MSVC.<br>
<br>
- Dmitry Sokolov.<br>
<br>
</body>
</html>