object
dead_code_scanner
A tool for detecting likely dead code in compiled Logtalk entities and Prolog modules compiled as objects.
logtalk_load(dead_code_scanner(loader))
static, context_switching_calls
Dead code: A predicate or non-terminal that is not called (directly or indirectly) by any scoped predicate or non-terminal. These predicates and non-terminals are not used, cannot be called without breaking encapsulation, and are thus considered dead code.
Known issues: Use of local meta-calls with goal arguments only know at runtime can result in false positives. Calls from non-standard meta-predicates may be missed if the meta-calls are not optimized.
Requirements: Source files must be compiled with the
source_data
flag turned on. To avoid false positives do to meta-calls, compilation of source files with theoptimized
flag turned on is also advised.
Public predicates
entity/1
Scans a loaded entity for dead code. Fails if the entity does not exist.
static
entity(Entity)
entity(+entity_identifier)
- zero_or_one
file/2
Scans all entities in a loaded source file for dead code using the given options. The file can be given by name, basename, full path, or using library notation. Fails if the file is not loaded.
static
file(File,Options)
file(+atom,+list(compound))
- zero_or_one
file/1
Scans all entities in a loaded source file for dead code using default options. The file can be given by name, basename, full path, or using library notation. Fails if the file is not loaded.
static
file(File)
file(+atom)
- zero_or_one
directory/2
Scans all entities in all loaded files from a given directory for dead code using the given options.
static
directory(Directory,Options)
directory(+atom,+list(compound))
- one
directory/1
Scans all entities in all loaded files from a given directory for dead code using default options.
static
directory(Directory)
directory(+atom)
- one
rdirectory/2
Scans all entities in all loaded files from a given directory and its sub-directories for dead code using the given options.
static
rdirectory(Directory,Options)
rdirectory(+atom,+list(compound))
- one
rdirectory/1
Scans all entities in all loaded files from a given directory and its sub-directories for dead code using default options.
static
rdirectory(Directory)
rdirectory(+atom)
- one
library/2
Scans all entities in all loaded files from a given library for dead code using the given options.
static
library(Library,Options)
library(+atom,+list(compound))
- one
library/1
Scans all entities in all loaded files from a given library for dead code using default options.
static
library(Library)
library(+atom)
- one
rlibrary/2
Scans all entities in all loaded files in a loaded library and its sub-libraries for dead code using the given options.
static
rlibrary(Library,Options)
rlibrary(+atom,+list(compound))
- one
rlibrary/1
Scans all entities in all loaded files in a loaded library and its sub-libraries for dead code using default options.
static
rlibrary(Library)
rlibrary(+atom)
- one
all/1
Scans all entities for dead code using the given options.
static
all(Options)
all(+list(compound))
- one
all/0
Scans all entities for dead code using default options.
static
all
- one
predicates/2
Returns an ordered set of local predicates (and non-terminals) that are not used, directly or indirectly, by scoped predicates for a loaded entity.
static
predicates(Entity,Predicates)
predicates(+entity_identifier,-list(predicate_indicator))
- one
predicate/2
Enumerates, by backtracking, local predicates (and non-terminals) that are not used, directly or indirectly, by scoped predicates for a loaded entity.
static
predicate(Entity,Predicate)
predicate(+entity_identifier,?predicate_indicator)
- zero_or_more
Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)