PR7704: A function is not allowed to return a function; make sure to enforce
authorEli Friedman <eli.friedman@gmail.com>
Sat, 24 Jul 2010 22:58:04 +0000 (22:58 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sat, 24 Jul 2010 22:58:04 +0000 (22:58 +0000)
this consistently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109360 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index b0897b4ca4ae789961839f9586e4a654c58a07a6..0c9b0eaf56430da42ab2294728e5d1dc4db8e9c7 100644 (file)
@@ -455,8 +455,8 @@ const PointerType *Type::getInt64PtrTy(LLVMContext &C, unsigned AS) {
 /// isValidReturnType - Return true if the specified type is valid as a return
 /// type.
 bool FunctionType::isValidReturnType(const Type *RetTy) {
-  return RetTy->getTypeID() != LabelTyID &&
-         RetTy->getTypeID() != MetadataTyID;
+  return !RetTy->isFunctionTy() && !RetTy->isLabelTy() &&
+         !RetTy->isMetadataTy();
 }
 
 /// isValidArgumentType - Return true if the specified type is valid as an