ClangRefactoring: Fix project part id

We used display name which is part of project part id instead of the id
getter.

Change-Id: I97aa343c4380f9eb8c8e6a4400156eeac1f40863
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-09-10 17:47:42 +02:00
parent 0aced361bf
commit 75c95d4b73
2 changed files with 8 additions and 5 deletions

View File

@@ -188,7 +188,7 @@ ClangBackEnd::V2::ProjectPartContainer ProjectUpdater::toProjectPartContainer(
HeaderAndSources headerAndSources = headerAndSourcesFromProjectPart(projectPart); HeaderAndSources headerAndSources = headerAndSourcesFromProjectPart(projectPart);
return ClangBackEnd::V2::ProjectPartContainer(projectPart->displayName, return ClangBackEnd::V2::ProjectPartContainer(projectPart->id(),
Utils::SmallStringVector(arguments), Utils::SmallStringVector(arguments),
createCompilerMacros(projectPart->projectMacros), createCompilerMacros(projectPart->projectMacros),
createIncludeSearchPaths(projectPart->headerPaths), createIncludeSearchPaths(projectPart->headerPaths),

View File

@@ -82,15 +82,18 @@ protected:
projectPart.files.push_back(header2ProjectFile); projectPart.files.push_back(header2ProjectFile);
projectPart.files.push_back(source1ProjectFile); projectPart.files.push_back(source1ProjectFile);
projectPart.files.push_back(source2ProjectFile); projectPart.files.push_back(source2ProjectFile);
projectPart.displayName = QString(projectPartId); projectPart.displayName = "project1";
projectPart.projectMacros = {{"FOO", "2"}, {"BAR", "1"}}; projectPart.projectMacros = {{"FOO", "2"}, {"BAR", "1"}};
projectPartId = projectPart.id();
projectPart2.files.push_back(header2ProjectFile); projectPart2.files.push_back(header2ProjectFile);
projectPart2.files.push_back(header1ProjectFile); projectPart2.files.push_back(header1ProjectFile);
projectPart2.files.push_back(source2ProjectFile); projectPart2.files.push_back(source2ProjectFile);
projectPart2.files.push_back(source1ProjectFile); projectPart2.files.push_back(source1ProjectFile);
projectPart2.displayName = QString(projectPartId2); projectPart2.displayName = "project2";
projectPart2.projectMacros = {{"BAR", "1"}, {"FOO", "2"}}; projectPart2.projectMacros = {{"BAR", "1"}, {"FOO", "2"}};
projectPartId2 = projectPart2.id();
Utils::SmallStringVector arguments{ClangPchManager::ProjectUpdater::compilerArguments( Utils::SmallStringVector arguments{ClangPchManager::ProjectUpdater::compilerArguments(
&projectPart)}; &projectPart)};
@@ -120,8 +123,8 @@ protected:
MockPchManagerNotifier mockPchManagerNotifier{pchManagerClient}; MockPchManagerNotifier mockPchManagerNotifier{pchManagerClient};
NiceMock<MockPchManagerServer> mockPchManagerServer; NiceMock<MockPchManagerServer> mockPchManagerServer;
ClangPchManager::ProjectUpdater updater{mockPchManagerServer, filePathCache}; ClangPchManager::ProjectUpdater updater{mockPchManagerServer, filePathCache};
Utils::SmallString projectPartId{"project1"}; Utils::SmallString projectPartId;
Utils::SmallString projectPartId2{"project2"}; Utils::SmallString projectPartId2;
Utils::PathStringVector headerPaths = {"/path/to/header1.h", "/path/to/header2.h"}; Utils::PathStringVector headerPaths = {"/path/to/header1.h", "/path/to/header2.h"};
Utils::PathStringVector sourcePaths = {"/path/to/source1.cpp", "/path/to/source2.cpp"}; Utils::PathStringVector sourcePaths = {"/path/to/source1.cpp", "/path/to/source2.cpp"};
ClangBackEnd::CompilerMacros compilerMacros = {{"BAR", "1"}, {"FOO", "2"}}; ClangBackEnd::CompilerMacros compilerMacros = {{"BAR", "1"}, {"FOO", "2"}};