Commit Graph

2426 Commits (49c3922037ef0b913466e707d85a4e085f6e9716)

Author SHA1 Message Date
Andrew Kelley 7567448b91 codegen for cancel
See #727
2018-02-25 14:47:58 -05:00
Andrew Kelley 05bf666eb6 codegen for calling an async function
See #727
2018-02-25 02:47:31 -05:00
Marc Tiehuis 08d595b472 Add utf8 string view 2018-02-24 11:32:01 -07:00
Andrew Kelley 8db7a1420f update errors section of docs
closes #768
2018-02-23 20:43:47 -05:00
Andrew Kelley 4955c4b8f9 update C headers to clang 6.0.0rc3 2018-02-23 13:15:16 -05:00
Andrew Kelley 1ba6e1641a LLD patch: workaround for buggy MACH-O code
This reapplies 1a1414fc42
to the embedded LLD.
2018-02-23 13:05:17 -05:00
Andrew Kelley a33b689f2c update embedded LLD to 6.0.0rc3 2018-02-23 13:04:47 -05:00
Andrew Kelley 9cfd7dea19 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-23 12:56:41 -05:00
Andrew Kelley 78bc62fd34 Revert "workaround on windows for llvm6 missing advapi32.lib in llvm-config"
This reverts commit eaac218d59.

This is fixed now in llvm6 rc3
2018-02-23 12:55:58 -05:00
Andrew Kelley 40dbcd09da fix type_is_codegen_pointer being used incorrectly
The names of these functions should probably change, but at least
the semantics are correct now:
 * type_is_codegen_pointer - the type is either a fn, ptr, or promise
 * get_codegen_ptr_type -
   - ?&T and &T returns &T
   - ?promise and promise returns promise
   - ?fn()void and fn()void returns fn()void
   - otherwise returns nullptr
2018-02-23 12:49:21 -05:00
Ben Noordhuis f11b948019 allow implicit cast from `S` to `?&const S`
Allow implicit casts from container types to nullable const pointers to
said container type.  That is:

    fn f() void {
        const s = S {};
        g(s);   // Works.
        g(&s);  // So does this.
    }

    fn g(_: ?&const S) void {  // Nullable const pointer.
    }

Fixes #731.
2018-02-23 15:55:57 +01:00
Andrew Kelley 99985ad6fc implement Zig IR for async functions
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley b66547e98c
Merge pull request #783 from bnoordhuis/fix675
name types inside functions after variable
2018-02-22 14:26:45 -05:00
Ben Noordhuis 0845cbe277 name types inside functions after variable
Before this commit:

    fn f() []const u8 {
        const S = struct {};
        return @typeName(S);  // "f()", unexpected.
    }

And now:

    fn f() []const u8 {
        const S = struct {};
        return @typeName(S);  // "S", expected.
    }

Fixes #675.
2018-02-22 19:54:02 +01:00
Andrew Kelley ca1b77b2d5 IR analysis for coro.begin
See #727
2018-02-22 11:54:27 -05:00
Andrew Kelley 88e7b9bf80 ir analysis for coro_id and coro_alloc
See #727
2018-02-22 09:36:58 -05:00
Andrew Kelley 37c07d4f3f coroutines: analyze get_implicit_allocator instruction
see #727
2018-02-22 09:30:55 -05:00
Andrew Kelley b261da0672 add coroutine startup IR to async functions
See #727
2018-02-21 23:28:35 -05:00
Andrew Kelley 884b5fb4cf Merge branch 'bnoordhuis-macho' 2018-02-21 02:00:52 -05:00
Andrew Kelley 623466762e clean up mach-o stack trace code 2018-02-21 02:00:33 -05:00
Andrew Kelley 236bbe1183 implement IR analysis for async function calls
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley 65a51b401c add promise type
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley a06f3c74fd parse async fn definitions
See #727
2018-02-20 00:31:52 -05:00
Andrew Kelley 3d58d7232a parse async fn calls and cancel expressions 2018-02-20 00:05:38 -05:00
Andrew Kelley af10b0fec2 add async, await, suspend, resume, cancel keywords
See #727
2018-02-19 23:19:59 -05:00
Ben Noordhuis 2b35615ffb fix memory leak in std.debug.openSelfDebugInfo() 2018-02-19 23:11:11 +01:00
Ben Noordhuis ab48934e9c add support for stack traces on macosx
Add basic address->symbol resolution support.  Uses symtab data from the
MachO image, not external dSYM data; that's left as a future exercise.

