mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
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.
This commit is contained in:
parent
bbb96e112c
commit
4c18da1ef3
@ -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);
|
||||
|
||||
@ -2492,6 +2492,7 @@ fn cmdTranslateC(comp: *Compilation, arena: *Allocator, enable_cache: bool) !voi
|
||||
|
||||
const digest = if (try man.hit()) man.final() else digest: {
|
||||
var argv = std.ArrayList([]const u8).init(arena);
|
||||
try argv.append(""); // argv[0] is program name, actual args start at [1]
|
||||
|
||||
var zig_cache_tmp_dir = try comp.local_cache_directory.handle.makeOpenPath("tmp", .{});
|
||||
defer zig_cache_tmp_dir.close();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user