CXXRecordDecl: bases() vs vbases()

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

CXXRecordDecl: bases() vs vbases()

shirley breuer via cfe-dev
Hello everyone,
While trying to iterate over the base classes of a class/struct represented by a CXXRecordDecl, I found two methods: one is bases() and the other is bases().
Is it that bases() returns all instantiable base classes, while vbases() returns all abstract base classes? Or is it something different?
Warm regards,
Deep

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: CXXRecordDecl: bases() vs vbases()

shirley breuer via cfe-dev
I'd guess 'bases()' probably gives direct base classes and vbases()
probably gives direct virtual base classes, eg:

struct x : y, virtual z { };

probably 'bases()' contains 'y' and 'vbases()' contains 'z' - but test
it and find out?

On Wed, Feb 10, 2021 at 4:51 AM Deep Majumder via cfe-dev
<[hidden email]> wrote:

>
> Hello everyone,
> While trying to iterate over the base classes of a class/struct represented by a CXXRecordDecl, I found two methods: one is bases() and the other is bases().
> Is it that bases() returns all instantiable base classes, while vbases() returns all abstract base classes? Or is it something different?
> Warm regards,
> Deep
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: CXXRecordDecl: bases() vs vbases()

shirley breuer via cfe-dev
On Wed, 10 Feb 2021 at 10:49, David Blaikie via cfe-dev <[hidden email]> wrote:
I'd guess 'bases()' probably gives direct base classes and vbases()
probably gives direct virtual base classes, eg:

struct x : y, virtual z { };

probably 'bases()' contains 'y' and 'vbases()' contains 'z' - but test
it and find out?

bases() gives all direct bases (whether virtual or not), and vbases() gives all virtual bases (whether direct or not).
 
On Wed, Feb 10, 2021 at 4:51 AM Deep Majumder via cfe-dev
<[hidden email]> wrote:
>
> Hello everyone,
> While trying to iterate over the base classes of a class/struct represented by a CXXRecordDecl, I found two methods: one is bases() and the other is bases().
> Is it that bases() returns all instantiable base classes, while vbases() returns all abstract base classes? Or is it something different?
> Warm regards,
> Deep
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: CXXRecordDecl: bases() vs vbases()

shirley breuer via cfe-dev
ah, well, there you go :)

On Wed, Feb 10, 2021 at 11:01 AM Richard Smith <[hidden email]> wrote:

>
> On Wed, 10 Feb 2021 at 10:49, David Blaikie via cfe-dev <[hidden email]> wrote:
>>
>> I'd guess 'bases()' probably gives direct base classes and vbases()
>> probably gives direct virtual base classes, eg:
>>
>> struct x : y, virtual z { };
>>
>> probably 'bases()' contains 'y' and 'vbases()' contains 'z' - but test
>> it and find out?
>
>
> bases() gives all direct bases (whether virtual or not), and vbases() gives all virtual bases (whether direct or not).
>
>>
>> On Wed, Feb 10, 2021 at 4:51 AM Deep Majumder via cfe-dev
>> <[hidden email]> wrote:
>> >
>> > Hello everyone,
>> > While trying to iterate over the base classes of a class/struct represented by a CXXRecordDecl, I found two methods: one is bases() and the other is bases().
>> > Is it that bases() returns all instantiable base classes, while vbases() returns all abstract base classes? Or is it something different?
>> > Warm regards,
>> > Deep
>> > _______________________________________________
>> > cfe-dev mailing list
>> > [hidden email]
>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev