From 7b0542d08b7e8e5ccbe81f495d641305b3b8a264 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 26 Apr 2017 19:17:05 -0400 Subject: build system: consolidate duplicate code and more * add ability to add assembly files when building an exe, obj, or lib * add implicit cast from `[N]T` to `?[]const T` (closes #343) * remove link_exe and link_lib in favor of allowing build_exe and build_lib support no root zig source file --- src/analyze.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index ebbb3e0689..77edddb31c 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -2851,9 +2851,7 @@ void preview_use_decl(CodeGen *g, AstNode *node) { node->data.use.value = result; } -ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, - Buf *abs_full_path, Buf *src_dirname, Buf *src_basename, Buf *source_code) -{ +ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code) { if (g->verbose) { fprintf(stderr, "\nOriginal Source (%s):\n", buf_ptr(abs_full_path)); fprintf(stderr, "----------------\n"); @@ -2894,7 +2892,10 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, ast_print(stderr, import_entry->root, 0); } - // TODO: assert that src_basename has no '/' in it + Buf *src_dirname = buf_alloc(); + Buf *src_basename = buf_alloc(); + os_path_split(abs_full_path, src_dirname, src_basename); + import_entry->di_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); g->import_table.put(abs_full_path, import_entry); g->import_queue.append(import_entry); -- cgit v1.2.3