[MCJIT] Make repeat calls to MCJIT::getPointerToFunction for declarations safe.
[oota-llvm.git] / unittests / ExecutionEngine / MCJIT / MCJITTestBase.h
index bc44418003cf3475133dc8198771a271488915d6..eea88bbe3f43104f91f9707dbba673c0ef36d08c 100644 (file)
@@ -107,6 +107,15 @@ protected:
     return Result;
   }
 
+  // Inserts a declaration to a function defined elsewhere
+  template <typename FuncType>
+  Function *insertExternalReferenceToFunction(Module *M, StringRef Name) {
+    Function *Result = Function::Create(
+                         TypeBuilder<FuncType, false>::get(Context),
+                         GlobalValue::ExternalLinkage, Name, M);
+    return Result;
+  }
+
   // Inserts an declaration to a function defined elsewhere
   Function *insertExternalReferenceToFunction(Module *M, StringRef Name,
                                               FunctionType *FuncTy) {