aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
AgeCommit message (Collapse)Author
2019-07-23add error for function with ccc indirectly calling async functionAndrew Kelley
2019-07-23inferring async from async callsAndrew Kelley
2019-07-22Merge remote-tracking branch 'origin/master' into rewrite-coroutinesAndrew Kelley
2019-07-22fix multiple coroutines existing clobbering each otherAndrew Kelley
2019-07-22fix usingnamespace analyzing the expression multiple timesAndrew Kelley
2019-07-21implement async function parametersAndrew Kelley
2019-07-21simple async function passing testAndrew Kelley
2019-07-21simple async function call workingAndrew Kelley
2019-07-19remove coroutines implementation and promise typeAndrew Kelley
2019-07-19fix usingnamespaceAndrew Kelley
It used to be that usingnamespace was only allowed at top level. This made it OK to put the state inside the AST node data structure. However, now usingnamespace can occur inside any aggregate data structure, and therefore the state must be in the TopLevelDeclaration rather than in the AST node. There were two other problems with the usingnamespace implementation: * It was passing the wrong destination ScopeDecl, so it could cause an incorrect error such as "import of file outside package path". * When doing `usingnamespace` on a file that already had `pub usingnamespace` in it would "steal" the usingnamespace, causing incorrect "use of undeclared identifier" errors in the target file. closes #2632 closes #2580
2019-07-16rename internal names regarding `usingnamespace`Andrew Kelley
2019-06-29fix stack escape in add_source_file()Michael Dusan
2019-06-26Merge remote-tracking branch 'origin/master' into copy-elision-3Andrew Kelley
2019-06-25fix union init with void payloadAndrew Kelley
all std lib tests passing now
2019-06-22stage1: add @sin @cos @exp @exp2 @ln @log2 @log10 @fabs @floor @ceil @trunc ↵Shawn Landden
@round and expand @sqrt This revealed that the accuracy of ln is not as good as the current algorithm in musl and glibc, and should be ported again. v2: actually include tests v3: fix reversal of in and out arguments on f128M_sqrt() add test for @sqrt on comptime_float do not include @nearbyInt() until it works on all targets.
2019-06-21fix implicit cast to optional to error union to return result locAndrew Kelley
2019-06-21stage1: update fn_key_eql() for @mulAdd() on vectorsShawn Landden
2019-06-19fix comptime modification of const struct fieldAndrew Kelley
2019-06-19stage1: add support for @mulAdd fused-multiply-add for floats and vectors of ↵Shawn Landden
floats Not all of the softfloat library is being built.... Vector support is very buggy at the moment, but should work when the bugs are fixed. (as I had the same code working with another vector function, that hasn't been merged yet).
2019-06-17inferred comptime values rather than elided scopesAndrew Kelley
because of this example: ```zig export fn entry(b: bool) usize { var runtime = [1]i32{3}; comptime var i: usize = 0; inline while (i < 2) : (i += 1) { const result = if (i == 0) [1]i32{2} else runtime; } comptime { return i; } } ``` The problem is that the concept of "resetting" a result location, introduced in the previous commit, cannot handle elision scopes. This concept is inherently broken with inline loops.
2019-06-15Merge remote-tracking branch 'origin/master' into copy-elision-3Andrew Kelley
2019-06-14fix `@export` for arrays not respecting the symbol nameAndrew Kelley
Previously, the symbol name parameter of `@export` would be ignored for variables, and the variable name would be used for the symbol name. Now it works as expected. See #2679
2019-06-14fix `@export` for arrays and allow sections on extern variablesAndrew Kelley
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.
2019-06-11fix comptime function callsAndrew Kelley
2019-06-09Merge remote-tracking branch 'origin/master' into copy-elision-3Andrew Kelley
2019-06-09different array literal syntax when inferring the sizeAndrew Kelley
old syntax: []i32{1, 2, 3} new syntax: [_]i32{1, 2, 3} closes #1797
2019-06-08result location mechanism for struct initializationAndrew Kelley
```zig export fn entry() void { const static = Foo{ .x = 9, .bar = Bar{ .y = 10 }, }; const runtime = foo(true); } fn foo(c: bool) Foo { return Foo{ .x = 12, .bar = if (c) bar1() else bar2(), }; } fn bar1() Bar { return Bar{ .y = 34 }; } fn bar2() Bar { return Bar{ .y = 56 }; } ``` ```llvm @0 = internal unnamed_addr constant %Foo { i32 9, %Bar { i32 10 } }, align 4 @1 = internal unnamed_addr constant %Bar { i32 34 }, align 4 @2 = internal unnamed_addr constant %Bar { i32 56 }, align 4 define void @entry() #2 !dbg !35 { Entry: %runtime = alloca %Foo, align 4 call void @llvm.dbg.declare(metadata %Foo* @0, metadata !39, metadata !DIExpression()), !dbg !50 call fastcc void @foo(%Foo* sret %runtime, i1 true), !dbg !51 call void @llvm.dbg.declare(metadata %Foo* %runtime, metadata !49, metadata !DIExpression()), !dbg !52 ret void, !dbg !53 } define internal fastcc void @foo(%Foo* nonnull sret, i1) unnamed_addr #2 !dbg !54 { Entry: %c = alloca i1, align 1 store i1 %1, i1* %c, align 1 call void @llvm.dbg.declare(metadata i1* %c, metadata !60, metadata !DIExpression()), !dbg !61 %2 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 0, !dbg !62 store i32 12, i32* %2, align 4, !dbg !62 %3 = getelementptr inbounds %Foo, %Foo* %0, i32 0, i32 1, !dbg !64 %4 = load i1, i1* %c, align 1, !dbg !65 br i1 %4, label %Then, label %Else, !dbg !65 Then: ; preds = %Entry call fastcc void @bar1(%Bar* sret %3), !dbg !66 br label %EndIf, !dbg !64 Else: ; preds = %Entry call fastcc void @bar2(%Bar* sret %3), !dbg !67 br label %EndIf, !dbg !64 EndIf: ; preds = %Else, %Then ret void, !dbg !68 } define internal fastcc void @bar1(%Bar* nonnull sret) unnamed_addr #2 !dbg !69 { Entry: %1 = bitcast %Bar* %0 to i8*, !dbg !73 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @1 to i8*), i64 4, i1 false), !dbg !73 ret void, !dbg !73 } define internal fastcc void @bar2(%Bar* nonnull sret) unnamed_addr #2 !dbg !75 { Entry: %1 = bitcast %Bar* %0 to i8*, !dbg !76 call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %1, i8* align 4 bitcast (%Bar* @2 to i8*), i64 4, i1 false), !dbg !76 ret void, !dbg !76 } !39 = !DILocalVariable(name: "static", scope: !40, file: !5, line: 2, type: !41) !49 = !DILocalVariable(name: "runtime", scope: !40, file: !5, line: 6, type: !41) ```
2019-06-08hook up result locs for `try`Andrew Kelley
2019-06-04Propagate DIFlags to LLVMLemonBoy
2019-05-31no-copy semantics for function forwardingAndrew Kelley
```zig fn foo() Foo { return bar(); } ``` ```llvm define internal fastcc void @foo(%Foo* nonnull sret) unnamed_addr #2 !dbg !48 { Entry: call fastcc void @bar(%Foo* sret %0), !dbg !52 ret void, !dbg !54 } ```
2019-05-30default struct field initialization expressionsAndrew Kelley
closes #485
2019-05-29cleanups for windows subsystem in builtin.zigAndrew Kelley
2019-05-29`use` works on unions and enums in addition to structsAndrew Kelley
2019-05-29Merge branch 'use-struct-pt2' of https://github.com/LemonBoy/zig into ↵Andrew Kelley
LemonBoy-use-struct-pt2
2019-05-28Reject undefined as typeLemonBoy
Make analyze_type_expr behave like ir_resolve_type when the user tries to use `undefined` as a type. Closes #2436
2019-05-28Avoid a crash when there are no namespace componentsLemonBoy
Fixes #2500
2019-05-27respect subsystem flag in all casesemekoi
2019-05-24Reject slices in use expressionsLemonBoy
Co-Authored-By: emekoi <emekankurumeh@outlook.com>
2019-05-21Make use work with arbitrary structsLemonBoy
2019-05-19Use the correct scope for `use`LemonBoy
use expressions outside the top-level scope now work as intended.
2019-05-11Amend the error messagesLemonBoy
2019-05-11Change the enum value allocation strategyLemonBoy
2019-05-11amend type_is_valid_extern_enum_tagLemonBoy
2019-05-11Support signed types as enum tagsLemonBoy
2019-05-11Validate enum tag for extern enumLemonBoy
The C specification mandates the enum to be compatible with signed char, signed int or unsigned int.
2019-05-09stage1: make some asserts print source locationAndrew Kelley
2019-04-26clean up test outputAndrew Kelley
After 4df2f3d74f test names have the word "test" in them so the redundant word is removed from test runner. Also move the prefix/suffix to where it logically belongs in the fully qualified symbol name.
2019-04-26Change symbol name of tests in codegenrylmovuk
Tests now have the symbol name of the format `test "<name>"` in order to be more easily distinguished from functions with similar names. See issue #2267.
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-24remove Shebang (#!) supportShawn Landden
Closes: #2165