[cxx][llvm] Fix C++ build (mono/mono#15807)
authorAleksey Kliger (λgeek) <alklig@microsoft.com>
Wed, 24 Jul 2019 16:37:57 +0000 (12:37 -0400)
committerGitHub <noreply@github.com>
Wed, 24 Jul 2019 16:37:57 +0000 (12:37 -0400)
* [cxx] Fix LLVMModuleFlags var initialization

* [cxx] Fix C++ errors in mini-llvm.c

Commit migrated from https://github.com/mono/mono/commit/784b350c40fc966440eab4bb3062b1244d6530df

src/mono/mono/mini/aot-compiler.c
src/mono/mono/mini/mini-llvm.c

index 0d4b2e2..9143b0d 100644 (file)
@@ -13531,7 +13531,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options,
 #ifdef ENABLE_LLVM
        if (acfg->llvm) {
                llvm_acfg = acfg;
-               LLVMModuleFlags flags = 0;
+               LLVMModuleFlags flags = (LLVMModuleFlags)0;
 #ifdef EMIT_DWARF_INFO
                flags = LLVM_MODULE_FLAG_DWARF;
 #endif
index b676cca..34b113a 100644 (file)
@@ -7516,7 +7516,8 @@ emit_method_inner (EmitContext *ctx)
         *  (1) a call (so it's a leaf method)
         *  (2) and no loops
         * we can skip the GC safepoint on method entry. */
-       gboolean requires_safepoint = cfg->has_calls;
+       gboolean requires_safepoint;
+       requires_safepoint = cfg->has_calls;
        if (!requires_safepoint) {
                for (bb = cfg->bb_entry->next_bb; bb; bb = bb->next_bb) {
                        if (bb->loop_body_start || (bb->flags & BB_EXCEPTION_HANDLER)) {
@@ -9342,7 +9343,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name)
        for (int i = 0; i < size; i++) {
                LLVMTypeRef lookup_type = NULL;
 
-               lookup_type = g_hash_table_lookup (module->got_idx_to_type, GINT_TO_POINTER (i));
+               lookup_type = (LLVMTypeRef) g_hash_table_lookup (module->got_idx_to_type, GINT_TO_POINTER (i));
 
                if (!lookup_type)
                        lookup_type = module->ptr_type;