From 80cd142c96c421b50f26a7227066530a2a5d5978 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 4 Jun 2019 09:05:33 +0200 Subject: Propagate DIFlags to LLVM --- src/zig_llvm.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/zig_llvm.cpp') diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp index c825ed3896..fe1b279cf0 100644 --- a/src/zig_llvm.cpp +++ b/src/zig_llvm.cpp @@ -318,12 +318,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugMemberType(ZigLLVMDIBuilder *dibuilder, ZigLLVM const char *name, ZigLLVMDIFile *file, unsigned line, uint64_t size_in_bits, uint64_t align_in_bits, uint64_t offset_in_bits, unsigned flags, ZigLLVMDIType *type) { - assert(flags == 0); DIType *di_type = reinterpret_cast(dibuilder)->createMemberType( reinterpret_cast(scope), name, reinterpret_cast(file), - line, size_in_bits, align_in_bits, offset_in_bits, DINode::FlagZero, + line, size_in_bits, align_in_bits, offset_in_bits, + static_cast(flags), reinterpret_cast(type)); return reinterpret_cast(di_type); } @@ -338,12 +338,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugUnionType(ZigLLVMDIBuilder *dibuilder, ZigLLVMD DIType *ditype = reinterpret_cast(types_array[i]); fields.push_back(ditype); } - assert(flags == 0); DIType *di_type = reinterpret_cast(dibuilder)->createUnionType( reinterpret_cast(scope), name, reinterpret_cast(file), - line_number, size_in_bits, align_in_bits, DINode::FlagZero, + line_number, size_in_bits, align_in_bits, + static_cast(flags), reinterpret_cast(dibuilder)->getOrCreateArray(fields), run_time_lang, unique_id); return reinterpret_cast(di_type); @@ -360,12 +360,12 @@ ZigLLVMDIType *ZigLLVMCreateDebugStructType(ZigLLVMDIBuilder *dibuilder, ZigLLVM DIType *ditype = reinterpret_cast(types_array[i]); fields.push_back(ditype); } - assert(flags == 0); DIType *di_type = reinterpret_cast(dibuilder)->createStructType( reinterpret_cast(scope), name, reinterpret_cast(file), - line_number, size_in_bits, align_in_bits, DINode::FlagZero, + line_number, size_in_bits, align_in_bits, + static_cast(flags), reinterpret_cast(derived_from), reinterpret_cast(dibuilder)->getOrCreateArray(fields), run_time_lang, @@ -426,11 +426,10 @@ ZigLLVMDIType *ZigLLVMCreateSubroutineType(ZigLLVMDIBuilder *dibuilder_wrapped, DIType *ditype = reinterpret_cast(types_array[i]); types.push_back(ditype); } - assert(flags == 0); DIBuilder *dibuilder = reinterpret_cast(dibuilder_wrapped); DISubroutineType *subroutine_type = dibuilder->createSubroutineType( dibuilder->getOrCreateTypeArray(types), - DINode::FlagZero); + static_cast(flags)); DIType *ditype = subroutine_type; return reinterpret_cast(ditype); } @@ -516,7 +515,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, ZigLLVMDIType *type, bool always_preserve, unsigned flags) { - assert(flags == 0); DILocalVariable *result = reinterpret_cast(dbuilder)->createAutoVariable( reinterpret_cast(scope), name, @@ -524,7 +522,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateAutoVariable(ZigLLVMDIBuilder *dbuilder, line_no, reinterpret_cast(type), always_preserve, - DINode::FlagZero); + static_cast(flags)); return reinterpret_cast(result); } @@ -547,7 +545,6 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde ZigLLVMDIScope *scope, const char *name, ZigLLVMDIFile *file, unsigned line_no, ZigLLVMDIType *type, bool always_preserve, unsigned flags, unsigned arg_no) { - assert(flags == 0); assert(arg_no != 0); DILocalVariable *result = reinterpret_cast(dbuilder)->createParameterVariable( reinterpret_cast(scope), @@ -557,7 +554,7 @@ ZigLLVMDILocalVariable *ZigLLVMCreateParameterVariable(ZigLLVMDIBuilder *dbuilde line_no, reinterpret_cast(type), always_preserve, - DINode::FlagZero); + static_cast(flags)); return reinterpret_cast(result); } @@ -612,7 +609,6 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD unsigned flags, bool is_optimized, ZigLLVMDISubprogram *decl_subprogram) { DISubroutineType *di_sub_type = static_cast(reinterpret_cast(fn_di_type)); - assert(flags == 0); DISubprogram *result = reinterpret_cast(dibuilder)->createFunction( reinterpret_cast(scope), name, linkage_name, @@ -620,7 +616,7 @@ ZigLLVMDISubprogram *ZigLLVMCreateFunction(ZigLLVMDIBuilder *dibuilder, ZigLLVMD lineno, di_sub_type, scope_line, - DINode::FlagStaticMember, + static_cast(flags), DISubprogram::toSPFlags(is_local_to_unit, is_definition, is_optimized), nullptr, reinterpret_cast(decl_subprogram), -- cgit v1.2.3