aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-21 22:24:17 +0000
committerDevang Patel <dpatel@apple.com>2008-02-21 22:24:17 +0000
commit6c94b70d6e8bc166d6951a19374292055c05e8d8 (patch)
tree9da683d58c6c622edb2c6b35b9bd865d4324e7d4 /lib
parenta2e7efa6d3118ed58395578e4d871b2c415dff11 (diff)
downloadexternal_llvm-6c94b70d6e8bc166d6951a19374292055c05e8d8.zip
external_llvm-6c94b70d6e8bc166d6951a19374292055c05e8d8.tar.gz
external_llvm-6c94b70d6e8bc166d6951a19374292055c05e8d8.tar.bz2
Use isa<> instead of getTypeID() to check StructType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Function.cpp2
-rw-r--r--lib/VMCore/Verifier.cpp11
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index ee38663..49d770d 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -180,7 +180,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
SymTab = new ValueSymbolTable();
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy
- || getReturnType()->getTypeID() == Type::StructTyID)
+ || isa<StructType>(getReturnType()))
&& "LLVM functions cannot return aggregate values!");
// If the function has arguments, mark them as lazily built.
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 2eb306b..386ee09 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -452,7 +452,7 @@ void Verifier::visitFunction(Function &F) {
&F, FT);
Assert1(F.getReturnType()->isFirstClassType() ||
F.getReturnType() == Type::VoidTy ||
- F.getReturnType()->getTypeID() == Type::StructTyID,
+ isa<StructType>(F.getReturnType()),
"Functions cannot return aggregate values!", &F);
Assert1(!F.isStructReturn() || FT->getReturnType() == Type::VoidTy,
@@ -1072,8 +1072,8 @@ void Verifier::visitInstruction(Instruction &I) {
// Check that the return value of the instruction is either void or a legal
// value type.
Assert1(I.getType() == Type::VoidTy || I.getType()->isFirstClassType()
- || ((isa<CallInst>(I) || isa<InvokeInst>(I))
- && I.getType()->getTypeID() == Type::StructTyID),
+ || ((isa<CallInst>(I) || isa<InvokeInst>(I))
+ && isa<StructType>(I.getType())),
"Instruction returns a non-scalar type!", &I);
// Check that all uses of the instruction, if they are instructions
@@ -1095,14 +1095,13 @@ void Verifier::visitInstruction(Instruction &I) {
// instructions.
if (!I.getOperand(i)->getType()->isFirstClassType()) {
if (isa<ReturnInst>(I) || isa<GetResultInst>(I))
- Assert1(I.getOperand(i)->getType()->getTypeID() == Type::StructTyID,
+ Assert1(isa<StructType>(I.getOperand(i)->getType()),
"Invalid ReturnInst operands!", &I);
else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
if (const PointerType *PT = dyn_cast<PointerType>
(I.getOperand(i)->getType())) {
const Type *ETy = PT->getElementType();
- Assert1(ETy->getTypeID() == Type::StructTyID,
- "Invalid CallInst operands!", &I);
+ Assert1(isa<StructType>(ETy), "Invalid CallInst operands!", &I);
}
else
Assert1(0, "Invalid CallInst operands!", &I);