diff options
| author | Christian Kandeler <[email protected]> | 2025-01-21 13:50:38 +0100 |
|---|---|---|
| committer | Christian Kandeler <[email protected]> | 2025-01-23 08:31:29 +0000 |
| commit | 2bac487904d030fee3cb6b9d053cef86ac320304 (patch) | |
| tree | 01f7024d75effadb0b2239774858aa01168ae27c /src/plugins/cppcheck/cppcheckplugin.cpp | |
| parent | ca561567c4f13f30f8ee5add7dba84b9481a7ebe (diff) | |
ProjectExplorer: Add convenience accessors to some classes
Namely, Kit, BuildConfiguration, BuildSystem and RunConfiguration get
functions to retrieve the active instance for a given project as well as
the one for the current and active projects, respectively.
This saves a ton of annoying null pointer checks.
Some of these functions replace existing ones with the same purpose that
were scattered around the code base.
Change-Id: I18247061229bbeb8b8ad1e15a2bd7a6626438bc0
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/cppcheck/cppcheckplugin.cpp')
| -rw-r--r-- | src/plugins/cppcheck/cppcheckplugin.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/cppcheck/cppcheckplugin.cpp b/src/plugins/cppcheck/cppcheckplugin.cpp index 87a7380b796..53f962535aa 100644 --- a/src/plugins/cppcheck/cppcheckplugin.cpp +++ b/src/plugins/cppcheck/cppcheckplugin.cpp @@ -160,10 +160,10 @@ void CppcheckPluginPrivate::startManualRun() void CppcheckPluginPrivate::updateManualRunAction() { const Project *project = ProjectManager::startupProject(); - const Target *target = ProjectManager::startupTarget(); + const Kit *kit = activeKitForActiveProject(); const Utils::Id cxx = ProjectExplorer::Constants::CXX_LANGUAGE_ID; - const bool canRun = target && project->projectLanguages().contains(cxx) - && ToolchainKitAspect::cxxToolchain(target->kit()); + const bool canRun = kit && project->projectLanguages().contains(cxx) + && ToolchainKitAspect::cxxToolchain(kit); manualRunAction->setEnabled(canRun); } |
