mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Implement unused pattern bindings, continued (#6518)
Implementation of unused pattern bindings #2022, continued. Whereas previous PR #6460 took care of parsing, and PR #6479 prepared the stage by using _ in some test cases, this PR has the the actual implementation, using a simple dataflow analysis. --------- Co-authored-by: Burak Emir <bqe@google.com> Co-authored-by: jonmeow <jperkins@google.com>
This commit is contained in:
co-authored by
Burak Emir
jonmeow
parent
bea24a8bee
commit
fdb188ccfd
@@ -53,6 +53,7 @@
|
||||
#include "toolchain/check/pattern_match.h"
|
||||
#include "toolchain/check/type.h"
|
||||
#include "toolchain/check/type_completion.h"
|
||||
#include "toolchain/check/unused.h"
|
||||
#include "toolchain/parse/node_ids.h"
|
||||
#include "toolchain/sem_ir/clang_decl.h"
|
||||
#include "toolchain/sem_ir/class.h"
|
||||
@@ -1448,7 +1449,8 @@ static auto ImportFunction(Context& context, SemIR::LocId loc_id,
|
||||
auto function_params_insts =
|
||||
CreateFunctionSignatureInsts(context, loc_id, clang_decl, signature);
|
||||
|
||||
auto [pattern_block_id, decl_block_id] = FinishFunctionSignature(context);
|
||||
auto [pattern_block_id, decl_block_id] =
|
||||
FinishFunctionSignature(context, /*check_unused=*/false);
|
||||
|
||||
if (!function_params_insts.has_value()) {
|
||||
return std::nullopt;
|
||||
@@ -1706,7 +1708,7 @@ static auto ImportVarDecl(Context& context, SemIR::LocId loc_id,
|
||||
SemIR::EntityNameId entity_name_id =
|
||||
context.entity_names().AddSymbolicBindingName(
|
||||
var_name_id, GetParentNameScopeId(context, var_decl),
|
||||
SemIR::CompileTimeBindIndex::None, false);
|
||||
SemIR::CompileTimeBindIndex::None, false, /*is_unused=*/false);
|
||||
|
||||
// Create `RefBindingPattern` and `VarPattern`. Mirror the behavior of
|
||||
// import_ref and don't create a `NameBindingDecl` here; we'd never use it for
|
||||
|
||||
Reference in New Issue
Block a user