[LLVMdev] Function and inheritance

Cristianno Martins cristiannomartins at gmail.com
Sun Apr 8 09:37:56 PDT 2012


Hello guys, 

So, I'm stucked in a problem involving a Function and a derived class. Well, I was refactoring part of my pass code, and created two classes in this process that are interesting here: class A and class B. Class B inherits from class A; on the other hand, class A has some pure virtual methods (already implemented in class B), and a Module, that holds only one auxiliary function (a working copy of the function being processed by the pass with some adjustments).

Ok, the derived class, B, calls a method inherited from A (let's say, initialize()), that uses the implementation in B of the virtual methods in A. So far, so good. This initialize method basically builds my module and initializes its function. Here comes the strange part: if I dump the function in the very end of initialize(), I can access without problems the basic blocks on it. But once I'd returned to the B method that called initialize(), if I dump the function (which is a protected attribute in A, btw), I get a message like that:

Assertion failed: (!empty() && "Called front() on empty list!"), function front, file /Developer/llvm/include/llvm/ADT/ilist.h, line 388.
[...]

Is there some tricky way to do this that I'm not seeing?

Thanks in advance,

-- 
Cristianno Martins
PhD Student of Computer Science
University of Campinas
cmartins at ic.unicamp.br

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120408/982dc280/attachment.html>


More information about the llvm-dev mailing list