From 4c18da1ef3ef21033394041be21774bf13882b54 Mon Sep 17 00:00:00 2001 From: Tamas Kenez Date: Sat, 14 Aug 2021 13:58:46 +0200 Subject: Fix args when calling clang::ASTUnit::LoadFromCommandLine. clang::ASTUnit::LoadFromCommandLine interprets the first argument as the name of program (like the main function). This change shifts the arguments passing "" for the first argument. --- src/Compilation.zig | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 7987ed95df..7dc726aeb2 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2557,6 +2557,7 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { var argv = std.ArrayList([]const u8).init(comp.gpa); defer argv.deinit(); + try argv.append(""); // argv[0] is program name, actual args start at [1] try comp.addTranslateCCArgs(arena, &argv, .c, out_dep_path); try argv.append(out_h_path); -- cgit v1.2.3