mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:41:04 +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
+10
-10
@@ -62,7 +62,7 @@ library "[[@TEST_NAME]]";
|
||||
import Cpp library "short_return.h";
|
||||
|
||||
fn F() {
|
||||
let x: i16 = Cpp.foo_short();
|
||||
let unused x: i16 = Cpp.foo_short();
|
||||
}
|
||||
|
||||
// CHECK:STDOUT: --- import_short_param.carbon
|
||||
@@ -361,19 +361,19 @@ fn F() {
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
||||
// CHECK:STDOUT: %foo_short.ref: %foo_short.cpp_overload_set.type = name_ref foo_short, imports.%foo_short.cpp_overload_set.value [concrete = constants.%foo_short.cpp_overload_set.value]
|
||||
// CHECK:STDOUT: %.loc7_30.1: ref %i16 = temporary_storage
|
||||
// CHECK:STDOUT: %addr: %ptr = addr_of %.loc7_30.1
|
||||
// CHECK:STDOUT: %.loc7_37.1: ref %i16 = temporary_storage
|
||||
// CHECK:STDOUT: %addr: %ptr = addr_of %.loc7_37.1
|
||||
// CHECK:STDOUT: %foo_short__carbon_thunk.call: init %empty_tuple.type = call imports.%foo_short__carbon_thunk.decl(%addr)
|
||||
// CHECK:STDOUT: %.loc7_30.2: init %i16 to %.loc7_30.1 = mark_in_place_init %foo_short__carbon_thunk.call
|
||||
// CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
|
||||
// CHECK:STDOUT: %.loc7_37.2: init %i16 to %.loc7_37.1 = mark_in_place_init %foo_short__carbon_thunk.call
|
||||
// CHECK:STDOUT: %.loc7_17: type = splice_block %i16 [concrete = constants.%i16] {
|
||||
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
|
||||
// CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %.loc7_30.3: ref %i16 = temporary %.loc7_30.1, %.loc7_30.2
|
||||
// CHECK:STDOUT: %.loc7_30.4: %i16 = acquire_value %.loc7_30.3
|
||||
// CHECK:STDOUT: %x: %i16 = value_binding x, %.loc7_30.4
|
||||
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc7_30.3, constants.%DestroyOp
|
||||
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc7_30.3)
|
||||
// CHECK:STDOUT: %.loc7_37.3: ref %i16 = temporary %.loc7_37.1, %.loc7_37.2
|
||||
// CHECK:STDOUT: %.loc7_37.4: %i16 = acquire_value %.loc7_37.3
|
||||
// CHECK:STDOUT: %x: %i16 = value_binding x, %.loc7_37.4
|
||||
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc7_37.3, constants.%DestroyOp
|
||||
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc7_37.3)
|
||||
// CHECK:STDOUT: return
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT:
|
||||
|
||||
Reference in New Issue
Block a user