codegen: fix a warning about unused variable "swap"