[cfe-dev] Matching Indirect base classes

Pedro Delgado Perez pedro.delgado at uca.es
Fri Nov 8 02:39:46 PST 2013


 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131108/7254712a/attachment.html>


More information about the cfe-dev mailing list