aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-11-27 17:07:16 +0000
committerJonas Schievink <[email protected]>2020-11-27 17:07:16 +0000
commitec7d2bbe420105a7101ab01b7b6e72901b3dd29a (patch)
tree7bc0a9ae0196366687e2d3feae3369b1b403bf00 /crates/hir_expand
parent0993f9067cfc14cded484906283d1df8e8741e8e (diff)
Add/Fix macro expansion profiling
Diffstat (limited to 'crates/hir_expand')
-rw-r--r--crates/hir_expand/src/db.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs
index 46ebdbc74..bf16b56b1 100644
--- a/crates/hir_expand/src/db.rs
+++ b/crates/hir_expand/src/db.rs
@@ -189,6 +189,7 @@ fn macro_expand_with_arg(
189 id: MacroCallId, 189 id: MacroCallId,
190 arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>, 190 arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
191) -> ExpandResult<Option<Arc<tt::Subtree>>> { 191) -> ExpandResult<Option<Arc<tt::Subtree>>> {
192 let _p = profile::span("macro_expand");
192 let lazy_id = match id { 193 let lazy_id = match id {
193 MacroCallId::LazyMacro(id) => id, 194 MacroCallId::LazyMacro(id) => id,
194 MacroCallId::EagerMacro(id) => { 195 MacroCallId::EagerMacro(id) => {
@@ -276,14 +277,15 @@ fn parse_macro_with_arg(
276 macro_file: MacroFile, 277 macro_file: MacroFile,
277 arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>, 278 arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
278) -> ExpandResult<Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>> { 279) -> ExpandResult<Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>> {
279 let _p = profile::span("parse_macro_query");
280
281 let macro_call_id = macro_file.macro_call_id; 280 let macro_call_id = macro_file.macro_call_id;
282 let result = if let Some(arg) = arg { 281 let result = if let Some(arg) = arg {
283 macro_expand_with_arg(db, macro_call_id, Some(arg)) 282 macro_expand_with_arg(db, macro_call_id, Some(arg))
284 } else { 283 } else {
285 db.macro_expand(macro_call_id) 284 db.macro_expand(macro_call_id)
286 }; 285 };
286
287 let _p = profile::span("parse_macro_expansion");
288
287 if let Some(err) = &result.err { 289 if let Some(err) = &result.err {
288 // Note: 290 // Note:
289 // The final goal we would like to make all parse_macro success, 291 // The final goal we would like to make all parse_macro success,