The function
discard-source-info
removes all source location information from the internal dspec database.
To build
my-image
which does not contain source locations for the definitions loaded, but retaining a tags database of those definitions:
(load-all-patches)
(load "my-code")
(dspec:save-tags-database
(compile-file-pathname #P"my-tags-database"))
(dspec:discard-source-info)
(save-image "my-image")
LispWorks User Guide and Reference Manual - 21 Dec 2011