[llvm-commits] [llvm] r136611 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Duncan Sands baldrick at free.fr
Mon Aug 1 05:40:05 PDT 2011


Hi Jay,

> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Aug  1 07:29:14 2011
> @@ -1397,27 +1397,8 @@
>     if (Aliasee == 0) {
>       TypePrinter.print(GA->getType(), Out);
>       Out<<  "<<NULL ALIASEE>>";
> -  } else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Aliasee)) {
> -    TypePrinter.print(GV->getType(), Out);
> -    Out<<  ' ';
> -    PrintLLVMName(Out, GV);
> -  } else if (const Function *F = dyn_cast<Function>(Aliasee)) {
> -    TypePrinter.print(F->getFunctionType(), Out);
> -    Out<<  "* ";
> -
> -    WriteAsOperandInternal(Out, F,&TypePrinter,&Machine, F->getParent());
> -  } else if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(Aliasee)) {
> -    TypePrinter.print(GA->getType(), Out);
> -    Out<<  ' ';
> -    PrintLLVMName(Out, GA);
> -  } else {
> -    const ConstantExpr *CE = cast<ConstantExpr>(Aliasee);
> -    // The only valid GEP is an all zero GEP.
> -    assert((CE->getOpcode() == Instruction::BitCast ||
> -            CE->getOpcode() == Instruction::GetElementPtr)&&
> -           "Unsupported aliasee");
> -    writeOperand(CE, false);
> -  }
> +  } else
> +    writeOperand(Aliasee, !isa<ConstantExpr>(Aliasee));

usual style is: if some branch of an if is wrapped in {} then all branches
should be.  So here this would be:

 > +  } else {
 > +    writeOperand(Aliasee, !isa<ConstantExpr>(Aliasee));
 > +  }

Ciao, Duncan.



More information about the llvm-commits mailing list