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>
Hello again, So, after some changes, I inserted intentionally values with use in other modules, and I get the following error: While deleting: i1 % Use still stuck around after Def is destroyed: %c = phi i1 [ false, <badref> ] [...] Assertion failed: (use_empty() && "Uses remain when a value is destroyed!"), function ~Value, file /Developer/llvm/lib/VMCore/Value.cpp, line 75. [...] This error occurred in between the return of the initialize() method and the actual return to the derived class method. Any one of you could help me to avoid this behavior? Best regards, -- Cristianno Martins PhD Student of Computer Science University of Campinas cmartins at ic.unicamp.br On Sunday, 8 de April de 2012 at 13:37, Cristianno Martins wrote:> 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 (mailto:cmartins at ic.unicamp.br) > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120409/f50d00c1/attachment.html>
Btw, problem solved. Apparently I needed only to save a reference to the LLVMContext, that was being deleted. Best, -- Cristianno Martins PhD Student of Computer Science University of Campinas cmartins at ic.unicamp.br On Monday, 9 de April de 2012 at 02:02, Cristianno Martins wrote:> Hello again, > > So, after some changes, I inserted intentionally values with use in other modules, and I get the following error: > > > While deleting: i1 % > > > Use still stuck around after Def is destroyed: %c = phi i1 [ false, <badref> ] > > > [...] > > > Assertion failed: (use_empty() && "Uses remain when a value is destroyed!"), function ~Value, file /Developer/llvm/lib/VMCore/Value.cpp, line 75. > > > [...] > > > > > > > This error occurred in between the return of the initialize() method and the actual return to the derived class method. Any one of you could help me to avoid this behavior? > > Best regards, > > -- > Cristianno Martins > PhD Student of Computer Science > University of Campinas > cmartins at ic.unicamp.br (mailto:cmartins at ic.unicamp.br) > > > On Sunday, 8 de April de 2012 at 13:37, Cristianno Martins wrote: > > > 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 (mailto:cmartins at ic.unicamp.br) > > > > > > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120409/5eeb46b9/attachment.html>