[llvm-commits] [llvm] r148910 - /llvm/trunk/lib/VMCore/Constants.cpp
Nick Lewycky
nicholas at mxc.ca
Tue Jan 24 19:20:12 PST 2012
Author: nicholas
Date: Tue Jan 24 21:20:12 2012
New Revision: 148910
URL: http://llvm.org/viewvc/llvm-project?rev=148910&view=rev
Log:
Fix assert("msg"). Fix unused-variable warnings complaining about VT used only
in asserts.
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=148910&r1=148909&r2=148910&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jan 24 21:20:12 2012
@@ -1506,8 +1506,9 @@
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 @@
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 @@
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);
}
More information about the llvm-commits
mailing list