mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:31:03 +01:00
Don't return SemanticsFunction by value. (#2968)
It contains a vector, so it's not cheap to copy. Return by const reference instead. Thanks to @fasiddique for spotting this!
This commit is contained in:
@@ -22,7 +22,7 @@ auto SemanticsHandleReturnStatement(SemanticsContext& context,
|
||||
CARBON_CHECK(!context.return_scope_stack().empty());
|
||||
const auto& fn_node =
|
||||
context.semantics_ir().GetNode(context.return_scope_stack().back());
|
||||
const auto callable =
|
||||
const auto& callable =
|
||||
context.semantics_ir().GetFunction(fn_node.GetAsFunctionDeclaration());
|
||||
|
||||
if (context.parse_tree().node_kind(context.node_stack().PeekParseNode()) ==
|
||||
|
||||
Reference in New Issue
Block a user