[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Reader.h

Chris Lattner clattner at apple.com
Fri Jan 12 14:24:26 PST 2007


> +  case Type::IntegerTyID: {
> +    const IntegerType *IT = cast<IntegerType>(Ty);
> +    if (IT->getBitWidth() <= 32) {
> +      uint32_t Val = read_vbr_uint();
> +      if (IT->getBitWidth() == 1) {
> +        if (Val != 0 && Val != 1)
> +          error("Invalid boolean value read.");
> +        Result = ConstantInt::get(Type::Int1Ty, Val == 1);
> +        if (Handler) Handler->handleConstantValue(Result);
> +      } else {
> +        if (!ConstantInt::isValueValidForType(Ty, uint64_t(Val)))
> +          error("Integer value read is invalid for type.");
> +        Result = ConstantInt::get(IT, Val);
> +        if (Handler) Handler->handleConstantValue(Result);
> +      }

This special case for bool can go away here, can't it?  If so, please  
remove it.

-Chris



More information about the llvm-commits mailing list