Reorganize the C API headers to improve build times.
[oota-llvm.git] / unittests / ExecutionEngine / Orc / OrcCAPITest.cpp
index 095d42599bfefe2fb1ea868e848d20c259f78d22..776d26970a311b7d163a977d5f8a7f5c55febb0b 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "OrcTestCommon.h"
 #include "gtest/gtest.h"
+#include "llvm-c/Core.h"
 #include "llvm-c/OrcBindings.h"
 #include "llvm-c/Target.h"
 #include "llvm-c/TargetMachine.h"
 
 namespace llvm {
 
-DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef);
+DEFINE_SIMPLE_CONVERSION_FUNCTIONS(TargetMachine, LLVMTargetMachineRef)
 
 class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest {
 protected:
-
   std::unique_ptr<Module> createTestModule(const Triple &TT) {
     ModuleBuilder MB(getGlobalContext(), TT.str(), "");
     Function *TestFunc = MB.createFunctionDecl<int()>("testFunc");
@@ -37,9 +37,9 @@ protected:
     return MB.takeModule();
   }
 
-  typedef int (*MainFnTy)(void);
+  typedef int (*MainFnTy)();
 
-  static int myTestFuncImpl(void) {
+  static int myTestFuncImpl() {
     return 42;
   }
 
@@ -66,30 +66,29 @@ protected:
     auto *ET = CCtx->APIExecTest;
     CCtx->M = ET->createTestModule(ET->TM->getTargetTriple());
     CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, wrap(CCtx->M.get()),
-                                          myResolver, 0);
+                                          myResolver, nullptr);
     CCtx->Compiled = true;
     LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(JITStack, "main");
     LLVMOrcSetIndirectStubPointer(JITStack, "foo", MainAddr);
     return MainAddr;
   }
-
 };
 
-char *OrcCAPIExecutionTest::testFuncName = 0;
+char *OrcCAPIExecutionTest::testFuncName = nullptr;
 
 TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
   if (!TM)
     return;
 
   LLVMOrcJITStackRef JIT =
-    LLVMOrcCreateInstance(wrap(TM.get()), LLVMGetGlobalContext());
+    LLVMOrcCreateInstance(wrap(TM.get()));
 
   std::unique_ptr<Module> M = createTestModule(TM->getTargetTriple());
 
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
-    LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+    LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
@@ -106,14 +105,14 @@ TEST_F(OrcCAPIExecutionTest, TestLazyIRCompilation) {
     return;
 
   LLVMOrcJITStackRef JIT =
-    LLVMOrcCreateInstance(wrap(TM.get()), LLVMGetGlobalContext());
+    LLVMOrcCreateInstance(wrap(TM.get()));
 
   std::unique_ptr<Module> M = createTestModule(TM->getTargetTriple());
 
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
   LLVMOrcModuleHandle H =
-    LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+    LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
   MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
   int Result = MainFn();
   EXPECT_EQ(Result, 42)
@@ -130,7 +129,7 @@ TEST_F(OrcCAPIExecutionTest, TestDirectCallbacksAPI) {
     return;
 
   LLVMOrcJITStackRef JIT =
-    LLVMOrcCreateInstance(wrap(TM.get()), LLVMGetGlobalContext());
+    LLVMOrcCreateInstance(wrap(TM.get()));
 
   LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
 
@@ -158,4 +157,4 @@ TEST_F(OrcCAPIExecutionTest, TestDirectCallbacksAPI) {
   LLVMOrcDisposeInstance(JIT);
 }
 
-}
+} // namespace llvm