[cfe-dev] Matching Indirect base classes
Pedro Delgado Perez
pedro.delgado at uca.es
Fri Nov 8 09:16:16 PST 2013
Hi,
Thanks Daniel, I suppose you mean CXXRecordDecl::lookupInBases() instead CXXRecordDecl::findInBases().
Have you ever used one of these methods? I don't understand quite well how can I use them for my purpose. What I need is that, given an object CXXRecordDecl, I can analyze something in particular in each one of its base classes (direct or indirect). Thus, I need to get each one of these classes to process them, but the methods you refer only return a bool.
Could you please show me an example using these methods? Mainly, with respect the arguments passed to these methdos.
Thanks,
Pedro.
El día 08 nov 2013 15:32, Daniel Jasper <djasper at google.com> escribió:
> Take a look at CXXRecordDecl::forallBases() and CXXRecordDecl::findInBases(). Dependent on what you want to do, one of them might do what you need.
> Cheers,
> Daniel
>
>
>
> On Fri, Nov 8, 2013 at 2:39 AM, Pedro Delgado Perez <pedro.delgado at uca.es [ mailto:pedro.delgado at uca.es ]> wrote:
>
>
> Hello,
>
> Please, I need some help with an issue I noticed a few days ago and I am not able to solve.
>
> To illustrate my problem, I show this piece of code:
>
> class A{
> public:
> A(): a(1) {};
> int a;
> };
>
> class B: public A{
> public:
> B(): b(2){};
> int b;
> };
>
> class C: public B{
> public:
> C(): c(3){};
> int b;
> int a;
> };
>
> We have three classes, where:
> B inherits directly from A
> C inherits directly from B and INDIRECTLY from A
>
> Using CXXRecordDecl::base_class_iterator, the classes indirectly inherited are not visited. Please, can someone explain me how to take into account these indirectly inherited base classes? I've been thinking on recursion (use base_class_iterator on each class directly inherited), but I'm sure there should be another simpler way to do this.
>
> Thanks in advance,
>
> Pedro.
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
>
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev [ http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131108/4146b4b4/attachment.html>
More information about the cfe-dev
mailing list