[patch]Simplify code

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch]Simplify code

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
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [patch]Simplify code

Anders Carlsson
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
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [patch]Simplify code

Zhongxing Xu
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 <[hidden email]>:

> 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
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev