[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Jun 3 01:45:04 PDT 2004
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.102 -> 1.103
---
Log message:
* Verify function prototypes, not just functions with bodies.
* Verify that functions do not take aggregates as arguments.
---
Diffs of the changes: (+12 -2)
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.102 llvm/lib/VMCore/Verifier.cpp:1.103
--- llvm/lib/VMCore/Verifier.cpp:1.102 Thu May 27 16:58:13 2004
+++ llvm/lib/VMCore/Verifier.cpp Thu Jun 3 01:38:43 2004
@@ -112,12 +112,18 @@
bool doFinalization(Module &M) {
// Scan through, checking all of the external function's linkage now...
- for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
visitGlobalValue(*I);
+ // Check to make sure function prototypes are okay.
+ if (I->isExternal()) visitFunction(*I);
+ }
+
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
visitGlobalValue(*I);
+
+
// If the module is broken, abort at this time.
abortIfBroken();
return false;
@@ -284,10 +290,14 @@
// Check that the argument values match the function type for this function...
unsigned i = 0;
- for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++i)
+ for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++i) {
Assert2(I->getType() == FT->getParamType(i),
"Argument value does not match function argument type!",
I, FT->getParamType(i));
+ // Make sure no aggregates are passed by value.
+ Assert1(I->getType()->isFirstClassType(),
+ "Functions cannot take aggregates as arguments by value!", I);
+ }
if (!F.isExternal()) {
verifySymbolTable(F.getSymbolTable());
More information about the llvm-commits
mailing list