[LLVMdev] Compilation error with LLVM 2.9

Julien Henry Julien.Henry at imag.fr
Thu Apr 21 13:31:51 PDT 2011


Hi all,

     I wrote code that compiled with llvm 2.8, but now I'm using llvm 
2.9 and it doesn't compile anymore:

My code looks like this:

User *U;
...
if (PHINode * phi = dyn_cast<PHINode>(U)) {
             ...
             BasicBlock * Pred = phi->getIncomingBlock(I);
             ...
}

And when I compile it with clang:


Live.cc:130:27: error: member access into incomplete type 'llvm::PHINode'
                         BasicBlock * Pred = phi->getIncomingBlock(I);
                                                ^
In file included from Live.cc:3:
In file included from ./Live.h:9:
/usr/include/llvm/Analysis/LoopInfo.h:58:7: note: forward declaration of
       'llvm::PHINode'
class PHINode;
       ^
In file included from Live.cc:3:
In file included from ./Live.h:5:
In file included from /usr/include/llvm/Support/CFG.h:19:
In file included from /usr/include/llvm/Function.h:21:
In file included from /usr/include/llvm/GlobalValue.h:21:
In file included from /usr/include/llvm/Constant.h:17:
In file included from /usr/include/llvm/User.h:22:
In file included from /usr/include/llvm/Value.h:20:
/usr/include/llvm/Support/Casting.h:55:12: error: incomplete type 
'llvm::PHINode'
       named in nested name specifier
     return To::classof(&Val);
            ^~~~
/usr/include/llvm/Support/Casting.h:73:33: note: in instantiation of 
member function
       'llvm::isa_impl<llvm::PHINode, llvm::User>::doit' requested here
     return isa_impl<To,FromTy>::doit(Val);
                                 ^
/usr/include/llvm/Support/Casting.h:85:71: note: in instantiation of 
member function
       'llvm::isa_impl_wrap<llvm::PHINode, const llvm::User, const 
llvm::User>::doit'
       requested here
                    typename simplify_type<const 
FromCl>::SimpleType>::doit(Val);
                                                                       ^
/usr/include/llvm/Support/Casting.h:103:12: note: in instantiation of 
function
       template specialization 
'llvm::isa_impl_cl<llvm::User>::isa<llvm::PHINode>'
       requested here
     return isa_impl_cl<FromCl>::template isa<ToCl>(*Val);
            ^
/usr/include/llvm/Support/Casting.h:118:10: note: in instantiation of 
function
       template specialization 'llvm::isa_impl_cl<llvm::User 
*>::isa<llvm::PHINode>'
       requested here
   return isa_impl_cl<Y>::template isa<X>(Val);
          ^
/usr/include/llvm/Support/Casting.h:228:10: note: in instantiation of 
function
       template specialization 'llvm::isa<llvm::PHINode, llvm::User *>' 
requested here
   return isa<X>(Val) ? cast<X, Y>(Val) : 0;
          ^
Live.cc:122:23: note: in instantiation of function template specialization
       'llvm::dyn_cast<llvm::PHINode, llvm::User *>' requested here
                 if (PHINode * phi = dyn_cast<PHINode>(U)) {
                                     ^
In file included from Live.cc:3:
In file included from ./Live.h:9:
/usr/include/llvm/Analysis/LoopInfo.h:58:7: note: forward declaration of
       'llvm::PHINode'
class PHINode;
       ^
2 errors generated.
make: *** [../bin/Live.o] Error 1


Do you know what's wrong ?

Thanks.

Julien



More information about the llvm-dev mailing list