Commit Graph

1972 Commits

Author SHA1 Message Date
Andrew Kelley cbb3f1d76c ir: consistent error checking for br and cond_br instructions 2018-09-04 16:58:19 -04:00
Andrew Kelley 68db9d5074 add compile error for comptime control flow inside runtime block
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley 36828a2e6a fix incorrect variable ref count
regression introduced by e82cd53df4
2018-09-04 12:50:02 -04:00
Andrew Kelley ff4591f0e6 fix llvm assertion when adding callsite sret attr 2018-09-04 12:15:15 -04:00
Andrew Kelley bc88ef2dc3 compile errors for unimplemented minValue/maxValue builtins 2018-09-03 22:47:23 -04:00
Andrew Kelley e82cd53df4 fix incorrect value for inline loop
09cc1dc660 failed to handle mem_slot_index correctly

closes #1436
2018-09-03 21:24:20 -04:00
Andrew Kelley a11e73bee2 compile error instead of segfault for unimplemented feature
closes #1103
2018-09-03 12:38:24 -04:00
Andrew Kelley 2a9329c998 better anonymous struct naming
this makes anonymous structs inherit the name of the function they are in
only when they are the return expression.

also document the behavior and provide examples.

closes #1243
2018-09-03 11:32:39 -04:00
Andrew Kelley 95636c7e5f ability to @ptrCast to *void
fixes #960
2018-09-03 00:04:12 -04:00
Andrew Kelley d5968086fe use the sret attribute at the callsite when appropriate
Thanks to Shawn Landden for the original pull request.

