[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Chris Lattner
clattner at apple.com
Thu Jan 4 10:58:21 PST 2007
There is a typo in the function header (lossleslly) of
Type::canLosslesslyBitCastTo:
// canLosslesllyBitCastTo - Return true if this type can be converted to
// 'Ty' without any reinterpretation of bits. For example, uint to int.
//
> // At this point we have only various mismatches of the first
> class types
> // remaining and ptr->ptr. Just select the lossless conversions.
> Everything
> // else is not lossless.
This comment needs to be updated.
> - switch (getTypeID()) {
> - case Type::UByteTyID: return Ty == Type::SByteTy;
> - case Type::SByteTyID: return Ty == Type::UByteTy;
> - case Type::UShortTyID: return Ty == Type::ShortTy;
> - case Type::ShortTyID: return Ty == Type::UShortTy;
> - case Type::UIntTyID: return Ty == Type::IntTy;
> - case Type::IntTyID: return Ty == Type::UIntTy;
> - case Type::ULongTyID: return Ty == Type::LongTy;
> - case Type::LongTyID: return Ty == Type::ULongTy;
> - case Type::PointerTyID: return isa<PointerType>(Ty);
> - default:
> - break;
> - }
> + if (getTypeID() == Type::PointerTyID)
> + return isa<PointerType>(Ty);
> return false; // Other types have no identity values
> }
What is Type::canLosslesslyBitCastTo used by now? Can we just
eliminate it?
> +FunctionType::ParameterAttributes
> +FunctionType::getParamAttrs(unsigned Idx) const {
> + if (!ParamAttrs)
> + return ParameterAttributes(0);
> + if (Idx > ParamAttrs->size())
> + return ParameterAttributes(0);
> + return (*ParamAttrs)[Idx];
> +}
Why does this map an out-of-range index onto attr 0? Shouldn't this
be an assert?
-Chris
More information about the llvm-commits
mailing list