[cfe-commits] r63775 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGCall.h

Daniel Dunbar daniel at zuster.org
Wed Feb 4 13:17:21 PST 2009


Author: ddunbar
Date: Wed Feb  4 15:17:21 2009
New Revision: 63775

URL: http://llvm.org/viewvc/llvm-project?rev=63775&view=rev
Log:
Add asserts that the function signature matches the other arguments provide
to CGCall functions.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CGCall.h

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=63775&r1=63774&r2=63775&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Feb  4 15:17:21 2009
@@ -1167,6 +1167,8 @@
     ++AI;
   }
     
+  assert(FI.arg_size() == Args.size() &&
+         "Mismatch between function signature & arguments.");
   CGFunctionInfo::const_arg_iterator info_it = FI.arg_begin();
   for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
        i != e; ++i, ++info_it) {
@@ -1316,6 +1318,8 @@
     assert(0 && "Invalid ABI kind for return argument");
   }
   
+  assert(CallInfo.arg_size() == CallArgs.size() &&
+         "Mismatch between function signature & arguments.");
   CGFunctionInfo::const_arg_iterator info_it = CallInfo.arg_begin();
   for (CallArgList::const_iterator I = CallArgs.begin(), E = CallArgs.end(); 
        I != E; ++I, ++info_it) {

Modified: cfe/trunk/lib/CodeGen/CGCall.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.h?rev=63775&r1=63774&r2=63775&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.h (original)
+++ cfe/trunk/lib/CodeGen/CGCall.h Wed Feb  4 15:17:21 2009
@@ -76,6 +76,8 @@
     arg_iterator arg_begin() { return Args + 1; }
     arg_iterator arg_end() { return Args + 1 + NumArgs; }
 
+    unsigned  arg_size() const { return NumArgs; }
+
     QualType getReturnType() const { return Args[0].type; }
 
     ABIArgInfo &getReturnInfo() { return Args[0].info; }





More information about the cfe-commits mailing list