Verify that varargs functions all have ccc
authorChris Lattner <sabre@nondot.org>
Sun, 8 May 2005 22:27:09 +0000 (22:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 8 May 2005 22:27:09 +0000 (22:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21792 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index ab9e60cc3eeba4a4a9edbd00d6cbe772b70f0d7d..753a75ea0cfc6b1e3343e9293c5dc2d965754532 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Assembly/Writer.h"
+#include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "llvm/Module.h"
@@ -294,7 +295,10 @@ void Verifier::verifySymbolTable(SymbolTable &ST) {
 // visitFunction - Verify that a function is ok.
 //
 void Verifier::visitFunction(Function &F) {
-  // Check function arguments...
+  Assert1(!F.isVarArg() || F.getCallingConv() == CallingConv::C,
+          "Varargs functions must have C calling conventions!", &F);
+
+  // Check function arguments.
   const FunctionType *FT = F.getFunctionType();
   unsigned NumArgs = F.getArgumentList().size();