bridge: allow resolving a placeholder pointer type with a C function type

The frontend may pass a C function type as a function pointer
type to resolve a placeholder pointer (e.g. in the interface
mtable struct). Handle this case and make a function pointer type.

Change-Id: Ic7a18c98961b9424596811dd6c11e4c0bebffca8
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/183420
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/bridge/go-llvm-typemanager.cpp b/bridge/go-llvm-typemanager.cpp
index 7047684..5ba97f3 100644
--- a/bridge/go-llvm-typemanager.cpp
+++ b/bridge/go-llvm-typemanager.cpp
@@ -985,6 +985,13 @@
   assert(to_type);
   if (placeholder == errorType_ || to_type == errorType_)
     return false;
+
+  // The frontend may pass a C function type as a function pointer
+  // type (e.g. in the interface mtable struct). Make a function
+  // pointer type here.
+  if (to_type->castToBFunctionType())
+    to_type = pointerType(to_type);
+
   assert(to_type->type()->isPointerTy());
   assert(placeholders_.find(placeholder) != placeholders_.end());