Andrew Kelley
b85ef2300f
Merge remote-tracking branch 'origin/master' into llvm12
2021-03-28 21:42:56 -07:00
Evan Haas
c558a1ae26
translate-c: Implement generic selection expressions
...
Enables translation of C code that uses the `_Generic` keyword
2021-03-17 00:07:33 +02:00
Andrew Kelley
1f34c03ac1
Merge remote-tracking branch 'origin/master' into llvm12
2021-03-12 18:05:27 -07:00
Evan Haas
c760532be0
translate-c: Add compound literal support
2021-03-08 10:09:12 +02:00
Andrew Kelley
584cb2e4fb
Merge remote-tracking branch 'origin/master' into llvm12
2021-03-01 12:09:26 -07:00
Evan Haas
294ee1bbc9
translate-c: add limited OffsetOfExpr support
...
Add support for OffsetOfExpr that contain exactly 1 component, when that component
is a field.
For example, given:
```c
struct S {
float f;
double d;
};
struct T {
long l;
int i;
struct S s[10];
};
```
Then:
```c
offsetof(struct T, i) // supported
offsetof(struct T, s[2].d) // not supported currently
```
2021-02-28 21:56:57 +02:00
Andrew Kelley
9e8943736e
Merge remote-tracking branch 'origin/master' into llvm12
2021-02-27 02:25:58 -07:00
Evan Haas
0816981561
translate-c: add typeof support
2021-02-25 22:33:42 -08:00
Andrew Kelley
0b58b61799
Merge remote-tracking branch 'origin/master' into llvm12
...
Conflicts:
* src/clang.zig
* src/llvm.zig
- this file got moved to src/llvm/bindings.zig in master branch so I
had to put the new LLVM arch/os enum tags into it.
* lib/std/target.zig, src/stage1/target.cpp
- haiku had an inconsistency with its default target ABI, gnu vs
eabi. In this commit we make it gnu in both places to match the
latest changes by @hoanga.
* src/translate_c.zig
2021-02-25 21:04:23 -07:00
Veikka Tuominen
9a826ccbe0
translate-c: elide some unecessary casts of literals
2021-02-16 16:40:43 +02:00
Evan Haas
221f1d898c
translate-c: Improve function pointer handling
...
Omit address-of operator if operand is a function.
Improve handling of function-call translation when using function pointers
Fixes #4124
2021-02-08 10:15:00 +02:00
Evan Haas
57b2176e28
translate-c: Improve array support
...
1. For incomplete arrays with initializer list (`int x[] = {1};`) use the
initializer size as the array size.
2. For arrays initialized with a string literal translate it as an array
of character literals instead of `[*c]const u8`
3. Don't crash if an empty initializer is used for an incomplete array.
4. Add a test for multi-character character constants
Additionally lay some groundwork for supporting wide string literals.
fixes #4831 #7832 #7842
2021-01-25 10:37:23 -08: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
e1ca6946be
rename ZigClangFloatingLiteral_getValueAsApproximateDouble
2020-10-27 14:16:43 -07: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
800a4a6ceb
eliminate dependency of libzigcpp.a on libzigstage1.a
...
This allows us to create a build of self-hosted with LLVM extensions
enabled but without the stage1 backend.
2020-09-23 00:00:24 -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
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
Michael Dusan
bc75c0de6c
stage1: fix compile error on macOS Xcode 11.4
2020-03-07 12:16:56 -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
0267afa9c0
Fix garbled error messages from clang
2020-01-16 12:16:30 -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
95619ecb8c
Stop dropping errors from clang
...
* Refactor the error-writing code to be more compact and flexible
2020-01-11 15:48:32 -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
LemonBoy
cbfd66f68a
Don't crash when parsing invalid files
2019-12-30 19:17:19 -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