[LLVMdev] CBackend bug fix

Alexander Herz alexander.herz at mytum.de
Tue Aug 3 05:56:54 PDT 2010


Hi,

maybe this has been fixed before, but I guess not:

The CWriter::GetValueName() method does not check if a value as an alias 
and emits the alias name which will never be defined in the output .c 
file (so the output file fails to compile). This can happen if you have 
multiple inheritance with several destructors defined by clang (...D0Ev, 
...D1Ev, ...D2Ev).

This can be fixed by placing the following code:

std::string CWriter::GetValueName(const Value *Op) {

   const Value* Operand=Op;

   if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(Operand)) {
       if(const Value* v=GA->resolveAliasedGlobal(false))
           Operand=v;
   }


at the top of CWriter::GetValueName() in CBackend.cpp

Regards,
Alex





More information about the llvm-dev mailing list