From ec7d2bbe420105a7101ab01b7b6e72901b3dd29a Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 27 Nov 2020 18:07:16 +0100 Subject: [PATCH] Add/Fix macro expansion profiling --- crates/hir_expand/src/db.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 46ebdbc74d..bf16b56b1d 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -189,6 +189,7 @@ fn macro_expand_with_arg( id: MacroCallId, arg: Option>, ) -> ExpandResult>> { + let _p = profile::span("macro_expand"); let lazy_id = match id { MacroCallId::LazyMacro(id) => id, MacroCallId::EagerMacro(id) => { @@ -276,14 +277,15 @@ fn parse_macro_with_arg( macro_file: MacroFile, arg: Option>, ) -> ExpandResult, Arc)>> { - let _p = profile::span("parse_macro_query"); - let macro_call_id = macro_file.macro_call_id; let result = if let Some(arg) = arg { macro_expand_with_arg(db, macro_call_id, Some(arg)) } else { db.macro_expand(macro_call_id) }; + + let _p = profile::span("parse_macro_expansion"); + if let Some(err) = &result.err { // Note: // The final goal we would like to make all parse_macro success,