The net effect is that we can now map addresses to function names but
not much more.  File names and line number data will have to wait until
a future pull request.

Partially fixes #434.
2018-02-19 23:11:11 +01:00
Andrew Kelley bde15cf080 improve std lib linux epoll API 2018-02-17 17:53:07 -05:00
Andrew Kelley 72ca2b214d ability to slice an undefined pointer at compile time if the len is 0 2018-02-16 15:22:29 -05:00
Andrew Kelley cbbd6cfa1e add an assert to catch #777
asserting is better than segfaulting
2018-02-15 23:39:35 -05:00
Andrew Kelley 5f5880979e zig fmt supports simple line comments 2018-02-15 12:30:29 -05:00
Andrew Kelley cc26148ba7 fix compiler crash when struct contains...
ptr to another struct which contains original struct
2018-02-15 12:14:20 -05:00
Andrew Kelley 1c1c0691cc fix crash when doing comptime float rem comptime int
closes #776
2018-02-14 23:12:51 -05:00
Andrew Kelley ca597e2bfb std.zig.parser understands try. zig fmt respects a double line break. 2018-02-14 23:00:53 -05:00
Andrew Kelley 9fa35adbd4 fix sometimes not type checking function parameters
closes #774

regression introduced in cfb2c67692
2018-02-14 16:24:43 -05:00
Andrew Kelley 629f134d38 std.zig.parser understands inferred return type and error inference 2018-02-14 15:50:40 -05:00
Andrew Kelley e8d81c5acf fix build broken by previous commit 2018-02-14 13:55:06 -05:00
Andrew Kelley d790670f4c self hosted parser: support string literals 2018-02-14 13:43:05 -05:00
Andrew Kelley 1a53c648ed self hosted parser supports builtin fn call with no args 2018-02-14 09:45:10 -05:00
Andrew Kelley e7ab2bc553 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-13 11:53:20 -05:00
Andrew Kelley c721354b73 correct doc comment in self hosted parser 2018-02-13 11:17:26 -05:00
Andrew Kelley 02f70cda8a zig_llvm.cpp uses new(std::nothrow)
This fixes a mismatched malloc/delete because
we were allocating with malloc and then llvm was
freeing with delete.
2018-02-13 10:54:46 -05:00
Andrew Kelley 2dcff95bd2 self hosted: add tokenizer test fix eof handling 2018-02-13 10:28:55 -05:00
Andrew Kelley dfbb8254ca fix self hosted tokenizer handling of EOF 2018-02-12 21:26:15 -05:00
Andrew Kelley 7903a758a4 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-12 17:00:02 -05:00
Andrew Kelley b4e44c4e80 self hosted parser tests every combination of memory allocation failure 2018-02-12 13:31:50 -05:00
Andrew Kelley eaac218d59 workaround on windows for llvm6 missing advapi32.lib in llvm-config 2018-02-12 11:05:28 -05:00
Andrew Kelley 491d818f17 Merge remote-tracking branch 'origin/master' into llvm6 2018-02-12 10:48:02 -05:00
Andrew Kelley ec0846a00f std.heap.ArenaAllocator: fix incorrectly activating safety check 2018-02-12 03:21:18 -05:00
Andrew Kelley 227ead54be back to malloc instead of aligned_alloc for c_allocator
it seems that a 7 years old standard is still too new for the
libc variants that are ubiquitous

(tests failing on macos for not providing C11 ABI)
2018-02-12 03:15:12 -05:00