forked from qt-creator/qt-creator
ClangTools: Add action for running on current file
Ideally, we would build the particular file before running the analyzer, but not every project manager supports that. For now, skip building the project for this action. Change-Id: Ibc516c41dd0dbeb7b17b44c0ac35ae4b46ae801d Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -49,7 +49,12 @@ public:
|
||||
ClangTool(const QString &name);
|
||||
~ClangTool() override;
|
||||
|
||||
virtual void startTool(bool askUserForFileSelection) = 0;
|
||||
enum class FileSelection {
|
||||
AllFiles,
|
||||
CurrentFile,
|
||||
AskUser,
|
||||
};
|
||||
virtual void startTool(FileSelection fileSelection) = 0;
|
||||
|
||||
virtual Diagnostics read(OutputFileFormat outputFileFormat,
|
||||
const QString &logFilePath,
|
||||
@@ -58,7 +63,7 @@ public:
|
||||
QString *errorMessage) const = 0;
|
||||
|
||||
FileInfos collectFileInfos(ProjectExplorer::Project *project,
|
||||
bool askUserForFileSelection) const;
|
||||
FileSelection fileSelection) const;
|
||||
|
||||
// For testing.
|
||||
QSet<Diagnostic> diagnostics() const;
|
||||
@@ -67,6 +72,9 @@ public:
|
||||
|
||||
virtual void onNewDiagnosticsAvailable(const Diagnostics &diagnostics);
|
||||
|
||||
QAction *startAction() const { return m_startAction; }
|
||||
QAction *startOnCurrentFileAction() const { return m_startOnCurrentFileAction; }
|
||||
|
||||
signals:
|
||||
void finished(bool success); // For testing.
|
||||
|
||||
@@ -80,6 +88,7 @@ protected:
|
||||
QPointer<Debugger::DetailedErrorView> m_diagnosticView;
|
||||
|
||||
QAction *m_startAction = nullptr;
|
||||
QAction *m_startOnCurrentFileAction = nullptr;
|
||||
QAction *m_stopAction = nullptr;
|
||||
bool m_running = false;
|
||||
bool m_toolBusy = false;
|
||||
|
||||
Reference in New Issue
Block a user