CMUCL provides a number of functions in the XREF package that may be used to query the cross-reference database:
Returns the list of xref-contexts where function (either a
symbol that names a function, or a function object) may be called
at runtime. XREF does not record calls to macro-functions (such as
defun) or to special forms (such as eval-when).
Returns the list of program contexts that may reference global-variable.
Returns a list of program contexts where the specified global
variable may be bound at runtime (for example using LET).
Returns a list of program contexts where the given global variable
may be modified at runtime (for example using SETQ).
An xref-context is the originating site of a cross-reference.
It identifies a portion of a program, and is defined by an
xref-context structure, that comprises a name, a source file and a
source-path.
Returns the name slot of an xref-context, which is one of:
(setf foo).
(:macro foo).
flet, labels, or anonymous lambdas) that
is named by a list of the form (:internal outer inner).
(:method foo (specializer1 specializer2)).
"Top-Level Form" that identifies a reference from a
top-level form. Note that multiple references from top-level forms
will only be listed once.
(:compiler-macro foo).
"DEFSTRUCT FOO", identifying a reference from
within a structure accessor or constructor or copier.
"Creation Form for #<KERNEL::CLASS-CELL STRUCT-FOO>"
"defun foo", or "defmethod bar (t)",
that identifies a reference from within code that has been generated
by the compiler for that form. For example, the compilation of a
defclass form causes accessor functions to be generated by the
compiler; this code is compiler-generated (it does not appear in the
source file), and so is identified by the XREF facility by a string.
Return the truename (in the sense of the variable
compile-file-truename) of the source file from which the
referencing forms were compiled. This slot will be nil if the
code was compiled from a stream, or interactively from the
listener.
Return a list of positive integers identifying the form that
contains the cross-reference. The first integer in the source-path
is the number of the top-level form containing the cross-reference
(for example, 2 identifies the second top-level form in the source
file). The second integer in the source-path identifies the form
within this top-level form that contains the cross-reference, and so
on. This function will always return nil if the file slot of an
xref-context is nil.