| author | |
| committer | |
| log | 26096e79d1610218106faa75f7dbb10b4b5bbe5a |
| tree | 4c9331f99065783bd354c5e0f6742d6b24cc47ef |
| parent | 8d5c4a67a7dfe2e1fc07f84515d59405c4100b5c |
2 files changed, 13 insertions(+), 0 deletions(-)
src/translate_c.cpp+3| ... | @@ -400,6 +400,9 @@ static AstNode *get_global(Context *c, Buf *name) { | ... | @@ -400,6 +400,9 @@ static AstNode *get_global(Context *c, Buf *name) { |
| 400 | if (entry) | 400 | if (entry) |
| 401 | return entry->value; | 401 | return entry->value; |
| 402 | } | 402 | } |
| 403 | if (c->codegen->primitive_type_table.maybe_get(name) != nullptr) { | ||
| 404 | return trans_create_node_symbol(c, name); | ||
| 405 | } | ||
| 403 | return nullptr; | 406 | return nullptr; |
| 404 | } | 407 | } |
| 405 | 408 |
test/translate_c.zig+10| ... | @@ -1162,4 +1162,14 @@ pub fn addCases(cases: &tests.TranslateCContext) { | ... | @@ -1162,4 +1162,14 @@ pub fn addCases(cases: &tests.TranslateCContext) { |
| 1162 | \\ return ~x; | 1162 | \\ return ~x; |
| 1163 | \\} | 1163 | \\} |
| 1164 | ); | 1164 | ); |
| 1165 | |||
| 1166 | cases.add("primitive types included in defined symbols", | ||
| 1167 | \\int foo(int u32) { | ||
| 1168 | \\ return u32; | ||
| 1169 | \\} | ||
| 1170 | , | ||
| 1171 | \\pub fn foo(u32_0: c_int) -> c_int { | ||
| 1172 | \\ return u32_0; | ||
| 1173 | \\} | ||
| 1174 | ); | ||
| 1165 | } | 1175 | } |