[cfe-commits] r90149 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Tue Dec 1 08:41:44 PST 2009


30 nov 2009 kl. 15.26 skrev Mike Stump:

> On Nov 30, 2009, at 11:43 AM, Anders Carlsson wrote:
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Nov 30 13:43:26 2009
>> @@ -867,8 +867,8 @@
>>  const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
>> 
>>  if (PrimaryBase) {
>> -    assert(PrimaryBase->isCanonicalDecl() && 
>> -           "Should have the canonical decl of the primary base!");
>> +    assert(PrimaryBase->isDefinition() && 
>> +           "Should have the definition decl of the primary base!");
> 
> The mental model I was using was that we are playing with canonical types through this entire file.  The assert was to ensure that was true.  By stepping back to a non-canonical type, I fear we'll just discover much later on we're in the weeds when something went wrong.  I think I'd rather have a switch to the canonical type, or change the primary to be canonical during record layout.

I added that assert a couple of days ago :) While I do agree that it's best to try to work with canonical types and decls, the problem is that a canonical CXXRecordDecl might not have the definition:

class A;

class A { virtual void f(); };

and in this case it's probably best to operate on the definition decls.

Anders




More information about the cfe-commits mailing list