forked from qt-creator/qt-creator
UnitTest: Break the dependency to LLVM
If you have no LLVM installed it was impossible to compile the unit test. But some unit test don't depend on LLVM. With this change it is now possible to compile them. Change-Id: Iac0c1b3cdf6c317e6ba4755acd5f8458db5a7451 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
!isEmpty(LLVM_INSTALL_DIR) {
|
||||
include(../../../src/shared/clang/clang_installation.pri)
|
||||
requires(!isEmpty(LIBCLANG_LIBS))
|
||||
|
||||
DEFINES += CLANG_UNIT_TESTS
|
||||
INCLUDEPATH += $$LLVM_INCLUDEPATH
|
||||
LIBS += $$LIBTOOLING_LIBS $$LIBCLANG_LIBS
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
include($$PWD/../../../src/libs/utils/utils-lib.pri)
|
||||
include($$PWD/../../../src/libs/cplusplus/cplusplus-lib.pri)
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
include(../../../src/libs/sqlite/sqlite-lib.pri)
|
||||
include(../../../src/libs/clangbackendipc/clangbackendipc-lib.pri)
|
||||
include(../../../src/tools/clangbackend/ipcsource/clangbackendclangipc-source.pri)
|
||||
include(../../../src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri)
|
||||
include(../../../src/plugins/coreplugin/corepluginunittestfiles.pri)
|
||||
include(../../../src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri)
|
||||
include(../../../src/plugins/cpptools/cpptoolsunittestfiles.pri)
|
||||
include(../../../src/plugins/clangrefactoring/clangrefactoring-source.pri)
|
||||
include($$PWD/../../../src/libs/utils/utils-lib.pri)
|
||||
include($$PWD/../../../src/libs/sqlite/sqlite-lib.pri)
|
||||
include($$PWD/../../../src/libs/clangbackendipc/clangbackendipc-lib.pri)
|
||||
include($$PWD/../../../src/plugins/coreplugin/corepluginunittestfiles.pri)
|
||||
|
||||
!isEmpty(LLVM_INSTALL_DIR) {
|
||||
include($$PWD/../../../src/tools/clangbackend/ipcsource/clangbackendclangipc-source.pri)
|
||||
include($$PWD/../../../src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri)
|
||||
include($$PWD/../../../src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri)
|
||||
include($$PWD/../../../src/plugins/cpptools/cpptoolsunittestfiles.pri)
|
||||
include($$PWD/../../../src/plugins/clangrefactoring/clangrefactoring-source.pri)
|
||||
include(cplusplus.pri)
|
||||
|
||||
DEFINES += CLANG_VERSION=\\\"$${LLVM_VERSION}\\\"
|
||||
DEFINES += "\"CLANG_RESOURCE_DIR=\\\"$${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include\\\"\""
|
||||
}
|
||||
|
||||
DEFINES += QTC_REL_TOOLS_PATH=$$shell_quote(\"$$relative_path($$IDE_LIBEXEC_PATH, $$IDE_BIN_PATH)\")
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../../../src/libs \
|
||||
$$PWD/../../../src/libs/3rdparty \
|
||||
$$PWD/../../../src/plugins
|
||||
|
||||
DEFINES += QTC_REL_TOOLS_PATH=$$shell_quote(\"$$relative_path($$IDE_LIBEXEC_PATH, $$IDE_BIN_PATH)\")
|
||||
DEFINES += CLANG_VERSION=\\\"$${LLVM_VERSION}\\\"
|
||||
DEFINES += "\"CLANG_RESOURCE_DIR=\\\"$${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include\\\"\""
|
||||
|
||||
@@ -31,8 +31,10 @@
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#ifdef CLANG_UNIT_TESTS
|
||||
#include <clang/Basic/SourceLocation.h>
|
||||
#include <clang/Basic/SourceManager.h>
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
@@ -64,6 +66,7 @@ inline void PrintTo(const QString &text, ::std::ostream *os)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#ifdef CLANG_UNIT_TESTS
|
||||
namespace clang {
|
||||
|
||||
inline void PrintTo(const clang::FullSourceLoc &sourceLocation, ::std::ostream *os)
|
||||
@@ -78,6 +81,7 @@ inline void PrintTo(const clang::FullSourceLoc &sourceLocation, ::std::ostream *
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
//namespace testing {
|
||||
//namespace internal {
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <messageenvelop.h>
|
||||
#include <requestdocumentannotations.h>
|
||||
#include <readmessageblock.h>
|
||||
#include <sourcelocation.h>
|
||||
#include <registerunsavedfilesforeditormessage.h>
|
||||
#include <unregisterunsavedfilesforeditormessage.h>
|
||||
#include <updatetranslationunitsforeditormessage.h>
|
||||
|
||||
@@ -24,6 +24,19 @@ msvc: QMAKE_CXXFLAGS_WARN_ON -= -w34100 # 'unreferenced formal parameter' in MAT
|
||||
win32:DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echo)xxx\\\"\"
|
||||
unix: DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echoserver/echo)xxx\\\"\"
|
||||
|
||||
SOURCES += \
|
||||
clientserverinprocesstest.cpp \
|
||||
clientserveroutsideprocess.cpp \
|
||||
lineprefixertest.cpp \
|
||||
main.cpp \
|
||||
readandwritemessageblocktest.cpp \
|
||||
sizedarraytest.cpp \
|
||||
spydummy.cpp \
|
||||
smallstringtest.cpp \
|
||||
testutils.cpp \
|
||||
utf8test.cpp
|
||||
|
||||
!isEmpty($$LIBCLANG_LIBS) {
|
||||
SOURCES += \
|
||||
activationsequencecontextprocessortest.cpp \
|
||||
activationsequenceprocessortest.cpp \
|
||||
@@ -33,8 +46,6 @@ SOURCES += \
|
||||
clangfixitoperationtest.cpp \
|
||||
clangipcservertest.cpp \
|
||||
clangstringtest.cpp \
|
||||
clientserverinprocesstest.cpp \
|
||||
clientserveroutsideprocess.cpp \
|
||||
codecompletionsextractortest.cpp \
|
||||
codecompletiontest.cpp \
|
||||
completionchunkstotextconvertertest.cpp \
|
||||
@@ -42,13 +53,9 @@ SOURCES += \
|
||||
diagnosticsettest.cpp \
|
||||
diagnostictest.cpp \
|
||||
fixittest.cpp \
|
||||
lineprefixertest.cpp \
|
||||
main.cpp \
|
||||
projecttest.cpp \
|
||||
readandwritemessageblocktest.cpp \
|
||||
sourcelocationtest.cpp \
|
||||
sourcerangetest.cpp \
|
||||
spydummy.cpp \
|
||||
sqlitecolumntest.cpp \
|
||||
sqlitedatabasebackendtest.cpp \
|
||||
sqlitedatabasetest.cpp \
|
||||
@@ -58,7 +65,6 @@ SOURCES += \
|
||||
translationunitstest.cpp \
|
||||
translationunittest.cpp \
|
||||
unsavedfilestest.cpp \
|
||||
utf8test.cpp \
|
||||
senddocumenttrackertest.cpp \
|
||||
cursortest.cpp \
|
||||
skippedsourcerangestest.cpp \
|
||||
@@ -66,25 +72,27 @@ SOURCES += \
|
||||
chunksreportedmonitor.cpp \
|
||||
unsavedfiletest.cpp \
|
||||
clangisdiagnosticrelatedtolocationtest.cpp \
|
||||
smallstringtest.cpp \
|
||||
highlightingmarkstest.cpp \
|
||||
sizedarraytest.cpp \
|
||||
utf8positionfromlinecolumntest.cpp \
|
||||
translationunitupdatertest.cpp \
|
||||
testutils.cpp \
|
||||
clangasyncjobtest.cpp \
|
||||
clangcompletecodejobtest.cpp \
|
||||
clangcreateinitialdocumentpreamblejobtest.cpp \
|
||||
clangjobqueuetest.cpp \
|
||||
refactoringcompilationdatabasetest.cpp \
|
||||
symbolfindertest.cpp \
|
||||
refactoringclientserverinprocesstest.cpp \
|
||||
refactoringservertest.cpp \
|
||||
refactoringenginetest.cpp \
|
||||
refactoringclienttest.cpp \
|
||||
clangjobstest.cpp \
|
||||
clangrequestdocumentannotationsjobtest.cpp \
|
||||
clangupdatedocumentannotationsjobtest.cpp
|
||||
}
|
||||
|
||||
!isEmpty($$LIBTOOLING_LIBS) {
|
||||
SOURCES += \
|
||||
refactoringclientserverinprocesstest.cpp \
|
||||
refactoringcompilationdatabasetest.cpp \
|
||||
refactoringservertest.cpp \
|
||||
refactoringenginetest.cpp \
|
||||
refactoringclienttest.cpp \
|
||||
symbolfindertest.cpp
|
||||
}
|
||||
|
||||
exists($$GOOGLEBENCHMARK_DIR) {
|
||||
SOURCES += \
|
||||
@@ -93,17 +101,25 @@ SOURCES += \
|
||||
|
||||
HEADERS += \
|
||||
gtest-qt-printing.h \
|
||||
spydummy.h \
|
||||
dummyclangipcclient.h \
|
||||
testutils.h \
|
||||
mockclangcodemodelclient.h \
|
||||
mockclangcodemodelserver.h \
|
||||
mockrefactoringclient.h \
|
||||
mockrefactoringserver.h \
|
||||
spydummy.h \
|
||||
dummyclangipcclient.h \
|
||||
matcher-diagnosticcontainer.h \
|
||||
chunksreportedmonitor.h \
|
||||
testutils.h \
|
||||
refactoringclientcallbackmock.h
|
||||
|
||||
!isEmpty($$LIBCLANG_LIBS) {
|
||||
HEADERS += \
|
||||
clangasyncjobtest.h \
|
||||
refactoringclientcallbackmock.h \
|
||||
chunksreportedmonitor.h \
|
||||
matcher-diagnosticcontainer.h
|
||||
}
|
||||
|
||||
!isEmpty($$LIBTOOLING_LIBS) {
|
||||
HEADERS += \
|
||||
filesystemutilities.h
|
||||
}
|
||||
|
||||
OTHER_FILES += $$files(data/*)
|
||||
|
||||
Reference in New Issue
Block a user