aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-26 17:44:23 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:56 -0700
commita596ea683c35d90c6af3e1fbeae2e06312ce392f (patch)
tree2da3ac1beb27115081051cb152a79ca8cb0521d0 /src/Compilation.zig
parent8011faa0049df757bab78310af824b283220bcac (diff)
downloadzig-a596ea683c35d90c6af3e1fbeae2e06312ce392f.tar.gz
zig-a596ea683c35d90c6af3e1fbeae2e06312ce392f.zip
CLI: introduce --verbose-intern-pool
and stop dumping to stderr without the user's consent.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 30ac499955..0ee916c446 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -87,6 +87,7 @@ clang_preprocessor_mode: ClangPreprocessorMode,
/// Whether to print clang argvs to stdout.
verbose_cc: bool,
verbose_air: bool,
+verbose_intern_pool: bool,
verbose_llvm_ir: ?[]const u8,
verbose_llvm_bc: ?[]const u8,
verbose_cimport: bool,
@@ -593,6 +594,7 @@ pub const InitOptions = struct {
verbose_cc: bool = false,
verbose_link: bool = false,
verbose_air: bool = false,
+ verbose_intern_pool: bool = false,
verbose_llvm_ir: ?[]const u8 = null,
verbose_llvm_bc: ?[]const u8 = null,
verbose_cimport: bool = false,
@@ -1574,6 +1576,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.clang_preprocessor_mode = options.clang_preprocessor_mode,
.verbose_cc = options.verbose_cc,
.verbose_air = options.verbose_air,
+ .verbose_intern_pool = options.verbose_intern_pool,
.verbose_llvm_ir = options.verbose_llvm_ir,
.verbose_llvm_bc = options.verbose_llvm_bc,
.verbose_cimport = options.verbose_cimport,
@@ -2026,10 +2029,12 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
try comp.performAllTheWork(main_progress_node);
if (comp.bin_file.options.module) |module| {
- std.debug.print("intern pool stats for '{s}':\n", .{
- comp.bin_file.options.root_name,
- });
- module.intern_pool.dump();
+ if (builtin.mode == .Debug and comp.verbose_intern_pool) {
+ std.debug.print("intern pool stats for '{s}':\n", .{
+ comp.bin_file.options.root_name,
+ });
+ module.intern_pool.dump();
+ }
if (comp.bin_file.options.is_test and comp.totalErrorCount() == 0) {
// The `test_functions` decl has been intentionally postponed until now,
@@ -5422,6 +5427,7 @@ fn buildOutputFromZig(
.verbose_cc = comp.verbose_cc,
.verbose_link = comp.bin_file.options.verbose_link,
.verbose_air = comp.verbose_air,
+ .verbose_intern_pool = comp.verbose_intern_pool,
.verbose_llvm_ir = comp.verbose_llvm_ir,
.verbose_llvm_bc = comp.verbose_llvm_bc,
.verbose_cimport = comp.verbose_cimport,
@@ -5500,6 +5506,7 @@ pub fn build_crt_file(
.verbose_cc = comp.verbose_cc,
.verbose_link = comp.bin_file.options.verbose_link,
.verbose_air = comp.verbose_air,
+ .verbose_intern_pool = comp.verbose_intern_pool,
.verbose_llvm_ir = comp.verbose_llvm_ir,
.verbose_llvm_bc = comp.verbose_llvm_bc,
.verbose_cimport = comp.verbose_cimport,