forked from qt-creator/qt-creator
Plugins: Add compilation database plugin
Introduce compilation database project support. Pass the arguments list for each file directly to ClangCodeModel via extraCodeModelFlags therefore introduce a dependency from the ClangCodeModel plugin. Change-Id: Iea5760d379de1ea246382dce56de0adf7ab5673d Task-number: QTCREATORBUG-21115 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -68,6 +68,14 @@ QStringList CompilerOptionsBuilder::build(CppTools::ProjectFile::Kind fileKind,
|
||||
addWordWidth();
|
||||
addTargetTriple();
|
||||
addExtraCodeModelFlags();
|
||||
|
||||
if (m_projectPart.toolchainType
|
||||
== ProjectExplorer::Constants::COMPILATION_DATABASE_TOOLCHAIN_TYPEID) {
|
||||
addHeaderPathOptions();
|
||||
insertWrappedQtHeaders();
|
||||
return options();
|
||||
}
|
||||
|
||||
updateLanguageOption(fileKind);
|
||||
addOptionsForLanguage(/*checkForBorlandExtensions*/ true);
|
||||
enableExceptions();
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "cppprojectfilecategorizer.h"
|
||||
|
||||
#include <projectexplorer/headerpath.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
@@ -56,6 +57,10 @@ public:
|
||||
|
||||
m_projectPart.warningFlags = m_flags.warningFlags;
|
||||
|
||||
// For compilation database pass the command line flags directly.
|
||||
if (m_projectPart.toolchainType == ProjectExplorer::Constants::COMPILATION_DATABASE_TOOLCHAIN_TYPEID)
|
||||
m_projectPart.extraCodeModelFlags = m_flags.commandLineFlags;
|
||||
|
||||
mapLanguageVersion();
|
||||
mapLanguageExtensions();
|
||||
|
||||
|
||||
@@ -66,6 +66,19 @@ ProjectUpdateInfo::ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
{
|
||||
}
|
||||
|
||||
ProjectUpdateInfo::ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ToolChainInfo &cToolChainInfo,
|
||||
const ToolChainInfo &cxxToolChainInfo,
|
||||
const RawProjectParts &rawProjectParts)
|
||||
: project(project)
|
||||
, rawProjectParts(rawProjectParts)
|
||||
, cToolChain(nullptr)
|
||||
, cxxToolChain(nullptr)
|
||||
, cToolChainInfo(cToolChainInfo)
|
||||
, cxxToolChainInfo(cxxToolChainInfo)
|
||||
{
|
||||
}
|
||||
|
||||
ProjectInfo::ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
||||
: m_project(project)
|
||||
{
|
||||
|
||||
@@ -70,6 +70,10 @@ public:
|
||||
const ProjectExplorer::ToolChain *cxxToolChain,
|
||||
const ProjectExplorer::Kit *kit,
|
||||
const RawProjectParts &rawProjectParts);
|
||||
ProjectUpdateInfo(ProjectExplorer::Project *project,
|
||||
const ToolChainInfo &cToolChainInfo,
|
||||
const ToolChainInfo &cxxToolChainInfo,
|
||||
const RawProjectParts &rawProjectParts);
|
||||
bool isValid() const { return project && !rawProjectParts.isEmpty(); }
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user