aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-14 15:20:52 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-14 15:28:52 -0400
commit42ea2d0d1c3b8cafdfc9a383cbb1bab274eb0140 (patch)
treeb4cda1880f432c47c228747c356200b01604bafb /src/ir.cpp
parent9e8db5b7505a6c2e601c8a94b9d8a4282b5df184 (diff)
downloadzig-42ea2d0d1c3b8cafdfc9a383cbb1bab274eb0140.tar.gz
zig-42ea2d0d1c3b8cafdfc9a383cbb1bab274eb0140.zip
fix `@export` for arrays and allow sections on extern variables
previously `@export` for an array would panic with a TODO message. now it will do the export. However, it uses the variable's name rather than the name passed to `@export`. Issue #2679 remains open for that problem.
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 21d2646c3e..a1227fbd93 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -13901,6 +13901,15 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio
want_var_export = true;
}
break;
+ case ZigTypeIdArray:
+ if (!type_allowed_in_extern(ira->codegen, target->value.type->data.array.child_type)) {
+ ir_add_error(ira, target,
+ buf_sprintf("array element type '%s' not extern-compatible",
+ buf_ptr(&target->value.type->data.array.child_type->name)));
+ } else {
+ want_var_export = true;
+ }
+ break;
case ZigTypeIdMetaType: {
ZigType *type_value = target->value.data.x_type;
switch (type_value->id) {
@@ -13968,7 +13977,6 @@ static IrInstruction *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructio
case ZigTypeIdInt:
case ZigTypeIdFloat:
case ZigTypeIdPointer:
- case ZigTypeIdArray:
case ZigTypeIdComptimeFloat:
case ZigTypeIdComptimeInt:
case ZigTypeIdUndefined: