mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
compiler: implement clear builtin for maps
This commit is contained in:
committed by
Ron Evans
parent
a2f886a67a
commit
f1e25a18d2
Vendored
+4
@@ -59,3 +59,7 @@ func clearSlice(s []int) {
|
||||
func clearZeroSizedSlice(s []struct{}) {
|
||||
clear(s)
|
||||
}
|
||||
|
||||
func clearMap(m map[string]int) {
|
||||
clear(m)
|
||||
}
|
||||
|
||||
Vendored
+9
@@ -147,6 +147,15 @@ entry:
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define hidden void @main.clearMap(ptr dereferenceable_or_null(40) %m, ptr %context) unnamed_addr #2 {
|
||||
entry:
|
||||
call void @runtime.hashmapClear(ptr %m, ptr undef) #5
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @runtime.hashmapClear(ptr dereferenceable_or_null(40), ptr) #1
|
||||
|
||||
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
||||
declare i32 @llvm.smin.i32(i32, i32) #4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user