Clang: Introduce CompilerMacro

We want not only the name but the value of the macro too. So we can
compare if anything has changed.

Change-Id: Ie59caf8cbf54d108f9e15299d25306a406b5c40d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-02-06 19:03:14 +01:00
parent 07fcd6f362
commit 56f79feebf
27 changed files with 251 additions and 77 deletions

View File

@@ -121,11 +121,11 @@ QStringList ProjectUpdater::compilerArguments(CppTools::ProjectPart *projectPart
return builder.build(CppTools::ProjectFile::CXXHeader, CompilerOptionsBuilder::PchUsage::None);
}
Utils::SmallStringVector ProjectUpdater::createMacroNames(CppTools::ProjectPart *projectPart)
ClangBackEnd::CompilerMacros ProjectUpdater::createCompilerMacros(CppTools::ProjectPart *projectPart)
{
return Utils::transform<Utils::SmallStringVector>(projectPart->projectMacros,
[] (const ProjectExplorer::Macro &macro) {
return macro.key;
return Utils::transform<ClangBackEnd::CompilerMacros>(projectPart->projectMacros,
[] (const ProjectExplorer::Macro &macro) {
return ClangBackEnd::CompilerMacro{macro.key, macro.value};
});
}
@@ -139,7 +139,7 @@ ClangBackEnd::V2::ProjectPartContainer ProjectUpdater::toProjectPartContainer(
return ClangBackEnd::V2::ProjectPartContainer(projectPart->displayName,
Utils::SmallStringVector(arguments),
createMacroNames(projectPart),
createCompilerMacros(projectPart),
std::move(headerAndSources.headers),
std::move(headerAndSources.sources));
}

View File

@@ -27,6 +27,7 @@
#include "clangpchmanager_global.h"
#include <compilermacro.h>
#include <filecontainerv2.h>
#include <filepathcachinginterface.h>
@@ -73,7 +74,7 @@ unittest_public:
void addToHeaderAndSources(HeaderAndSources &headerAndSources,
const CppTools::ProjectFile &projectFile) const;
static QStringList compilerArguments(CppTools::ProjectPart *projectPart);
static Utils::SmallStringVector createMacroNames(CppTools::ProjectPart *projectPart);
static ClangBackEnd::CompilerMacros createCompilerMacros(CppTools::ProjectPart *projectPart);
static Utils::PathStringVector createExcludedPaths(
const ClangBackEnd::V2::FileContainers &generatedFiles);