[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Nov 21 16:33:09 PST 2003
Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.57 -> 1.58
Verifier.cpp updated: 1.73 -> 1.74
---
Log message:
Check return types of functions
---
Diffs of the changes: (+6 -0)
Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.57 llvm/lib/VMCore/Function.cpp:1.58
--- llvm/lib/VMCore/Function.cpp:1.57 Fri Nov 21 14:23:48 2003
+++ llvm/lib/VMCore/Function.cpp Fri Nov 21 16:32:23 2003
@@ -95,6 +95,9 @@
ArgumentList.setParent(this);
SymTab = new SymbolTable();
+ assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)
+ && "LLVM functions cannot return aggregate values!");
+
// Create the arguments vector, all arguments start out unnamed.
for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) {
assert(Ty->getParamType(i) != Type::VoidTy &&
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.73 llvm/lib/VMCore/Verifier.cpp:1.74
--- llvm/lib/VMCore/Verifier.cpp:1.73 Fri Nov 21 14:33:27 2003
+++ llvm/lib/VMCore/Verifier.cpp Fri Nov 21 16:32:23 2003
@@ -241,6 +241,9 @@
Assert2(FT->getNumParams() == NumArgs,
"# formal arguments must match # of arguments for function type!",
&F, FT);
+ Assert1(F.getReturnType()->isFirstClassType() ||
+ F.getReturnType() == Type::VoidTy,
+ "Functions cannot return aggregate values!", &F);
// Check that the argument values match the function type for this function...
unsigned i = 0;
More information about the llvm-commits
mailing list