ACAV f0ba4b7c9529
Abstract Syntax Tree (AST) visualization tool for C, C++, and Objective-C
Loading...
Searching...
No Matches
acav::MakeAstRunner Class Reference

Runs the make-ast tool to generate AST cache files. More...

#include <MakeAstRunner.h>

Inheritance diagram for acav::MakeAstRunner:
[legend]

Signals

void astReady (const QString &astFilePath)
 Emitted when make-ast completes successfully.
void error (const QString &errorMessage)
 Emitted when an error occurs.
void progress (const QString &message)
 Emitted with progress updates.
void logMessage (const LogEntry &entry)
 Emitted when the tool produces log output.

Public Member Functions

 MakeAstRunner (QObject *parent=nullptr)
void run (const QString &compilationDatabasePath, const QString &sourceFilePath, const QString &outputFilePath, const QString &makeAstBinary=QString())
 Run make-ast tool for specified source file.
bool isRunning () const
 Check if tool is currently running.
void terminate ()
 Attempts to terminate the process gracefully Sends SIGTERM on Unix/macOS, WM_CLOSE on Windows.
void kill ()
 Kills the process immediately Sends SIGKILL on Unix/macOS, forceful termination on Windows.
void setClangResourceDir (const QString &dir)
 Set the Clang resource directory.
bool waitForFinished (int msecs=30000)
 Waits for the process to finish.

Detailed Description

Runs the make-ast tool to generate AST cache files.

This class provides a Qt-based interface to run the make-ast command-line tool using QProcess. It executes the tool, waits for completion, and emits signals for success or error.

Usage: MakeAstRunner runner; connect(&runner, &MakeAstRunner::astReady, this, &MyClass::onAstReady); connect(&runner, &MakeAstRunner::error, this, &MyClass::onError); runner.run(compDb, sourceFile, outputPath);

Definition at line 50 of file MakeAstRunner.h.

Constructor & Destructor Documentation

◆ MakeAstRunner()

acav::MakeAstRunner::MakeAstRunner ( QObject * parent = nullptr)
explicit

Definition at line 31 of file MakeAstRunner.cpp.

◆ ~MakeAstRunner()

acav::MakeAstRunner::~MakeAstRunner ( )
override

Definition at line 43 of file MakeAstRunner.cpp.

Member Function Documentation

◆ astReady

void acav::MakeAstRunner::astReady ( const QString & astFilePath)
signal

Emitted when make-ast completes successfully.

Parameters
astFilePathPath to generated .ast file

◆ error

void acav::MakeAstRunner::error ( const QString & errorMessage)
signal

Emitted when an error occurs.

Parameters
errorMessageDescription of the error

Referenced by logMessage(), and run().

◆ isRunning()

bool acav::MakeAstRunner::isRunning ( ) const

Check if tool is currently running.

Definition at line 89 of file MakeAstRunner.cpp.

References isRunning().

Referenced by isRunning(), and run().

◆ kill()

void acav::MakeAstRunner::kill ( )

Kills the process immediately Sends SIGKILL on Unix/macOS, forceful termination on Windows.

Definition at line 99 of file MakeAstRunner.cpp.

References kill().

Referenced by kill().

◆ progress

void acav::MakeAstRunner::progress ( const QString & message)
signal

Emitted with progress updates.

Parameters
messageProgress message (e.g., "Generating AST for file.cpp...")

Referenced by run().

◆ run()

void acav::MakeAstRunner::run ( const QString & compilationDatabasePath,
const QString & sourceFilePath,
const QString & outputFilePath,
const QString & makeAstBinary = QString() )

Run make-ast tool for specified source file.

Parameters
compilationDatabasePathPath to compile_commands.json
sourceFilePathPath to source file to parse
outputFilePathPath where .ast file should be written
makeAstBinaryPath to make-ast executable (defaults to app dir)

Definition at line 50 of file MakeAstRunner.cpp.

References error(), isRunning(), progress(), and run().

Referenced by run().

◆ setClangResourceDir()

void acav::MakeAstRunner::setClangResourceDir ( const QString & dir)
inline

Set the Clang resource directory.

Parameters
dirPath to clang resource dir (lib/clang/<ver>)

Definition at line 80 of file MakeAstRunner.h.

◆ terminate()

void acav::MakeAstRunner::terminate ( )

Attempts to terminate the process gracefully Sends SIGTERM on Unix/macOS, WM_CLOSE on Windows.

Definition at line 93 of file MakeAstRunner.cpp.

References terminate().

Referenced by terminate().

◆ waitForFinished()

bool acav::MakeAstRunner::waitForFinished ( int msecs = 30000)

Waits for the process to finish.

Parameters
msecsMaximum time to wait in milliseconds (default: 30000ms)
Returns
true if process finished, false if timeout occurred

Definition at line 105 of file MakeAstRunner.cpp.

References waitForFinished().

Referenced by waitForFinished().


The documentation for this class was generated from the following files: