Extensions
September 27, 2023 ยท View on GitHub
Most of the functionality in Clade is implemented as extensions. These extensions can be separated into the following groups:
Extensions that parse a particular type of build commands
- C compilation commands:
CCandCLextensions. - C++ compilation commands:
CXXextension. arcommands, which are used to create, modify, and extract from archives:ARextension.- Assembler commands:
ASextension - Link commands:
LNextension. - Move commands:
MVextension. - Object copy commands:
Objcopyextension. - Copy commands (Windows-specific):
Copyextension.
Each of these extensions has a corresponding configuration option, which precisely describes which commands it parse. These options can be found on the presets.json file.
These extensions output a list of json files with parsed commands.
Each parsed command consists of a list of input files, a list of
output files, and a list of options. Some extensions may add
additional data, for example, CC extension also adds a list
of dependencies (header files that were used by the intercepted
compile command).
Extensions that generate information by using a list of all intercepted commands
PidGraphextension, which produces parent-child graph between intercepted commands.
More about it you can read in the usage docs.
Extensions that generate information using data from other extensions
Extensions may interact with each other, and thus refine and produce data from several sources. Extensions in this group are:
CmdGraphextension, which uses parsed commands from other extensions, and connects them by their input and output files, creating dependency graph between these commands.SrcGraphextension, which shows for each source file (C or C++ only) a list of commands in which it was compiled, and a list of commands in which it was indirectly used.Alternativesextension, which parses build commands that create identical file copies (ln, cp, install, etc.) and allows to determine that different paths are in fact related to the same file.CDBextension, which is used to create compilation databases.
Helper extensions
These are extensions that implement functionality useful for other extensions.
Pathextension: provides functions to normalize file paths.Storageextension: adds ability to save files to the Clade working directory, and to retrieve them later. This allows the following scenario: Clade intercepts build process on one computer, and then parses the ouput on another, using cmds.txt file and file copies stored in the Storage.
Extensions that use information about the source code (C only)
Infois the main extension here: it uses CIF to parse source code and extract various info about it. All extensions in this group are using data from theInfoextension.Functionsextension parses information about function definitions and declarations.Callgraphextension creates a function callgraph.Macrosextension pares information about macros definitions and expansions.Typedefsextension parses information about typedefs.UsedInextension parses information about functional pointersCallsByPtrextension parses information about function calls by pointers.Variablesextension parses information about global variable initializations.
Parent extensions
These extensions are not meant to be used as is, they are parent classes for other extensions. They usually implement some common functionality.
Abstractextension (parent of all other extensions).Commonextension (for extensions that parse intercepted commands into input, output files, and a list of options.Linkextension (parent of compiler extensions that also parse linker commands)CommonInfoextension, implements common functionality for extensions that parse output ofInfoextension.