forked from qt-creator/qt-creator
Clang: Fix build
This amends commit cf4dbb4bb6
.
Change-Id: Ib74fba38348a02f6bb9d254b7a5e9013a2013942
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
1c82a53e74
commit
5e483d04bc
@@ -146,7 +146,7 @@ Utils::PathStringVector generatedFilePaths(const V2::FileContainers &generaredFi
|
||||
generaredFilePaths.reserve(generaredFiles.size());
|
||||
|
||||
for (const V2::FileContainer &generatedFile : generaredFiles)
|
||||
generaredFilePaths.push_back(generatedFile.filePath().path());
|
||||
generaredFilePaths.push_back(generatedFile.filePath.path());
|
||||
|
||||
return generaredFilePaths;
|
||||
}
|
||||
@@ -156,7 +156,7 @@ Utils::PathStringVector generatedFilePaths(const V2::FileContainers &generaredFi
|
||||
Utils::PathStringVector PchCreator::generateGlobalHeaderPaths() const
|
||||
{
|
||||
auto includeFunction = [&] (const V2::ProjectPartContainer &projectPart) {
|
||||
return m_filePathCache.filePaths(projectPart.headerPathIds());
|
||||
return m_filePathCache.filePaths(projectPart.headerPathIds);
|
||||
};
|
||||
|
||||
Utils::PathStringVector headerPaths = generateGlobal<Utils::PathStringVector>(m_projectParts,
|
||||
@@ -175,7 +175,7 @@ Utils::PathStringVector PchCreator::generateGlobalHeaderPaths() const
|
||||
Utils::PathStringVector PchCreator::generateGlobalSourcePaths() const
|
||||
{
|
||||
auto sourceFunction = [&] (const V2::ProjectPartContainer &projectPart) {
|
||||
return m_filePathCache.filePaths(projectPart.sourcePathIds());
|
||||
return m_filePathCache.filePaths(projectPart.sourcePathIds);
|
||||
};
|
||||
|
||||
return generateGlobal<Utils::PathStringVector>(m_projectParts, sourceFunction);
|
||||
@@ -197,7 +197,7 @@ Utils::SmallStringVector PchCreator::generateGlobalArguments() const
|
||||
|
||||
auto argumentFunction = [] (const V2::ProjectPartContainer &projectPart)
|
||||
-> const Utils::SmallStringVector & {
|
||||
return projectPart.arguments();
|
||||
return projectPart.arguments;
|
||||
};
|
||||
|
||||
generateGlobal(arguments, m_projectParts, argumentFunction);
|
||||
@@ -212,7 +212,7 @@ Utils::SmallStringVector PchCreator::generateGlobalCommandLine() const
|
||||
|
||||
auto argumentFunction = [] (const V2::ProjectPartContainer &projectPart)
|
||||
-> const Utils::SmallStringVector & {
|
||||
return projectPart.arguments();
|
||||
return projectPart.arguments;
|
||||
};
|
||||
|
||||
generateGlobal(commandLine, m_projectParts, argumentFunction);
|
||||
@@ -324,10 +324,10 @@ namespace {
|
||||
|
||||
void hashProjectPart(QCryptographicHash &hash, const V2::ProjectPartContainer &projectPart)
|
||||
{
|
||||
const auto &projectPartId = projectPart.projectPartId();
|
||||
const auto &projectPartId = projectPart.projectPartId;
|
||||
hash.addData(projectPartId.data(), projectPartId.size());
|
||||
|
||||
for (const auto &argument : projectPart.arguments())
|
||||
for (const auto &argument : projectPart.arguments)
|
||||
hash.addData(argument.data(), argument.size());
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ Utils::SmallString PchCreator::generateGlobalPchFilePath() const
|
||||
Utils::SmallStringVector PchCreator::generateProjectPartCommandLine(
|
||||
const V2::ProjectPartContainer &projectPart) const
|
||||
{
|
||||
const Utils::SmallStringVector &arguments = projectPart.arguments();
|
||||
const Utils::SmallStringVector &arguments = projectPart.arguments;
|
||||
|
||||
Utils::SmallStringVector commandLine;
|
||||
commandLine.reserve(arguments.size() + 1);
|
||||
@@ -400,10 +400,10 @@ Utils::PathStringVector PchCreator::generateProjectPartHeaders(
|
||||
const V2::ProjectPartContainer &projectPart) const
|
||||
{
|
||||
Utils::PathStringVector headerPaths;
|
||||
headerPaths.reserve(projectPart.headerPathIds().size() + m_generatedFiles.size());
|
||||
headerPaths.reserve(projectPart.headerPathIds.size() + m_generatedFiles.size());
|
||||
|
||||
std::transform(projectPart.headerPathIds().begin(),
|
||||
projectPart.headerPathIds().end(),
|
||||
std::transform(projectPart.headerPathIds.begin(),
|
||||
projectPart.headerPathIds.end(),
|
||||
std::back_inserter(headerPaths),
|
||||
[&] (FilePathId filePathId) {
|
||||
return m_filePathCache.filePath(filePathId);
|
||||
@@ -459,10 +459,10 @@ Utils::PathStringVector PchCreator::generateProjectPartHeaderAndSourcePaths(
|
||||
const V2::ProjectPartContainer &projectPart) const
|
||||
{
|
||||
Utils::PathStringVector includeAndSources;
|
||||
includeAndSources.reserve(projectPart.headerPathIds().size() + projectPart.sourcePathIds().size());
|
||||
includeAndSources.reserve(projectPart.headerPathIds.size() + projectPart.sourcePathIds.size());
|
||||
|
||||
appendFilePathId(includeAndSources, projectPart.headerPathIds(), m_filePathCache);
|
||||
appendFilePathId(includeAndSources, projectPart.sourcePathIds(), m_filePathCache);
|
||||
appendFilePathId(includeAndSources, projectPart.headerPathIds, m_filePathCache);
|
||||
appendFilePathId(includeAndSources, projectPart.sourcePathIds, m_filePathCache);
|
||||
|
||||
return includeAndSources;
|
||||
}
|
||||
@@ -536,7 +536,7 @@ Utils::SmallStringVector PchCreator::generateProjectPartPchCompilerArguments(
|
||||
Utils::SmallStringVector PchCreator::generateProjectPartClangCompilerArguments(
|
||||
const V2::ProjectPartContainer &projectPart) const
|
||||
{
|
||||
Utils::SmallStringVector compilerArguments = projectPart.arguments().clone();
|
||||
Utils::SmallStringVector compilerArguments = projectPart.arguments.clone();
|
||||
const auto pchArguments = generateProjectPartPchCompilerArguments(projectPart);
|
||||
|
||||
append(compilerArguments, pchArguments);
|
||||
@@ -556,9 +556,9 @@ IdPaths PchCreator::generateProjectPartPch(const V2::ProjectPartContainer &proje
|
||||
generateFileWithContent(pchIncludeFilePath, content);
|
||||
|
||||
generatePch(generateProjectPartClangCompilerArguments(projectPart),
|
||||
{projectPart.projectPartId().clone(), std::move(pchFilePath), lastModified});
|
||||
{projectPart.projectPartId.clone(), std::move(pchFilePath), lastModified});
|
||||
|
||||
return {projectPart.projectPartId().clone(), std::move(allExternalIncludes)};
|
||||
return {projectPart.projectPartId.clone(), std::move(allExternalIncludes)};
|
||||
}
|
||||
|
||||
void PchCreator::generatePchs()
|
||||
|
@@ -50,10 +50,10 @@ ClangQueryGatherer::createSourceRangesForSource(
|
||||
{
|
||||
ClangQuery clangQuery(*filePathCache, std::move(query));
|
||||
|
||||
clangQuery.addFile(std::string(source.filePath().directory()),
|
||||
std::string(source.filePath().name()),
|
||||
std::string(source.takeUnsavedFileContent()),
|
||||
std::vector<std::string>(source.takeCommandLineArguments()));
|
||||
clangQuery.addFile(std::string(source.filePath.directory()),
|
||||
std::string(source.filePath.name()),
|
||||
std::string(source.unsavedFileContent),
|
||||
std::vector<std::string>(source.commandLineArguments));
|
||||
|
||||
clangQuery.addUnsavedFiles(unsaved);
|
||||
|
||||
|
@@ -102,8 +102,8 @@ void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
|
||||
m_unsavedFileContents.reserve(m_unsavedFileContents.size() + unsavedFiles.size());
|
||||
|
||||
auto convertToUnsavedFileContent = [] (const V2::FileContainer &unsavedFile) {
|
||||
return UnsavedFileContent{toNativePath(unsavedFile.filePath().path().clone()),
|
||||
unsavedFile.unsavedFileContent().clone()};
|
||||
return UnsavedFileContent{toNativePath(unsavedFile.filePath.path().clone()),
|
||||
unsavedFile.unsavedFileContent.clone()};
|
||||
};
|
||||
|
||||
std::transform(unsavedFiles.begin(),
|
||||
|
@@ -58,18 +58,18 @@ void RefactoringServer::end()
|
||||
|
||||
void RefactoringServer::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
|
||||
{
|
||||
SymbolFinder symbolFinder(message.line(), message.column(), m_filePathCache);
|
||||
SymbolFinder symbolFinder(message.line, message.column, m_filePathCache);
|
||||
|
||||
symbolFinder.addFile(std::string(message.filePath().directory()),
|
||||
std::string(message.filePath().name()),
|
||||
std::string(message.unsavedContent()),
|
||||
std::vector<std::string>(message.commandLine()));
|
||||
symbolFinder.addFile(std::string(message.filePath.directory()),
|
||||
std::string(message.filePath.name()),
|
||||
std::string(message.unsavedContent),
|
||||
std::vector<std::string>(message.commandLine));
|
||||
|
||||
symbolFinder.findSymbol();
|
||||
|
||||
client()->sourceLocationsForRenamingMessage({symbolFinder.takeSymbolName(),
|
||||
symbolFinder.takeSourceLocations(),
|
||||
message.textDocumentRevision()});
|
||||
message.textDocumentRevision});
|
||||
}
|
||||
|
||||
void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
|
||||
@@ -77,10 +77,10 @@ void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
|
||||
{
|
||||
ClangQuery clangQuery(m_filePathCache, message.takeQuery());
|
||||
|
||||
clangQuery.addFile(std::string(message.source().filePath().directory()),
|
||||
std::string(message.source().filePath().name()),
|
||||
std::string(message.source().unsavedFileContent()),
|
||||
std::vector<std::string>(message.source().commandLineArguments()));
|
||||
clangQuery.addFile(std::string(message.source.filePath.directory()),
|
||||
std::string(message.source.filePath.name()),
|
||||
std::string(message.source.unsavedFileContent),
|
||||
std::vector<std::string>(message.source.commandLineArguments));
|
||||
|
||||
clangQuery.findLocations();
|
||||
|
||||
|
@@ -179,7 +179,7 @@ void SourceRangeExtractor::addSourceRanges(const std::vector<clang::SourceRange>
|
||||
|
||||
const std::vector<SourceRangeWithTextContainer> &SourceRangeExtractor::sourceRangeWithTextContainers() const
|
||||
{
|
||||
return sourceRangesContainer.sourceRangeWithTextContainers();
|
||||
return sourceRangesContainer.sourceRangeWithTextContainers;
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
@@ -69,7 +69,7 @@ TEST_F(ClangQuery, NoSourceRangesForDefaultConstruction)
|
||||
{
|
||||
auto sourceRanges = simpleFunctionQuery.takeSourceRanges();
|
||||
|
||||
ASSERT_THAT(sourceRanges.sourceRangeWithTextContainers(), IsEmpty());
|
||||
ASSERT_THAT(sourceRanges.sourceRangeWithTextContainers, IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ClangQuerySlowTest, SourceRangesForSimpleFunctionDeclarationAreNotEmpty)
|
||||
@@ -78,7 +78,7 @@ TEST_F(ClangQuerySlowTest, SourceRangesForSimpleFunctionDeclarationAreNotEmpty)
|
||||
|
||||
simpleFunctionQuery.findLocations();
|
||||
|
||||
ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers(), Not(IsEmpty()));
|
||||
ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers, Not(IsEmpty()));
|
||||
}
|
||||
|
||||
TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFunctionDeclarationRange)
|
||||
@@ -87,7 +87,7 @@ TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFunctionDeclarationRange)
|
||||
|
||||
simpleFunctionQuery.findLocations();
|
||||
|
||||
ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers(),
|
||||
ASSERT_THAT(simpleFunctionQuery.takeSourceRanges().sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 8, 2, "int function(int* pointer, int value)\n{\n if (pointer == nullptr) {\n return value + 1;\n } else {\n return value - 1;\n }\n}")));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
|
||||
|
||||
query.findLocations();
|
||||
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 15, "void unsaved();")));
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
||||
|
||||
query.findLocations();
|
||||
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 12, "void f() {}")));
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOver
|
||||
|
||||
query.findLocations();
|
||||
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers(),
|
||||
ASSERT_THAT(query.takeSourceRanges().sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 15, "void unsaved();")));
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ TEST_F(ClangQuerySlowTest, RootSourceRangeForSimpleFieldDeclarationRange)
|
||||
|
||||
simpleClassQuery.findLocations();
|
||||
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers().at(0),
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers.at(0),
|
||||
IsSourceRangeWithText(4, 5, 4, 10, " int x;"));
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ TEST_F(ClangQuerySlowTest, NoSourceRangesForEmptyQuery)
|
||||
{
|
||||
simpleClassQuery.findLocations();
|
||||
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers(), IsEmpty());
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers, IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ClangQuerySlowTest, NoSourceRangesForWrongQuery)
|
||||
@@ -154,7 +154,7 @@ TEST_F(ClangQuerySlowTest, NoSourceRangesForWrongQuery)
|
||||
|
||||
simpleClassQuery.findLocations();
|
||||
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers(), IsEmpty());
|
||||
ASSERT_THAT(simpleClassQuery.takeSourceRanges().sourceRangeWithTextContainers, IsEmpty());
|
||||
}
|
||||
|
||||
TEST_F(ClangQuerySlowTest, NoDiagnosticsForDefaultConstruction)
|
||||
|
@@ -48,13 +48,13 @@ using testing::Contains;
|
||||
using testing::Each;
|
||||
using testing::ElementsAre;
|
||||
using testing::Eq;
|
||||
using testing::Field;
|
||||
using testing::Ge;
|
||||
using testing::IsEmpty;
|
||||
using testing::Le;
|
||||
using testing::NiceMock;
|
||||
using testing::Pair;
|
||||
using testing::PrintToString;
|
||||
using testing::Property;
|
||||
using testing::SizeIs;
|
||||
using testing::UnorderedElementsAre;
|
||||
using testing::_;
|
||||
@@ -71,8 +71,8 @@ MATCHER_P2(Contains, line, column,
|
||||
+ ")"
|
||||
)
|
||||
{
|
||||
return arg.line() == uint(line)
|
||||
&& arg.column() == uint(column);
|
||||
return arg.line == uint(line)
|
||||
&& arg.column == uint(column);
|
||||
}
|
||||
|
||||
class ClangQueryGatherer : public ::testing::Test
|
||||
@@ -111,8 +111,8 @@ TEST_F(ClangQueryGatherer, CreateSourceRanges)
|
||||
auto sourceRangesAndDiagnostics = gatherer.createSourceRangesForSource(&filePathCache, source.clone(), {unsaved}, query.clone());
|
||||
|
||||
ASSERT_THAT(sourceRangesAndDiagnostics,
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))));
|
||||
}
|
||||
|
||||
@@ -121,8 +121,8 @@ TEST_F(ClangQueryGatherer, CreateSourceRangessWithUnsavedContent)
|
||||
auto sourceRangesAndDiagnostics = gatherer.createSourceRangesForSource(&filePathCache, source.clone(), {unsaved}, query.clone());
|
||||
|
||||
ASSERT_THAT(sourceRangesAndDiagnostics,
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
|
||||
}
|
||||
|
||||
@@ -143,8 +143,8 @@ TEST_F(ClangQueryGatherer, CreateSourceRangesForNextSource)
|
||||
auto sourceRangesAndDiagnostics = gatherer.createNextSourceRanges();
|
||||
|
||||
ASSERT_THAT(sourceRangesAndDiagnostics,
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
|
||||
}
|
||||
|
||||
@@ -161,8 +161,8 @@ TEST_F(ClangQueryGatherer, StartCreateSourceRangesForNextSource)
|
||||
future.wait();
|
||||
|
||||
ASSERT_THAT(future.get(),
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 9, "void f();")))));
|
||||
}
|
||||
|
||||
@@ -195,12 +195,12 @@ TEST_F(ClangQueryGatherer, AfterStartCreateSourceRangesMessagesGetCollected)
|
||||
|
||||
ASSERT_THAT(manyGatherer.allCurrentProcessedMessages(),
|
||||
UnorderedElementsAre(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
|
||||
IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
|
||||
IsSourceRangeWithText(3, 1, 3, 15, "int function();"))))));
|
||||
@@ -216,13 +216,13 @@ TEST_F(ClangQueryGatherer, GetFinishedMessages)
|
||||
ASSERT_THAT(messages,
|
||||
AllOf(SizeIs(2),
|
||||
UnorderedElementsAre(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
|
||||
IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
|
||||
IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
|
||||
@@ -241,8 +241,8 @@ TEST_F(ClangQueryGatherer, GetFinishedMessagesAfterSecondPass)
|
||||
ASSERT_THAT(messages,
|
||||
AllOf(SizeIs(1),
|
||||
ElementsAre(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
|
||||
}
|
||||
@@ -258,18 +258,18 @@ TEST_F(ClangQueryGatherer, FilterDuplicates)
|
||||
ASSERT_THAT(messages,
|
||||
AllOf(SizeIs(3),
|
||||
UnorderedElementsAre(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(1, 1, 1, 9, "void f();"),
|
||||
IsSourceRangeWithText(2, 1, 2, 12, "void f() {}")))),
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(1, 1, 1, 13, "int header();"),
|
||||
IsSourceRangeWithText(3, 1, 3, 15, "int function();")))),
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
UnorderedElementsAre(
|
||||
IsSourceRangeWithText(3, 1, 3, 15, "int function();")))))));
|
||||
}
|
||||
|
@@ -41,9 +41,9 @@ namespace {
|
||||
|
||||
using testing::_;
|
||||
using testing::AllOf;
|
||||
using testing::Field;
|
||||
using testing::NiceMock;
|
||||
using testing::NotNull;
|
||||
using testing::Property;
|
||||
using testing::Return;
|
||||
using testing::ReturnNew;
|
||||
using testing::DefaultValue;
|
||||
@@ -166,9 +166,9 @@ TEST_F(ClangQueryProjectFindFilter, CallingRequestSourceRangesAndDiagnostics)
|
||||
EXPECT_CALL(mockRefactoringServer,
|
||||
requestSourceRangesAndDiagnosticsForQueryMessage(
|
||||
AllOf(
|
||||
Property(&Message::source,
|
||||
Property(&FileContainer::unsavedFileContent, exampleContent)),
|
||||
Property(&Message::query, queryText))));
|
||||
Field(&Message::source,
|
||||
Field(&FileContainer::unsavedFileContent, exampleContent)),
|
||||
Field(&Message::query, queryText))));
|
||||
|
||||
findFilter.requestSourceRangesAndDiagnostics(QString(queryText), QString(exampleContent));
|
||||
}
|
||||
|
@@ -41,19 +41,19 @@ MATCHER_P5(HasDiagnosticMessage, errorTypeText, startLine, startColumn, endLine,
|
||||
+ ")}"
|
||||
)
|
||||
{
|
||||
if (!arg.empty() && arg.front().messages().empty()) {
|
||||
if (!arg.empty() && arg.front().messages.empty()) {
|
||||
*result_listener << "no messages";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto message = arg.front().messages().front();
|
||||
auto sourceRange = message.sourceRange();
|
||||
auto message = arg.front().messages.front();
|
||||
auto sourceRange = message.sourceRange;
|
||||
|
||||
return message.errorTypeText() == errorTypeText
|
||||
&& sourceRange.start().line() == uint(startLine)
|
||||
&& sourceRange.start().column() == uint(startColumn)
|
||||
&& sourceRange.end().line() == uint(endLine)
|
||||
&& sourceRange.end().column() == uint(endColumn);
|
||||
&& sourceRange.start.line == uint(startLine)
|
||||
&& sourceRange.start.column == uint(startColumn)
|
||||
&& sourceRange.end.line == uint(endLine)
|
||||
&& sourceRange.end.column == uint(endColumn);
|
||||
}
|
||||
|
||||
MATCHER_P5(HasDiagnosticContext, contextTypeText, startLine, startColumn, endLine, endColumn,
|
||||
@@ -66,19 +66,19 @@ MATCHER_P5(HasDiagnosticContext, contextTypeText, startLine, startColumn, endLin
|
||||
+ ")}"
|
||||
)
|
||||
{
|
||||
if (!arg.empty() && arg.front().messages().empty()) {
|
||||
if (!arg.empty() && arg.front().messages.empty()) {
|
||||
*result_listener << "no context";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto context = arg.front().contexts().front();
|
||||
auto sourceRange = context.sourceRange();
|
||||
auto context = arg.front().contexts.front();
|
||||
auto sourceRange = context.sourceRange;
|
||||
|
||||
return context.contextTypeText() == contextTypeText
|
||||
&& sourceRange.start().line() == uint(startLine)
|
||||
&& sourceRange.start().column() == uint(startColumn)
|
||||
&& sourceRange.end().line() == uint(endLine)
|
||||
&& sourceRange.end().column() == uint(endColumn);
|
||||
&& sourceRange.start.line == uint(startLine)
|
||||
&& sourceRange.start.column == uint(startColumn)
|
||||
&& sourceRange.end.line == uint(endLine)
|
||||
&& sourceRange.end.column == uint(endColumn);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -302,7 +302,7 @@ TEST_F(PchCreatorVerySlowTest, DISABLED_CreatePartPchs)
|
||||
|
||||
auto includePaths = creator.generateProjectPartPch(projectPart1);
|
||||
|
||||
ASSERT_THAT(includePaths.id, projectPart1.projectPartId());
|
||||
ASSERT_THAT(includePaths.id, projectPart1.projectPartId);
|
||||
ASSERT_THAT(includePaths.filePathIds,
|
||||
AllOf(Contains(FilePathId{1, 1}),
|
||||
Contains(FilePathId{1, 2}),
|
||||
|
@@ -96,9 +96,9 @@ TEST_F(RefactoringClient, SourceLocationsForRenaming)
|
||||
{
|
||||
client.setLocalRenamingCallback(mockLocalRenaming.AsStdFunction());
|
||||
|
||||
EXPECT_CALL(mockLocalRenaming, Call(renameMessage.symbolName().toQString(),
|
||||
renameMessage.sourceLocations(),
|
||||
renameMessage.textDocumentRevision()));
|
||||
EXPECT_CALL(mockLocalRenaming, Call(renameMessage.symbolName.toQString(),
|
||||
renameMessage.sourceLocations,
|
||||
renameMessage.textDocumentRevision));
|
||||
|
||||
client.sourceLocationsForRenamingMessage(std::move(renameMessage));
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ namespace {
|
||||
|
||||
using testing::AllOf;
|
||||
using testing::Contains;
|
||||
using testing::Field;
|
||||
using testing::IsEmpty;
|
||||
using testing::NiceMock;
|
||||
using testing::Not;
|
||||
@@ -72,8 +73,8 @@ MATCHER_P2(IsSourceLocation, line, column,
|
||||
+ ")"
|
||||
)
|
||||
{
|
||||
return arg.line() == uint(line)
|
||||
&& arg.column() == uint(column);
|
||||
return arg.line == uint(line)
|
||||
&& arg.column == uint(column);
|
||||
}
|
||||
|
||||
class RefactoringServer : public ::testing::Test
|
||||
@@ -116,9 +117,9 @@ TEST_F(RefactoringServerSlowTest, RequestSourceLocationsForRenamingMessage)
|
||||
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceLocationsForRenamingMessage(
|
||||
AllOf(Property(&SourceLocationsForRenamingMessage::textDocumentRevision, 1),
|
||||
Property(&SourceLocationsForRenamingMessage::symbolName, "v"),
|
||||
Property(&SourceLocationsForRenamingMessage::sourceLocations,
|
||||
AllOf(Field(&SourceLocationsForRenamingMessage::textDocumentRevision, 1),
|
||||
Field(&SourceLocationsForRenamingMessage::symbolName, "v"),
|
||||
Field(&SourceLocationsForRenamingMessage::sourceLocations,
|
||||
Property(&SourceLocationsContainer::sourceLocationContainers,
|
||||
AllOf(Contains(IsSourceLocation(1, 5)),
|
||||
Contains(IsSourceLocation(3, 9))))))));
|
||||
@@ -134,8 +135,8 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesForQueryMessage)
|
||||
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
|
||||
|
||||
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
|
||||
@@ -156,8 +157,8 @@ TEST_F(RefactoringServerSlowTest, RequestSingleSourceRangesAndDiagnosticsWithUns
|
||||
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 9, unsavedContent))))));
|
||||
|
||||
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
|
||||
@@ -171,13 +172,13 @@ TEST_F(RefactoringServerSlowTest, RequestTwoSourceRangesForQueryMessage)
|
||||
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))));
|
||||
|
||||
refactoringServer.requestSourceRangesForQueryMessage(std::move(message));
|
||||
@@ -195,13 +196,13 @@ TEST_F(RefactoringServerVerySlowTest, RequestManySourceRangesForQueryMessage)
|
||||
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent))))));
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesForQueryMessage(
|
||||
Property(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Not(Contains(IsSourceRangeWithText(1, 1, 2, 4, sourceContent)))))))
|
||||
.Times(processingSlotCount + 2);
|
||||
|
||||
@@ -269,10 +270,10 @@ TEST_F(RefactoringServerSlowTest, ForValidRequestSourceRangesAndDiagnosticsGetSo
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesAndDiagnosticsForQueryMessage(
|
||||
AllOf(
|
||||
Property(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Contains(IsSourceRangeWithText(1, 1, 1, 12, "void f() {}")))),
|
||||
Property(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
|
||||
Field(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
|
||||
IsEmpty()))));
|
||||
|
||||
refactoringServer.requestSourceRangesAndDiagnosticsForQueryMessage(std::move(message));
|
||||
@@ -288,10 +289,10 @@ TEST_F(RefactoringServerSlowTest, ForInvalidRequestSourceRangesAndDiagnosticsGet
|
||||
EXPECT_CALL(mockRefactoringClient,
|
||||
sourceRangesAndDiagnosticsForQueryMessage(
|
||||
AllOf(
|
||||
Property(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
|
||||
Property(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
Field(&SourceRangesAndDiagnosticsForQueryMessage::sourceRanges,
|
||||
Field(&SourceRangesContainer::sourceRangeWithTextContainers,
|
||||
IsEmpty())),
|
||||
Property(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
|
||||
Field(&SourceRangesAndDiagnosticsForQueryMessage::diagnostics,
|
||||
Not(IsEmpty())))));
|
||||
|
||||
refactoringServer.requestSourceRangesAndDiagnosticsForQueryMessage(std::move(message));
|
||||
|
@@ -40,10 +40,10 @@ MATCHER_P4(IsSourceRange, startLine, startColumn, endLine, endColumn,
|
||||
+ ")]"
|
||||
)
|
||||
{
|
||||
return arg.start().line() == uint(startLine)
|
||||
&& arg.start().column() == uint(startColumn)
|
||||
&& arg.end().line() == uint(endLine)
|
||||
&& arg.end().column() == uint(endColumn);
|
||||
return arg.start.line == uint(startLine)
|
||||
&& arg.start.column == uint(startColumn)
|
||||
&& arg.end.line == uint(endLine)
|
||||
&& arg.end.column == uint(endColumn);
|
||||
}
|
||||
|
||||
MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, text,
|
||||
@@ -56,11 +56,11 @@ MATCHER_P5(IsSourceRangeWithText, startLine, startColumn, endLine, endColumn, te
|
||||
+ ")"
|
||||
)
|
||||
{
|
||||
return arg.start().line() == uint(startLine)
|
||||
&& arg.start().column() == uint(startColumn)
|
||||
&& arg.end().line() == uint(endLine)
|
||||
&& arg.end().column() == uint(endColumn)
|
||||
&& arg.text().toCarriageReturnsStripped() == text;
|
||||
return arg.start.line == uint(startLine)
|
||||
&& arg.start.column == uint(startColumn)
|
||||
&& arg.end.line == uint(endLine)
|
||||
&& arg.end.column == uint(endColumn)
|
||||
&& arg.text.toCarriageReturnsStripped() == text;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -42,11 +42,7 @@ MATCHER_P2(IsSourceLocation, line, column,
|
||||
+ ", column " + PrintToString(column)
|
||||
)
|
||||
{
|
||||
if (arg.line() != uint(line)
|
||||
|| arg.column() != uint(column))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return arg.line == uint(line) && arg.column == uint(column);
|
||||
}
|
||||
|
||||
MATCHER_P(StrEq, text,
|
||||
|
Reference in New Issue
Block a user