142 Commits

Author SHA1 Message Date
Timon Kruiper
0ed04aac8b stage2: fix building self-hosted compiler with -Dstatic-llvm
This supersedes c81ae52ee0b2e952f8ed9c5c6517af8182bb09c1
2021-01-03 17:23:30 +01:00
Andrew Kelley
79a5151155 Revert "stage2: fix compilation of self-hosted compiler with -Denable-llvm"
This broke compiling with -Dstage1 on Windows, because it added the
cpp_source_files to the compilation multiple times.

This reverts commit c81ae52ee0b2e952f8ed9c5c6517af8182bb09c1.
2020-12-28 22:41:29 -08:00
Timon Kruiper
c81ae52ee0 stage2: fix compilation of self-hosted compiler with -Denable-llvm 2020-12-28 21:15:13 +01:00
Jakub Konka
1c40a4df09 Update zig_llvm.cpp and other bits
Include updates to corresponding zig sources

llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6
2020-12-16 18:13:58 +01:00
Andrew Kelley
5a65caa2a3 ability to build stage1 using only a zig tarball
The main idea here is that there are now 2 ways to get a stage1 zig
binary:

 * The cmake path. Requirements: cmake, system C++ compiler, system
   LLVM, LLD, Clang libraries, compiled by the system C++ compiler.

 * The zig path. Requirements: a zig installation, system LLVM, LLD,
   Clang libraries, compiled by the zig installation.

Note that the former can be used to now take the latter path.

Removed config.h.in and config.zig.in. The build.zig script no longer is
coupled to the cmake script.

cmake no longer tries to determine the zig version. A build with cmake
will yield a stage1 zig binary that reports 0.0.0+zig0. This is going to
get reverted.

`zig build` now accepts `-Dstage1` which will build the stage1 compiler,
and put the stage2 backend behind a feature flag.

build.zig is simplified to only support the use case of enabling LLVM
support when the LLVM, LLD, and Clang libraries were built by zig. This
part is probably sadly going to have to get reverted to make package
maintainers happy.

Zig build system addBuildOption supports a couple new types.

The biggest reason to make this change is that the zig path is an
attractive option for doing compiler development work on Windows. It
allows people to work on the compiler without having MSVC installed,
using only a .zip file that contains Zig + LLVM/LLD/Clang libraries.
2020-12-07 17:27:09 -07:00
Andrew Kelley
e1ca6946be rename ZigClangFloatingLiteral_getValueAsApproximateDouble 2020-10-27 14:16:43 -07:00
Andrew Kelley
8b7539bd95 Merge remote-tracking branch 'origin/master' into llvm11
Conflicts:
  src/clang.zig

Master branch renamed an enum; this branch gave it an explicit tag type
and explicitly initialized values. This commit combines the changes
together.
2020-10-08 15:47:45 -07:00
Tadeo Kondrak
83eda21488 zig_clang/translate_c: Use opaque declarations in Zig 2020-10-08 12:29:59 +03:00
Andrew Kelley
7067764ed3 Merge remote-tracking branch 'origin/master' into llvm11
The changes to install_files.h needed to put into src/libcxx.zig
2020-09-30 02:55:41 -07:00
Andrew Kelley
afac5d2895 fix regressed stage2 test harness 2020-09-21 21:14:01 -07:00
Andrew Kelley
1de2c647df Merge remote-tracking branch 'origin/master' into llvm11 2020-08-18 15:32:42 -07:00
Vexu
cf5932b236
translate-c: convert int to bool if bool is expected 2020-08-11 12:24:45 +03:00
Andrew Kelley
c6e0df6213 Merge remote-tracking branch 'origin/master' into llvm11 2020-08-04 17:09:40 -07:00
Vexu
4ab2f947f9
translate-c: recognize other type trait expressions
Closes #5979
2020-08-04 00:48:29 +03:00
Andrew Kelley
c8ea8cf5df update LLVM C++ API wrappers from llvm 10 to 11 2020-07-24 16:49:57 -07:00
Andrew Kelley
41cb49eb58
stage1 fixes to support building with 32-bit mingw-w64 2020-04-06 20:30:34 -04:00
Andrew Kelley
e7f555ca55
stage1: fix build for i386-linux 2020-04-02 19:07:52 -04:00
Andrew Kelley
656ba530d8
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Vexu
cb4c488cbd
translate-c support struct field alignment 2020-03-10 15:57:57 +02:00
Vexu
692a974c3e
translate-c reject structs with VLAs 2020-03-08 12:11:37 +02:00
Andrew Kelley
f33bf48af7
Merge remote-tracking branch 'origin/master' into llvm10 2020-02-25 16:30:40 -05:00
Andrew Kelley
20f3b0efff rename libuserland to libstage2 2020-02-16 19:16:08 -05:00
Andrew Kelley
a63a2fdf76
update zig_clang bindings to release/10.x 2020-01-29 23:50:24 -05:00
Andrew Kelley
a95dce15ae
Merge remote-tracking branch 'origin/master' into llvm10 2020-01-29 23:33:12 -05:00
Feix Weiglhofer
a4a9330648 translate-c: Don't make const parameters mutable. (#4273)
* translate-c: Remove arg-prefix from const parameters.
* translate-c: Add unittest for const parameters.
2020-01-24 15:32:32 -05:00
Andrew Kelley
72589dbffe
zig_clang builds with llvm 10 2020-01-23 17:22:13 -05:00
Andrew Kelley
32dafbdadc
zig_clang: update StmtClass to llvm 10 2020-01-23 16:52:40 -05:00
Andrew Kelley
3588f99719
zig_clang: update TypeClass enum 2020-01-23 14:35:12 -05:00
LemonBoy
a284be3f69 Fix unsafe cast in translate_c
Fixes #4250
2020-01-22 17:58:57 -05:00
Andrew Kelley
fbe6af81fd
Merge remote-tracking branch 'origin/master' into llvm10 2020-01-16 13:01:36 -05:00
LemonBoy
34ae1d9aa8 Fix unsafe cast in translate_c
* Handle EmptyDecls to clean up the generated code

