diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-01-25 03:20:12 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-01-25 03:20:12 +0000 |
commit | 1486ae626f1af5c2797f4d13e9c57b3a0e473811 (patch) | |
tree | f6aced0e08d642d4df935160c982de438191cdd5 /lib/VMCore | |
parent | e0794d331a76301ae3fc8c4d1aa70c46acfc484c (diff) | |
download | external_llvm-1486ae626f1af5c2797f4d13e9c57b3a0e473811.zip external_llvm-1486ae626f1af5c2797f4d13e9c57b3a0e473811.tar.gz external_llvm-1486ae626f1af5c2797f4d13e9c57b3a0e473811.tar.bz2 |
Fix assert("msg"). Fix unused-variable warnings complaining about VT used only
in asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Constants.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 0fcce09..6cb36bf 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1506,8 +1506,9 @@ Constant *ConstantExpr::getPtrToInt(Constant *C, Type *DstTy) { assert(DstTy->getScalarType()->isIntegerTy() && "PtrToInt destination must be integer or integer vector"); assert(isa<VectorType>(C->getType()) == isa<VectorType>(DstTy)); - if (VectorType *VT = dyn_cast<VectorType>(C->getType())) - assert(VT->getNumElements() == cast<VectorType>(DstTy)->getNumElements() && + if (isa<VectorType>(C->getType())) + assert(cast<VectorType>(C->getType())->getNumElements() == + cast<VectorType>(DstTy)->getNumElements() && "Invalid cast between a different number of vector elements"); return getFoldedCast(Instruction::PtrToInt, C, DstTy); } @@ -1518,8 +1519,9 @@ Constant *ConstantExpr::getIntToPtr(Constant *C, Type *DstTy) { assert(DstTy->getScalarType()->isPointerTy() && "IntToPtr destination must be a pointer or pointer vector"); assert(isa<VectorType>(C->getType()) == isa<VectorType>(DstTy)); - if (VectorType *VT = dyn_cast<VectorType>(C->getType())) - assert(VT->getNumElements() == cast<VectorType>(DstTy)->getNumElements() && + if (isa<VectorType>(C->getType())) + assert(cast<VectorType>(C->getType())->getNumElements() == + cast<VectorType>(DstTy)->getNumElements() && "Invalid cast between a different number of vector elements"); return getFoldedCast(Instruction::IntToPtr, C, DstTy); } @@ -2218,7 +2220,8 @@ APFloat ConstantDataSequential::getElementAsAPFloat(unsigned Elt) const { const char *EltPtr = getElementPointer(Elt); switch (getElementType()->getTypeID()) { - default: assert("Accessor can only be used when element is float/double!"); + default: + assert(0 && "Accessor can only be used when element is float/double!"); case Type::FloatTyID: return APFloat(*(float*)EltPtr); case Type::DoubleTyID: return APFloat(*(double*)EltPtr); } |