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 #P"my-tags-database.ofasl")
(dspec:discard-source-info)
(save-image "my-image")
(quit)