[cfe-dev] [patch]Simplify code

Zhongxing Xu xuzhongxing at gmail.com
Sun Feb 14 19:56:53 PST 2010


Index: lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- lib/AST/RecordLayoutBuilder.cpp	(版本 96163)
+++ lib/AST/RecordLayoutBuilder.cpp	(工作副本)
@@ -119,11 +119,10 @@
         return;
       }
     }
-    if (i->isVirtual()) {
-      SelectPrimaryVBase(Base, FirstPrimary);
-      if (PrimaryBase.getBase())
-        return;
-    }
+    assert(i->isVirtual());
+    SelectPrimaryVBase(Base, FirstPrimary);
+    if (PrimaryBase.getBase())
+      return;
   }
 }

Test passed.

2010/2/15 Anders Carlsson <andersca at mac.com>:
> Hi Zhongxing,
>
> in that case, could you add an assert that i is virtual?
>
> Anders
>
> 14 feb 2010 kl. 19.22 skrev Zhongxing Xu:
>
>> Index: lib/AST/RecordLayoutBuilder.cpp
>> ===================================================================
>> --- lib/AST/RecordLayoutBuilder.cpp   (版本 96163)
>> +++ lib/AST/RecordLayoutBuilder.cpp   (工作副本)
>> @@ -119,11 +119,9 @@
>>         return;
>>       }
>>     }
>> -    if (i->isVirtual()) {
>> -      SelectPrimaryVBase(Base, FirstPrimary);
>> -      if (PrimaryBase.getBase())
>> -        return;
>> -    }
>> +    SelectPrimaryVBase(Base, FirstPrimary);
>> +    if (PrimaryBase.getBase())
>> +      return;
>>   }
>> }
>>
>> If we can reach here, the base is not virtual.
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>




More information about the cfe-dev mailing list