closes #1450
2018-09-02 21:08:59 -04:00
kristopher tate 9e6f53dd58 i#1438: src/windows_sdk.cpp: fix version guard in find_81_version; 2018-09-01 12:02:21 +09:00
kristopher tate d4474e195e i#1438: src/windows_sdk.cpp: fix version guard in find_10_version; 2018-09-01 12:02:04 +09:00
Jimmi Holst Christensen e036f65ac0 Translate-c: Check for error before working on while loop body (#1445) 2018-08-31 23:17:17 +02:00
Andrew Kelley 901b5c1566 add compile error for function prototype with no body
closes #1231
2018-08-28 15:39:32 -04:00
Andrew Kelley 09cc1dc660 fix crash when var in inline loop has different types
closes #917
closes #845
closes #741
closes #740
2018-08-28 15:24:28 -04:00
Andrew Kelley 45d9d9f953 minor fixups 2018-08-27 18:31:28 -04:00
raulgrell e2a9f2ef98 Allow implicit cast from *T and [*]T to ?*c_void 2018-08-27 23:13:57 +01:00
Andrew Kelley 009e90f446 fix @typeInfo unable to distinguish compile error vs no-payload
closes #1421
closes #1426
2018-08-27 17:13:34 -04:00
Andrew Kelley 2f2215c9f4 this was intended to be included in the previous commit 2018-08-27 16:26:36 -04:00
Andrew Kelley 526d8425ab fix false negative determining if function is generic
This solves the smaller test case of #1421 but the
other test case is still an assertion failure.
2018-08-27 16:14:48 -04:00
Andrew Kelley 68e2794e15 ir: const_ptr_pointee asserts that its return value is non-null 2018-08-26 13:13:26 -04:00
Andrew Kelley 6a3fad1d59 Revert "src/ir.cpp: check return value of const_ptr_pointee to protect against dereferencing null pointers;"
This reverts commit 0839ed1f94.

I realized too late there is a better fix. See PR #1419
2018-08-26 13:04:58 -04:00
kristopher tate 0839ed1f94 src/ir.cpp: check return value of const_ptr_pointee to protect against dereferencing null pointers; 2018-08-26 13:02:09 -04:00
Andrew Kelley 8047f0eae2 fix llvm assertion failure when building std lib tests for macos
closes #1417
2018-08-26 02:36:18 -04:00
Andrew Kelley 815950996d Merge remote-tracking branch 'origin/master' into macos-stack-traces 2018-08-25 04:48:58 -04:00
Andrew Kelley 02f5a9fa62 fix handling multiple extern vars with the same name 2018-08-25 03:55:59 -04:00
Andrew Kelley b95ff12f2f fix regressions 2018-08-25 03:40:47 -04:00
Andrew Kelley ac36f98e72 fix stack traces on linux 2018-08-25 03:07:37 -04:00
Marc Tiehuis 05f9b14fc2 Fix builtin alignment type
Closes #1235.
2018-08-24 17:57:17 +12:00
Andrew Kelley 3a02ba9b82 fix error message for incorrect panic handler fn signature
closes #1353
2018-08-23 23:22:48 -04:00
Marc Tiehuis 353419f82d Default to strict IEEE floating point
Closes #1227.
2018-08-23 22:54:46 +12:00
Andrew Kelley 4b68ef45af fix incorrectly generating an unused const fn global
closes #1277
2018-08-22 14:31:30 -04:00
Andrew Kelley 5aeb3217ee fixup for previous commit 2018-08-22 14:24:48 -04:00
Raul Leal 87b10400c2 allow implicit cast from *[N]T to ?[*]T (#1398)
* allow implicit cast from *[N]T to ?[*]T
2018-08-22 13:12:08 -04:00
Andrew Kelley b2917e6be0 Revert "Merge branch 'mtn-translate-c-enum-vals'"
This reverts commit 937b822fa9, reversing
changes made to dd4b13ac03.

Tests failing on Windows.

Re-opens #1360
2018-08-21 20:50:03 -04:00
kristopher tate b023db2e82 src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;
ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.

test/translate_c.zig: enum: add wider range of values (u64) to try;
2018-08-20 22:46:11 -04:00
Michael Noronha 7e7e59d881 translate-c: Correctly translate enum init values, addressing #1360 2018-08-20 22:45:19 -04:00
Andrew Kelley dd4b13ac03 Revert "translate-c: Correctly translate enum init values, addressing #1360 (#1377)"
This reverts commit b8ce8f219c.

Squashing the commits from the pull request resulted in kristopher tate
from being omitted from the authors. A future commit will merge
the code correctly.
2018-08-20 22:39:39 -04:00
Michael Noronha b8ce8f219c translate-c: Correctly translate enum init values, addressing #1360 (#1377)
* translate-c: Correctly translate enum init values

* translate-c: Test enum initialization

* translate-c: Flip to positive using APSInt builtins

* src/translate_c.cpp: correctly bridge llvm::APSInt with Zig BigInt;

ACHTUNG: llvm::APSInt stores an int's sign inside of its getRawData; Internally to Zig we store an integer's sign outside of getRawData! (~aps_int) calls .flip() internally on the raw data to match Zig.

* test/translate_c.zig: enum: add wider range of values (u64) to try;

closes #1360
2018-08-20 14:29:26 -04:00
Wink Saville d927f347de Fix ir_analyze_instruction_atomic_rmw (#1351)
There were two tests of type_is_valid(casted_ptr->value.type) change the
second one to type_is_valie(casted_operand->value.type).
2018-08-07 23:18:26 -04:00
Andrew Kelley 63a23e848a translate-c: fix for loops with var init and empty body 2018-08-05 18:40:14 -04:00
Andrew Kelley 387fab60a6 translate-c: fix do while with empty body 2018-08-05 18:32:38 -04:00
Andrew Kelley c420b234cc translate-c: handle for loop with empty body 2018-08-05 18:18:24 -04:00
Andrew Kelley aa232089f2 translate-c: fix while loop with no body 2018-08-05 18:06:39 -04:00
Andrew Kelley 9bd8b01650 fix tagged union initialization with a runtime void
closes #1328
2018-08-03 15:21:08 -04:00
kristopher tate 298abbcff8 better support for _ identifier
* disallow variable declaration of `_`
 * prevent `_` from shadowing itself
 * prevent read access of `_`

closes #1204
closes #1320
2018-08-03 02:57:17 -04:00
Andrew Kelley 895f262a55 pull request fixups
* clean up parser code
 * fix stage2 parse and render code
 * remove redundant test
 * make stage1 compile tests leaner
2018-08-02 14:15:31 -04:00
kristopher tate 5de92425d5 src/parser.cpp: fix typo from rebase; 2018-08-02 17:11:37 +09:00
kristopher tate d3f628907a src/parser.cpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:59:11 +09:00
kristopher tate b3cd65d56e src/ir.cpp: remove promise_symbol from suspend;
Tracking Issue #1296 ;
2018-08-02 16:50:08 +09:00