diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-24 20:28:46 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-24 20:28:46 -0500 |
| commit | 34b1ebefaab2e8f5c322bc96388bb4fefec31027 (patch) | |
| tree | d2a9909de0a9e19c495fcaaccfaa2c31f5f9169b /src | |
| parent | b9f88c3552c0ac892aa6dba7ed8518a0aee51305 (diff) | |
| parent | 8309b6188d849c5d4c27c086b7759566d9f86716 (diff) | |
| download | zig-34b1ebefaab2e8f5c322bc96388bb4fefec31027.tar.gz zig-34b1ebefaab2e8f5c322bc96388bb4fefec31027.zip | |
Merge remote-tracking branch 'origin/master' into null-terminated-pointers
Diffstat (limited to 'src')
| -rw-r--r-- | src/analyze.cpp | 2 | ||||
| -rw-r--r-- | src/codegen.cpp | 2 | ||||
| -rw-r--r-- | src/ir.cpp | 20 | ||||
| -rw-r--r-- | src/range_set.cpp | 3 | ||||
| -rw-r--r-- | src/zig_llvm.h | 2 |
5 files changed, 16 insertions, 13 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index c41f5b652e..cd00e4d301 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2015 Andrew Kelley * * This file is part of zig, which is MIT licensed. diff --git a/src/codegen.cpp b/src/codegen.cpp index 3e2744efc6..6f68bad322 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7740,7 +7740,7 @@ static void do_code_gen(CodeGen *g) { char *error = nullptr; if (LLVMVerifyModule(g->module, LLVMReturnStatusAction, &error)) { - zig_panic("broken LLVM module found: %s", error); + zig_panic("broken LLVM module found: %s\nThis is a bug in the Zig compiler.", error); } } diff --git a/src/ir.cpp b/src/ir.cpp index e0f53094d0..017f6b489f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13873,16 +13873,6 @@ static IrInstruction *ir_analyze_instruction_return(IrAnalyze *ira, IrInstructio if (type_is_invalid(operand->value.type)) return ir_unreach_error(ira); - if (!instr_is_comptime(operand) && ira->explicit_return_type != nullptr && - handle_is_ptr(ira->explicit_return_type)) - { - // result location mechanism took care of it. - IrInstruction *result = ir_build_return(&ira->new_irb, instruction->base.scope, - instruction->base.source_node, nullptr); - result->value.type = ira->codegen->builtin_types.entry_unreachable; - return ir_finish_anal(ira, result); - } - IrInstruction *casted_operand = ir_implicit_cast(ira, operand, ira->explicit_return_type); if (type_is_invalid(casted_operand->value.type)) { AstNode *source_node = ira->explicit_return_type_source_node; @@ -13894,6 +13884,16 @@ static IrInstruction *ir_analyze_instruction_return(IrAnalyze *ira, IrInstructio return ir_unreach_error(ira); } + if (!instr_is_comptime(operand) && ira->explicit_return_type != nullptr && + handle_is_ptr(ira->explicit_return_type)) + { + // result location mechanism took care of it. + IrInstruction *result = ir_build_return(&ira->new_irb, instruction->base.scope, + instruction->base.source_node, nullptr); + result->value.type = ira->codegen->builtin_types.entry_unreachable; + return ir_finish_anal(ira, result); + } + if (casted_operand->value.special == ConstValSpecialRuntime && casted_operand->value.type->id == ZigTypeIdPointer && casted_operand->value.data.rh_ptr == RuntimeHintPtrStack) diff --git a/src/range_set.cpp b/src/range_set.cpp index fd0076191b..9e621d2f13 100644 --- a/src/range_set.cpp +++ b/src/range_set.cpp @@ -40,6 +40,9 @@ void rangeset_sort(RangeSet *rs) { } bool rangeset_spans(RangeSet *rs, BigInt *first, BigInt *last) { + if (rs->src_range_list.length == 0) + return false; + rangeset_sort(rs); const Range *first_range = &rs->src_range_list.at(0).range; diff --git a/src/zig_llvm.h b/src/zig_llvm.h index a3043b7e25..ebc3c1a00d 100644 --- a/src/zig_llvm.h +++ b/src/zig_llvm.h @@ -465,7 +465,7 @@ ZIG_EXTERN_C bool ZigLLDLink(enum ZigLLVM_ObjectFormatType oformat, const char * ZIG_EXTERN_C bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size_t file_name_count, enum ZigLLVM_OSType os_type); -bool ZigLLVMWriteImportLibrary(const char *def_path, const ZigLLVM_ArchType arch, +bool ZigLLVMWriteImportLibrary(const char *def_path, const enum ZigLLVM_ArchType arch, const char *output_lib_path, const bool kill_at); ZIG_EXTERN_C void ZigLLVMGetNativeTarget(enum ZigLLVM_ArchType *arch_type, enum ZigLLVM_SubArchType *sub_arch_type, |
