forked from qt-creator/qt-creator
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:
@@ -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 ¯o) {
|
||||
return macro.key;
|
||||
return Utils::transform<ClangBackEnd::CompilerMacros>(projectPart->projectMacros,
|
||||
[] (const ProjectExplorer::Macro ¯o) {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user