forked from qt-creator/qt-creator
ClangCodeModel: Do not dump compile_commands.json into project dir
We can't know if it's safe to put there; e.g. we might overwrite an existing one. Fixes: QTCREATORBUG-27573 Change-Id: I928408996759aaccb84332fcf95cf43d7f3bf083 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -34,8 +34,6 @@
|
|||||||
# include "test/clangfixittest.h"
|
# include "test/clangfixittest.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <utils/runextensions.h>
|
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
@@ -45,6 +43,7 @@
|
|||||||
#include <cppeditor/cppmodelmanager.h>
|
#include <cppeditor/cppmodelmanager.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectpanelfactory.h>
|
#include <projectexplorer/projectpanelfactory.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
@@ -53,6 +52,9 @@
|
|||||||
|
|
||||||
#include <texteditor/textmark.h>
|
#include <texteditor/textmark.h>
|
||||||
|
|
||||||
|
#include <utils/temporarydirectory.h>
|
||||||
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
@@ -69,10 +71,13 @@ void ClangCodeModelPlugin::generateCompilationDB()
|
|||||||
const auto projectInfo = CppModelManager::instance()->projectInfo(target->project());
|
const auto projectInfo = CppModelManager::instance()->projectInfo(target->project());
|
||||||
if (!projectInfo)
|
if (!projectInfo)
|
||||||
return;
|
return;
|
||||||
|
FilePath baseDir = projectInfo->buildRoot();
|
||||||
|
if (baseDir == target->project()->projectDirectory())
|
||||||
|
baseDir = TemporaryDirectory::masterDirectoryFilePath();
|
||||||
|
|
||||||
QFuture<GenerateCompilationDbResult> task
|
QFuture<GenerateCompilationDbResult> task
|
||||||
= Utils::runAsync(&Internal::generateCompilationDB, projectInfo,
|
= Utils::runAsync(&Internal::generateCompilationDB, projectInfo,
|
||||||
projectInfo->buildRoot(), CompilationDbPurpose::Project,
|
baseDir, CompilationDbPurpose::Project,
|
||||||
warningsConfigForProject(target->project()),
|
warningsConfigForProject(target->project()),
|
||||||
globalClangOptions(),
|
globalClangOptions(),
|
||||||
FilePath());
|
FilePath());
|
||||||
|
Reference in New Issue
Block a user