[cfe-commits] r127319 - /cfe/trunk/lib/CodeGen/CGVTables.cpp

John McCall rjmccall at apple.com
Tue Mar 8 23:12:35 PST 2011


Author: rjmccall
Date: Wed Mar  9 01:12:35 2011
New Revision: 127319

URL: http://llvm.org/viewvc/llvm-project?rev=127319&view=rev
Log:
Tame this assert, hopefully fixing self-host.


Modified:
    cfe/trunk/lib/CodeGen/CGVTables.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=127319&r1=127318&r2=127319&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Wed Mar  9 01:12:35 2011
@@ -2559,6 +2559,16 @@
   Fn->setVisibility(llvm::GlobalValue::HiddenVisibility);
 }
 
+#ifndef NDEBUG
+static bool similar(const ABIArgInfo &infoL, CanQualType typeL,
+                    const ABIArgInfo &infoR, CanQualType typeR) {
+  return (infoL.getKind() == infoR.getKind() &&
+          (typeL == typeR ||
+           (isa<PointerType>(typeL) && isa<PointerType>(typeR)) ||
+           (isa<ReferenceType>(typeL) && isa<ReferenceType>(typeR))));
+}
+#endif
+
 void CodeGenFunction::GenerateThunk(llvm::Function *Fn,
                                     const CGFunctionInfo &FnInfo,
                                     GlobalDecl GD, const ThunkInfo &Thunk) {
@@ -2619,7 +2629,16 @@
 #ifndef NDEBUG
   const CGFunctionInfo &CallFnInfo = 
     CGM.getTypes().getFunctionInfo(ResultType, CallArgs, FPT->getExtInfo());
-  assert(&CallFnInfo == &FnInfo && "thunk has different CC from callee?");
+  assert(CallFnInfo.getRegParm() == FnInfo.getRegParm() &&
+         CallFnInfo.isNoReturn() == FnInfo.isNoReturn() &&
+         CallFnInfo.getCallingConvention() == FnInfo.getCallingConvention());
+  assert(similar(CallFnInfo.getReturnInfo(), CallFnInfo.getReturnType(),
+                 FnInfo.getReturnInfo(), FnInfo.getReturnType()));
+  assert(CallFnInfo.arg_size() == FnInfo.arg_size());
+  for (unsigned i = 0, e = FnInfo.arg_size(); i != e; ++i)
+    assert(similar(CallFnInfo.arg_begin()[i].info,
+                   CallFnInfo.arg_begin()[i].type,
+                   FnInfo.arg_begin()[i].info, FnInfo.arg_begin()[i].type));
 #endif
   
   // Determine whether we have a return value slot to use.





More information about the cfe-commits mailing list