else
V = Builder.CreateLoad(RV.getAggregateAddr());
+ // If the argument doesn't match, perform a bitcast to coerce it. This
+ // can happen due to trivial type mismatches.
+ if (IRArgNo < IRFuncTy->getNumParams() &&
+ V->getType() != IRFuncTy->getParamType(IRArgNo))
+ V = Builder.CreateBitCast(V, IRFuncTy->getParamType(IRArgNo));
Args.push_back(V);
- // Validate argument match.
checkArgMatches(V, IRArgNo, IRFuncTy);
break;
}
-// RUN: %clang %s -O0 -emit-llvm -S -o - | grep 'call.*rb_define_global_function'
-// This should call rb_define_global_function, not rb_f_chop.
+// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s
+// This should call rb_define_global_function, not rb_f_chop.
void rb_define_global_function (const char*,void(*)(),int);
static void rb_f_chop();
void Init_String() {
static void rb_f_chop() {
}
+// CHECK: call{{.*}}rb_define_global_function
+
+// PR10335
+typedef void (* JSErrorCallback)(void);
+void js_GetErrorMessage(void);
+void JS_ReportErrorNumber(JSErrorCallback errorCallback, ...);
+void Interpret() {
+ JS_ReportErrorNumber(js_GetErrorMessage, 0);
+
+ // CHECK: call void ({{.*}}, ...)* @JS_ReportErrorNumber({{.*}}@js_GetErrorMessage
+}
+