diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-13 20:57:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-13 20:57:00 +0000 |
commit | 69da5cf26143e4542d4bf8c78ffac6d079efe5c9 (patch) | |
tree | 22a05be14b5a74d3bbd2f1dcb8a07d91f4238177 /lib/VMCore/Verifier.cpp | |
parent | 0b16ae209a1d0876a7ea6800bb567d925443cba3 (diff) | |
download | external_llvm-69da5cf26143e4542d4bf8c78ffac6d079efe5c9.zip external_llvm-69da5cf26143e4542d4bf8c78ffac6d079efe5c9.tar.gz external_llvm-69da5cf26143e4542d4bf8c78ffac6d079efe5c9.tar.bz2 |
- Change Function's so that their argument list is populated when they are
constructed. Before, external functions would have an empty argument list,
now a Function ALWAYS has a populated argument list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index b01b5ef..da3449b 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -193,32 +193,30 @@ void Verifier::verifySymbolTable(SymbolTable *ST) { // visitFunction - Verify that a function is ok. // void Verifier::visitFunction(Function &F) { - if (F.isExternal()) return; - - verifySymbolTable(F.getSymbolTable()); - // Check function arguments... const FunctionType *FT = F.getFunctionType(); unsigned NumArgs = F.getArgumentList().size(); Assert2(!FT->isVarArg(), "Cannot define varargs functions in LLVM!", &F, FT); - Assert2(FT->getParamTypes().size() == NumArgs, + Assert2(FT->getNumParams() == NumArgs, "# formal arguments must match # of arguments for function type!", &F, FT); // Check that the argument values match the function type for this function... - if (FT->getParamTypes().size() == NumArgs) { - unsigned i = 0; - 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)); + unsigned i = 0; + 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)); + + if (!F.isExternal()) { + verifySymbolTable(F.getSymbolTable()); + + // Check the entry node + BasicBlock *Entry = &F.getEntryNode(); + Assert1(pred_begin(Entry) == pred_end(Entry), + "Entry block to function must not have predecessors!", Entry); } - - // Check the entry node - BasicBlock *Entry = &F.getEntryNode(); - Assert1(pred_begin(Entry) == pred_end(Entry), - "Entry block to function must not have predecessors!", Entry); } |