summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2020-06-13 16:06:33 +0200
committerMarco Bubke <marco.bubke@qt.io>2020-06-30 09:52:42 +0000
commitc924a45fb23b711f810b9f71416c9de0cdf7fb8a (patch)
tree2bb428cb3f5980e4a9e5c79e18930401e37974ec
parent36b72e2bab6a5baddc9de21a25b4498dc66f2dc0 (diff)
downloadqt-creator-c924a45fb23b711f810b9f71416c9de0cdf7fb8a.tar.gz
Refactoring: Fix unit tests
One if the LLVM 10 hot fixes was not working. Change-Id: I1e6cab39ffd5c52f55fb83ff777f6eca457dea35 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri18
-rw-r--r--src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h22
-rw-r--r--src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h11
-rw-r--r--src/tools/clangpchmanagerbackend/source/collectusedmacrosandsourcespreprocessorcallbacks.h8
-rw-r--r--src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h7
-rw-r--r--src/tools/clangrefactoringbackend/source/collectsymbolsaction.h6
-rw-r--r--src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp8
-rw-r--r--src/tools/clangrefactoringbackend/source/indexdataconsumer.h8
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolscollector.cpp4
-rw-r--r--tests/unit/unittest/unittest.pro15
10 files changed, 30 insertions, 77 deletions
diff --git a/src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri b/src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri
index a7ef679399..07e55b9354 100644
--- a/src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri
+++ b/src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri
@@ -1,22 +1,28 @@
INCLUDEPATH += $$PWD
SOURCES += \
- $$PWD/clangactivationsequencecontextprocessor.cpp \
- $$PWD/clangactivationsequenceprocessor.cpp \
$$PWD/clangcompletionchunkstotextconverter.cpp \
- $$PWD/clangcompletioncontextanalyzer.cpp \
$$PWD/clangdiagnosticfilter.cpp \
$$PWD/clangfixitoperation.cpp \
$$PWD/clanghighlightingresultreporter.cpp \
$$PWD/clanguiheaderondiskmanager.cpp
+!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):SOURCES+= \
+ $$PWD/clangactivationsequenceprocessor.cpp \
+ $$PWD/clangactivationsequencecontextprocessor.cpp
+
HEADERS += \
- $$PWD/clangactivationsequencecontextprocessor.h \
- $$PWD/clangactivationsequenceprocessor.h \
$$PWD/clangcompletionchunkstotextconverter.h \
- $$PWD/clangcompletioncontextanalyzer.h \
$$PWD/clangdiagnosticfilter.h \
$$PWD/clangfixitoperation.h \
$$PWD/clanghighlightingresultreporter.h \
$$PWD/clangisdiagnosticrelatedtolocation.h \
$$PWD/clanguiheaderondiskmanager.h
+
+!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):SOURCES+= \
+ $$PWD/clangactivationsequencecontextprocessor.h \
+ $$PWD/clangactivationsequenceprocessor.h \
+ $$PWD/clangcompletioncontextanalyzer.cpp \
+ $$PWD/clangcompletioncontextanalyzer.h
+
+
diff --git a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
index 88ed3d2344..47b86e2219 100644
--- a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
+++ b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h
@@ -60,7 +60,6 @@ public:
diagnosticConsumer);
}
-#if LLVM_VERSION_MAJOR >= 10
std::unique_ptr<clang::FrontendAction> create() override
{
return std::make_unique<CollectBuildDependencyAction>(
@@ -69,15 +68,6 @@ public:
m_excludedIncludeUIDs,
m_alreadyIncludedFileUIDs);
}
-#else
- clang::FrontendAction *create() override
- {
- return new CollectBuildDependencyAction(m_buildDependency,
- m_filePathCache,
- m_excludedIncludeUIDs,
- m_alreadyIncludedFileUIDs);
- }
-#endif
std::vector<uint> generateExcludedIncludeFileUIDs(clang::FileManager &fileManager) const
{
@@ -86,16 +76,12 @@ public:
for (const FilePath &filePath : m_excludedFilePaths) {
NativeFilePath nativeFilePath{filePath};
- const clang::FileEntry *file = fileManager.getFile({nativeFilePath.path().data(),
- nativeFilePath.path().size()},
- true)
-#if LLVM_VERSION_MAJOR >= 10
- .get()
-#endif
- ;
+ auto file = fileManager.getFile({nativeFilePath.path().data(),
+ nativeFilePath.path().size()},
+ true);
if (file)
- fileUIDs.push_back(file->getUID());
+ fileUIDs.push_back(file.get()->getUID());
}
std::sort(fileUIDs.begin(), fileUIDs.end());
diff --git a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
index 473b8e7df8..e9c7c4b32b 100644
--- a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
+++ b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h
@@ -61,7 +61,6 @@ public:
diagnosticConsumer);
}
-#if LLVM_VERSION_MAJOR >= 10
std::unique_ptr<clang::FrontendAction> create() override
{
return std::make_unique<CollectUsedMacrosAction>(
@@ -71,16 +70,6 @@ public:
m_sourceFiles,
m_fileStatuses);
}
-#else
- clang::FrontendAction *create() override
- {
- return new CollectUsedMacrosAction(m_usedMacros,
- m_filePathCache,
- m_sourceDependencies,
- m_sourceFiles,
- m_fileStatuses);
- }
-#endif
private:
UsedMacros &m_usedMacros;
diff --git a/src/tools/clangpchmanagerbackend/source/collectusedmacrosandsourcespreprocessorcallbacks.h b/src/tools/clangpchmanagerbackend/source/collectusedmacrosandsourcespreprocessorcallbacks.h
index 5dc630de18..70adc2dffb 100644
--- a/src/tools/clangpchmanagerbackend/source/collectusedmacrosandsourcespreprocessorcallbacks.h
+++ b/src/tools/clangpchmanagerbackend/source/collectusedmacrosandsourcespreprocessorcallbacks.h
@@ -196,17 +196,15 @@ public:
}
void InclusionDirective(clang::SourceLocation hashLocation,
- const clang::Token &/*includeToken*/,
+ const clang::Token & /*includeToken*/,
llvm::StringRef /*fileName*/,
bool /*isAngled*/,
clang::CharSourceRange /*fileNameRange*/,
const clang::FileEntry *file,
llvm::StringRef /*searchPath*/,
llvm::StringRef /*relativePath*/,
- const clang::Module * /*imported*/
-#if LLVM_VERSION_MAJOR >= 7
- , clang::SrcMgr::CharacteristicKind /*fileType*/
-#endif
+ const clang::Module * /*imported*/,
+ clang::SrcMgr::CharacteristicKind /*fileType*/
) override
{
if (!m_skipInclude && file)
diff --git a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
index f1e4c74457..3993ccc651 100644
--- a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
+++ b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h
@@ -68,17 +68,10 @@ public:
, m_fileContent(fileContent)
{}
-#if LLVM_VERSION_MAJOR >= 10
std::unique_ptr<clang::FrontendAction> create() override
{
return std::make_unique<GeneratePCHAction>(m_filePath, m_fileContent);
}
-#else
- clang::FrontendAction *create() override
- {
- return new GeneratePCHAction{m_filePath, m_fileContent};
- }
-#endif
private:
llvm::StringRef m_filePath;
diff --git a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
index 4f36adadf5..bf592502bc 100644
--- a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
+++ b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h
@@ -48,11 +48,7 @@ class CollectSymbolsAction : public clang::WrapperFrontendAction
public:
CollectSymbolsAction(std::shared_ptr<IndexDataConsumer> indexDataConsumer)
: clang::WrapperFrontendAction(
- clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions()
-#if LLVM_VERSION_MAJOR < 10
- , nullptr
-#endif
- ))
+ clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions()))
, m_indexDataConsumer(indexDataConsumer)
{}
diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
index 5d21b30b9c..abb30d61b9 100644
--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
+++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp
@@ -118,11 +118,7 @@ bool IndexDataConsumer::isAlreadyParsed(clang::FileID fileId, SourcesManager &so
return sourcesManager.alreadyParsed(filePathId(fileEntry), fileEntry->getModificationTime());
}
-#if LLVM_VERSION_MAJOR >= 10
bool IndexDataConsumer::handleDeclOccurrence(
-#else
- bool IndexDataConsumer::handleDeclOccurence(
-#endif
const clang::Decl *declaration,
clang::index::SymbolRoleSet symbolRoles,
llvm::ArrayRef<clang::index::SymbolRelation> /*symbolRelations*/,
@@ -180,11 +176,7 @@ SourceLocationKind macroSymbolType(clang::index::SymbolRoleSet roles)
} // namespace
-#if LLVM_VERSION_MAJOR >= 10
bool IndexDataConsumer::handleMacroOccurrence(
-#else
-bool IndexDataConsumer::handleMacroOccurence(
-#endif
const clang::IdentifierInfo *identifierInfo,
const clang::MacroInfo *macroInfo,
clang::index::SymbolRoleSet roles,
diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
index e1d3529806..f3af328744 100644
--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
+++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h
@@ -57,22 +57,14 @@ public:
IndexDataConsumer(const IndexDataConsumer &) = delete;
IndexDataConsumer &operator=(const IndexDataConsumer &) = delete;
-#if LLVM_VERSION_MAJOR >= 10
bool handleDeclOccurrence(
-#else
- bool handleDeclOccurence(
-#endif
const clang::Decl *declaration,
clang::index::SymbolRoleSet symbolRoles,
llvm::ArrayRef<clang::index::SymbolRelation> symbolRelations,
clang::SourceLocation sourceLocation,
ASTNodeInfo astNodeInfo) override;
-#if LLVM_VERSION_MAJOR >= 10
bool handleMacroOccurrence(
-#else
- bool handleMacroOccurence(
-#endif
const clang::IdentifierInfo *identifierInfo,
const clang::MacroInfo *macroInfo,
clang::index::SymbolRoleSet roles,
diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
index dffd583894..8e01869b1d 100644
--- a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp
@@ -74,11 +74,7 @@ std::unique_ptr<clang::tooling::FrontendActionFactory> newFrontendActionFactory(
: m_action(consumerFactory)
{}
-#if LLVM_VERSION_MAJOR >= 10
std::unique_ptr<clang::FrontendAction> create() override { return std::make_unique<AdaptorAction>(m_action); }
-#else
- clang::FrontendAction *create() override { return new AdaptorAction(m_action); }
-#endif
private:
class AdaptorAction : public clang::ASTFrontendAction
diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro
index d40d76db34..48cd04843c 100644
--- a/tests/unit/unittest/unittest.pro
+++ b/tests/unit/unittest/unittest.pro
@@ -134,18 +134,15 @@ SOURCES += \
sqlstatementbuilder-test.cpp \
createtablesqlstatementbuilder-test.cpp
-!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):matchingtext-test.cpp
+!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):SOURCES += matchingtext-test.cpp
!isEmpty(LIBCLANG_LIBS) {
SOURCES += \
- activationsequencecontextprocessor-test.cpp \
- activationsequenceprocessor-test.cpp \
chunksreportedmonitor.cpp \
clangasyncjob-base.cpp \
clangcodecompleteresults-test.cpp \
clangcodemodelserver-test.cpp \
clangcompletecodejob-test.cpp \
- clangcompletioncontextanalyzer-test.cpp \
clangdiagnosticfilter-test.cpp \
clangdocumentprocessors-test.cpp \
clangdocumentprocessor-test.cpp \
@@ -185,6 +182,12 @@ SOURCES += \
unsavedfile-test.cpp \
utf8positionfromlinecolumn-test.cpp \
readexporteddiagnostics-test.cpp
+
+!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):SOURCE += \
+ clangcompletioncontextanalyzer-test.cpp \
+ activationsequencecontextprocessor-test.cpp \
+ activationsequenceprocessor-test.cpp
+
}
!isEmpty(LIBTOOLING_LIBS) {
@@ -200,7 +203,6 @@ SOURCES += \
refactoringclientserverinprocess-test.cpp \
refactoringclient-test.cpp \
refactoringcompilationdatabase-test.cpp \
- refactoringengine-test.cpp \
refactoringserver-test.cpp \
sourcerangeextractor-test.cpp \
symbolindexing-test.cpp \
@@ -209,6 +211,9 @@ SOURCES += \
usedmacrocollector-test.cpp \
builddependencycollector-test.cpp \
tokenprocessor-test.cpp
+
+!isEmpty(QTC_UNITTEST_BUILD_CPP_PARSER):SOURCES += refactoringengine-test.cpp
+
}
!isEmpty(CLANGFORMAT_LIBS) {