forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
@@ -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(),
|
||||
auto file = fileManager.getFile({nativeFilePath.path().data(),
|
||||
nativeFilePath.path().size()},
|
||||
true)
|
||||
#if LLVM_VERSION_MAJOR >= 10
|
||||
.get()
|
||||
#endif
|
||||
;
|
||||
true);
|
||||
|
||||
if (file)
|
||||
fileUIDs.push_back(file->getUID());
|
||||
fileUIDs.push_back(file.get()->getUID());
|
||||
}
|
||||
|
||||
std::sort(fileUIDs.begin(), fileUIDs.end());
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user