172 Commits

Author SHA1 Message Date
r00ster91
d6bd00e855 Zir: move set_cold from Inst.Tag to Inst.Extended
If I could mark a builtin function as cold, I would mark @setCold as cold.
We have run out of `Zir.Inst.Tag`s so I had to move a tag from Zir.Inst.Tag to
Zir.Inst.Extended. This is because a new noreturn builtin will be added and
noreturn builtins cannot be part of Inst.Tag:
```
/// `noreturn` instructions may not go here; they must be part of the main `Tag` enum.
pub const Extended = enum(u16) {
```

Here's another reason I went for @setCold:
```
$ git grep setRuntimeSafety | wc -l
322
$ git grep setCold | wc -l
79
$ git grep setEvalBranchQuota | wc -l
82
```

This also simply removes @setCold from Autodoc and the docs frontend because
as far as I could understand it, builtins represented using Zir extended
instructions are not yet supported because I couldn't find
@setStackAlign or @setFloatMode there, either.
2023-03-03 21:16:21 +01:00
mlugg
705d2a3c2c
Implement new module CLI 2023-02-21 01:59:37 +00:00
Loris Cro
99c11cc8cf
Merge pull request #14544 from der-teufel-programming/autodoc-quickfixes
autodoc: main.js cleanup and formatting
2023-02-20 16:37:41 +01:00
Andrew Kelley
aeaef8c0ff update std lib and compiler sources to new for loop syntax 2023-02-18 19:17:21 -07:00
Veikka Tuominen
7199d7c777 split @qualCast into @constCast and @volatileCast 2023-02-15 01:43:57 +02:00
Krzysztof Wolicki Der Teufel
14bf20daeb autodoc: anonymous struct type indentation fix 2023-02-10 14:32:45 +01:00
Loris Cro
e59ef95a40
Merge pull request #14515 from der-teufel-programming/autodoc-quickfixes
autodoc: Added `@qualCast` builtin function handling
2023-02-03 17:55:31 +01:00
Krzysztof Wolicki Der Teufel
c3abb63fe9 autodoc: Added @qualCast builtin function handling 2023-02-02 14:47:16 +01:00
Krzysztof Wolicki Der Teufel
76fcb95bdf autodoc: Implemented struct_init_empty for walkInstruction, fixed variable type with has_init but no type before = 2023-01-29 14:42:18 +01:00
Der Teufel
e6cab917e1 autodoc: added support for tuple structs 2023-01-25 15:34:04 +01:00
Der Teufel
dd8e16b906 autodoc: Add tag handling to enums and unions. Add support for Struct, Enum, Union types in exprName.
Anonymous types now work via a hack to ast_nodes.
2023-01-24 19:07:25 +01:00
Loris Cro
af820bbb94 autodoc: init support for guides 2023-01-24 18:56:35 +01:00
Loris Cro
35f5d43768 autodoc: add support for top-level doc comments 2023-01-18 19:45:32 +01:00
Loris Cro
b42bd759a7 autodoc: missing fmt on Autodoc.zig 2023-01-16 18:04:31 +01:00
Krzysztof Wolicki
ae69dfe6e7
autodoc: Better handling of variable decls (#14301) 2023-01-16 17:28:07 +01:00
Loris Cro
1878bdfbb1 autodoc: fix bodyless fn type analysis and rendering 2023-01-05 17:12:43 +01:00
Loris Cro
755f50a986 autodoc: restore generic function functionality
latest changes to zir encoding broke simple return type detection
2023-01-03 18:20:06 +01:00
Veikka Tuominen
54160e7f6a Sema: make overflow arithmetic builtins return tuples 2022-12-27 15:13:14 +02:00
r00ster91
aac2d6b56f std.builtin: rename Type.UnionField and Type.StructField's field_type to type 2022-12-17 14:11:33 +01:00
Veikka Tuominen
9d93b2ccf1 Eliminate BoundFn type from the language
Closes #9484
2022-12-09 20:37:18 -07:00
Andrew Kelley
ceb0a632cf std.mem.Allocator: allow shrink to fail
closes #13535
2022-11-29 23:30:38 -07:00
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00:00
Veikka Tuominen
e01ec96288 Autodoc: not all block_inlines contain a break_inline 2022-11-11 18:01:14 +02:00
Loris Cro
d4487b6a2e autodoc: update to new func zir body structure
this is a hack meant to restore functionality for the upcoming release,
a proper analysis of the new zir structure is required to make a robust
change.
2022-10-30 17:17:34 +01:00
Ali Chraghi
ca27055cda all: rename @maximum to @max and @minimum to @min 2022-10-18 14:15:16 +03:00
Ryan Liptak
6ac0d2d9d6 Fix all std lib tests being run for any file within the std package
Before this commit:

```
$ zig test lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib
2170 passed; 37 skipped; 0 failed.
```

After this commit:

```
$ zig test lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib
All 45 tests passed.
```

This matches stage1 behavior:

```
$ zig test -fstage1 lib/std/fs/test.zig --main-pkg-path lib/std --zig-lib-dir lib
All 45 tests passed.
```

All tests are still run if `zig test` is run directly on `lib/std/std.zig`:

```
$ zig test lib/std/std.zig --main-pkg-path lib/std --zig-lib-dir lib
2170 passed; 37 skipped; 0 failed.
```

`zig build test-std` is unaffected by this change.

Closes #12926
2022-10-05 04:21:16 -04:00
Luuk de Gram
9cd521a24f
zig fmt 2022-09-26 19:54:35 +02:00
Der Teufel
55a9db4c9d autodoc: Added .html to generated source view file names 2022-09-26 15:46:01 +02:00
Andrew Kelley
85e3204344 stage2: free up 2 ZIR tags
cmpxchg_weak and cmpxchg_strong are not very common; demote them to
extended operations to make some headroom.

This commit does not change any behavior, only memory layout of the
compiler.
2022-09-21 03:54:37 -04:00
Loris Cro
2698cb346a autodoc: don't collect tests, usingnamespace and comptime blocks
Previously we were collecting as autodoc decls everything that was a ZIR
decl in a rather naive way. Now we only collect decltests as part of the
data relative to the decl they refer to, and ignore everything else.
2022-09-18 20:00:44 +02:00
Andrew Kelley
d3d24874c9 std: remove deprecated API for the upcoming release
See #3811
2022-09-16 14:46:53 -04:00
Andrew Kelley
bec70a1a39 stage2: remove pointless discards from source code
Good riddance!
2022-09-13 02:04:20 -07:00
Loris Cro
2a96f80d03 autodoc: reduce json payload size
this commit removes whitespace and changes Decl, AstNode and Type to be
json arrays instead of json objects. This change reduces json payload
size for the stdlib from 25mb to < 10mb.
2022-09-11 21:35:01 +02:00
Der Teufel
b8001335c4 autodoc: Opaque now handled like other container types 2022-09-04 22:47:58 +02:00
Loris Cro
dbd60e3d29 autodoc: add support for doc tests 2022-09-04 22:45:57 +02:00
Loris Cro
4a08c6dd51 autodoc: fix stage2 compile error 2022-09-02 18:13:17 +02:00
Loris Cro
e72a8ed5a1 autodoc: fix merge mistake 2022-09-02 17:59:37 +02:00
Loris Cro
907c60aaa7
Merge pull request #12705 from der-teufel-programming/autodoc-big-int
Autodoc big_int
2022-09-02 17:48:17 +02:00
Loris Cro
a77d7b740f autodoc: simplify int_big json stringify procedure 2022-09-02 17:47:04 +02:00
Loris Cro
70b96169ae
Merge pull request #12709 from der-teufel-programming/autodoc-compare-operators
autodoc: Compare operators
2022-09-02 17:38:00 +02:00
Loris Cro
081d5a9690 autodoc: correct line number implementation
we also correctly take advantage of the starting byte offset of the
parent decl when calling `tree.tokenLocation()`!
2022-09-02 17:28:12 +02:00
Der Teufel
4c033eb35c autodoc: int_big cleanup 2022-09-02 11:01:46 +02:00
Der Teufel
0d3c6b7aa8 autodoc: Added int_big support 2022-09-02 11:01:46 +02:00
Der Teufel
3bbf08e98a autodoc: Compare operators 2022-09-01 15:17:14 +02:00
Veikka Tuominen
d3b4b2edf1 Sema: shift of comptime int with runtime value
Closes #12290
2022-08-30 12:22:07 -07:00
Loris Cro
e0103704c5 autodoc: better line counting for decls 2022-08-27 22:48:18 +02:00
Loris Cro
b32e5a14ce autodoc: handle self-referential call+field_type instructions 2022-08-23 18:45:22 +02:00
Loris Cro
0482e8ba9d autodoc: initial support for struct_init_anon 2022-08-23 18:37:29 +02:00
Der Teufel
a022157956 autodoc: compileError now uses index into exprs instead of a []const u8 2022-08-21 05:29:39 +02:00
Loris Cro
53e971226d autodoc: minor pr cleanup 2022-08-18 18:02:19 +02:00