From 76ce2dd066435c730db48e3c047752fe463d7e15 Mon Sep 17 00:00:00 2001 From: Son Ho Date: Fri, 10 Jan 2025 16:17:07 +0000 Subject: [PATCH] Add a logger for TypesAnalysis.ml --- src/Logging.ml | 3 +++ src/llbc/TypesAnalysis.ml | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Logging.ml b/src/Logging.ml index 4655c4b7..12b5ec79 100644 --- a/src/Logging.ml +++ b/src/Logging.ml @@ -20,6 +20,9 @@ let pre_passes_log = create_logger "PrePasses" (** Logger for RegionsHierarchy *) let regions_hierarchy_log = create_logger "RegionsHierarchy" +(** Logger for TypesAnalysis *) +let types_analysis_log = create_logger "TypesAnalysis" + (** Logger for Translate *) let translate_log = create_logger "Translate" diff --git a/src/llbc/TypesAnalysis.ml b/src/llbc/TypesAnalysis.ml index 42e8f9df..16a418d8 100644 --- a/src/llbc/TypesAnalysis.ml +++ b/src/llbc/TypesAnalysis.ml @@ -3,6 +3,8 @@ open LlbcAst open Errors open Substitute +let log = Logging.types_analysis_log + type subtype_info = { under_borrow : bool; (** Are we inside a borrow? *) under_mut_borrow : bool; (** Are we inside a mut borrow? *) @@ -147,7 +149,7 @@ let analyze_full_ty (span : Meta.span option) (updated : bool ref) match mut_region with | RStatic | RVar (Bound _) -> mut_regions (* We can have bound vars because of arrows *) - | RErased -> craise_opt_span __FILE__ __LINE__ span "Unreachable" + | RErased -> internal_error_opt_span __FILE__ __LINE__ span | RVar (Free rid) -> update_mut_regions_with_rid mut_regions rid in @@ -463,6 +465,7 @@ let analyze_type_declarations (type_decls : type_decl TypeDeclId.Map.t) *) let analyze_ty (span : Meta.span option) (infos : type_infos) (ty : ty) : ty_info = + log#ltrace (lazy (__FUNCTION__ ^ ": ty:\n" ^ show_ty ty)); (* We don't use [updated] but need to give it as parameter *) let updated = ref false in (* We don't need to compute whether the type contains 'static or not *)