@specs-feup/clava
Version:
A C/C++ source-to-source compiler written in Typescript
65 lines • 2.74 kB
TypeScript
export default class ClangPlugin {
static clangPluginDir: string;
static pluginNamePrefix: string;
/**
* Validate that the executable provided is indeed a clang executable
*
* **Sanitize the input before calling this method**
*
* @param executableName - String containing the command the user uses to compile their code normally
* @returns String containing the clang executable name
*/
static validateClangExecutable(executableName: string): Promise<void>;
/**
* Gets the clang version number from a clang executable
*
* **Sanitize the input before calling this method**
*
* @param clangExecutable - String containing the clang executable name
* @returns String containing the clang version number (e.g. 14.0.0)
*/
static getClangVersionNumberFromExecutable(clangExecutable: string): Promise<string>;
/**
* Gets the clang version number from a compiler executable
*
* **Sanitize the input before calling this method**
*
* @param executableName - String containing the executable the user uses to compile their code normally
* @returns String containing the clang version number (e.g. 14.0.0)
*/
static getClangVersion(executableName: string): Promise<string>;
/**
* Searches the 'clang-plugin-binaries' directory for available clang plugins
* and returns a map of the available plugins.
*
* @returns Map of available clang plugins
*/
static getAvailablePlugins(): Promise<{
[version: string]: string;
}>;
/**
* Gets the absolute path to the clang plugin for a compiler
*
* @param executableName - Name of the compiler executable
* @returns The absolute path to the clang plugin or throws an error if no compatible plugin found
*/
static getPluginPath(executableName: string): Promise<string>;
/**
* Executes the clang plugin in a sandboxed environment with the given arguments
* and returns a pipe to the output.
*
* @param commandList - Command used to execute the compiler by the user
* @param pluginPath - Path to the clang plugin aligned with the compiler version
* @param args - Arguments to pass to the clang plugin
*/
static executeClangPlugin(commandList: (string | number)[]): Promise<string>;
/**
* Ensures that the argument is an absolute path if it exists
* otherwise returns the argument itself
*
* @param argument - String containing the argument to check
* @returns The absolute path to the argument if it exists, otherwise the argument itself
*/
private static ensureAbsolutePath;
}
//# sourceMappingURL=ClangPlugin.d.ts.map