Closes #4143
2020-01-11 15:51:10 -05:00
LemonBoy
570ffc470e Handle forward-declared functions
Closes #4130
2020-01-10 16:34:40 -05:00
LemonBoy
fd7e69a2c0 More translate-c fixes
* Translate OpaqueValueExpr
* Translate BinaryConditionalOperator
* Fix translation of boolean->int casts
* Reoder some tokens to avoid rendering errors
2020-01-08 08:43:37 +01:00
via
9390e8b848 Preserve packed attribute in C translated struct (#4085)
* Preserve packed attribute in C translated struct

* Add tests for packed C struct
2020-01-07 02:36:07 -05:00
Andrew Kelley
baaef7ed97
Merge pull request #4083 from LemonBoy/better-stdbool
Better _Bool translation
2020-01-06 19:21:55 -05:00
LemonBoy
1dc25d7550
Translate anonymous union/struct 2020-01-06 19:17:47 -05:00
LemonBoy
cd39f6df95 Better _Bool translation 2020-01-06 00:12:18 +01:00
LemonBoy
6ff70d3c31 Better InitListExpr translation 2020-01-05 17:39:29 -05:00
LemonBoy
b0fa2ff853
Translate struct/union initializer expressions 2020-01-02 14:16:39 -05:00
LemonBoy
d908ca4823
Translate align attribute 2020-01-02 12:33:19 -05:00
LemonBoy
8e89bdfe99
Translate linksection attribute 2020-01-02 12:32:51 -05:00
Andrew Kelley
88c5e2a96e
translate-c: don't export inline functions 2020-01-01 20:54:17 -05:00
Vexu
122a9bad39
translate-c-2 fix some casts 2019-12-19 01:38:42 +02:00
Vexu
daa22d42b0
translate-c-2 floats 2019-12-17 11:28:56 +02:00
Vexu
eb057ef41c
translate-c-2 dont eval init expr 2019-12-13 15:07:10 +02:00
daurnimator
ed956b5812 translate-c: add support for MacroQualified definitions 2019-11-19 01:05:17 +00:00
LemonBoy
230d27c1cd Adapt to clang API additions 2019-10-13 11:08:16 -04:00
LemonBoy
6439759298 Add/shuffle several enum members to match Clang's API 2019-10-12 16:15:58 +02:00
Andrew Kelley
a7c9aa7ddb
finish conversion of translate_c.cpp to use zig_clang.h
See #1964

translate_c.cpp now exclusively uses the clang API via zig_clang.h

shaves off 5 seconds from building zig when translate_c.cpp
(or any h files it uses) change.
2019-10-02 19:21:40 -04:00
Andrew Kelley
f84086132f
more conversion of translate_c.cpp to use zig_clang.h
Progress: 96%

See #1964
2019-10-02 02:02:31 -04:00