diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-09-20 12:52:54 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-09-20 12:52:54 -0400 |
| commit | 3c41c2d84b8de5a95a322a3f0d8424adf6df8667 (patch) | |
| tree | 0a0722e68311711a6b9dafafa3c713184cd13306 /src/codegen.cpp | |
| parent | 32c51e015674af346aae1c3f40fed9ef098a6693 (diff) | |
| parent | c4a54377e3f07bbd2f9c54c1962c7941792c2c1f (diff) | |
| download | zig-3c41c2d84b8de5a95a322a3f0d8424adf6df8667.tar.gz zig-3c41c2d84b8de5a95a322a3f0d8424adf6df8667.zip | |
Merge branch 'master' into c-to-zig
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 1e8dd76a6f..ab4bf4ebf4 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -152,6 +152,11 @@ void codegen_set_clang_argv(CodeGen *g, const char **args, size_t len) { g->clang_argv_len = len; } +void codegen_set_llvm_argv(CodeGen *g, const char **args, size_t len) { + g->llvm_argv = args; + g->llvm_argv_len = len; +} + void codegen_set_omit_zigrt(CodeGen *g, bool omit_zigrt) { g->omit_zigrt = omit_zigrt; } @@ -4918,6 +4923,17 @@ static void init(CodeGen *g) { if (g->module) return; + + if (g->llvm_argv_len > 0) { + const char **args = allocate_nonzero<const char *>(g->llvm_argv_len + 2); + args[0] = "zig (LLVM option parsing)"; + for (size_t i = 0; i < g->llvm_argv_len; i += 1) { + args[i + 1] = g->llvm_argv[i]; + } + args[g->llvm_argv_len + 1] = nullptr; + ZigLLVMParseCommandLineOptions(g->llvm_argv_len + 1, args); + } + if (g->is_test_build) { g->windows_subsystem_windows = false; g->windows_subsystem_console = true; @@ -5194,16 +5210,16 @@ void codegen_add_object(CodeGen *g, Buf *object_path) { g->link_objects.append(object_path); } - +// Must be coordinated with with CIntType enum static const char *c_int_type_names[] = { - [CIntTypeShort] = "short", - [CIntTypeUShort] = "unsigned short", - [CIntTypeInt] = "int", - [CIntTypeUInt] = "unsigned int", - [CIntTypeLong] = "long", - [CIntTypeULong] = "unsigned long", - [CIntTypeLongLong] = "long long", - [CIntTypeULongLong] = "unsigned long long", + "short", + "unsigned short", + "int", + "unsigned int", + "long", + "unsigned long", + "long long", + "unsigned long long", }; static void get_c_type(CodeGen *g, TypeTableEntry *type_entry, Buf *out_buf) { |
