From b9ff8b5626cec7ddba215e3f11e0c3b2a0527a34 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Sun, 4 Feb 2024 14:32:04 +0100 Subject: [PATCH] di: Aggreggate one WARN log for skipped types On WARN level, instead of logging each skipped type separately, aggreggate the skipped types and issue a WARN log once. --- src/llvm/di.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/llvm/di.rs b/src/llvm/di.rs index 1df4e741..94ac6702 100644 --- a/src/llvm/di.rs +++ b/src/llvm/di.rs @@ -28,6 +28,7 @@ pub struct DISanitizer { visited_nodes: HashSet, item_stack: Vec, replace_operands: HashMap, + skipped_types: Vec, } // Sanitize Rust type names to be valid C type names. @@ -67,6 +68,7 @@ impl DISanitizer { visited_nodes: HashSet::new(), item_stack: Vec::new(), replace_operands: HashMap::new(), + skipped_types: Vec::new(), } } @@ -124,9 +126,10 @@ impl DISanitizer { None => "".to_owned(), }; - warn!( + trace!( "found data carrying enum {name} ({filename}:{line}), not emitting the debug info for it" ); + self.skipped_types.push(name); is_data_carrying_enum = true; break; @@ -302,6 +305,13 @@ impl DISanitizer { self.visit_item(Item::Function(function)); } + if !self.skipped_types.is_empty() { + warn!( + "debug info was not emitted for the following types: {}", + self.skipped_types.join(", ") + ); + } + unsafe { LLVMDisposeDIBuilder(self.builder) }; }