From 53c407bc0c87e0b65b537bf26836ddd8e00ead82 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Thu, 4 Apr 2019 14:50:10 +0200 Subject: Clang: Fix build with clang-8 Clang-Tidy checks and Clazy flags updated. CLANG-UPGRADE-CHECK done. Change-Id: I1ca585c5c3c77a7f183719df9c262603150914e8 Reviewed-by: Alessandro Portale Reviewed-by: Eike Ziller Reviewed-by: Marco Bubke --- README.md | 10 +-- qbs/modules/libclang/functions.js | 4 +- .../clangeditordocumentprocessor.cpp | 10 +-- src/plugins/clangtools/clangtidyclazyrunner.cpp | 8 +- src/plugins/cpptools/compileroptionsbuilder.cpp | 1 + src/plugins/cpptools/cpptools_clangtidychecks.h | 85 ++++++++++++++++++++-- src/plugins/cpptools/cpptoolsconstants.h | 2 +- src/shared/clang/clang_installation.pri | 10 +-- .../clangbackend/source/clangbackend_global.h | 20 ----- .../source/clangtooltipinfocollector.cpp | 12 --- .../source/clangtranslationunitupdater.cpp | 2 - src/tools/clangbackend/source/codecompleter.cpp | 2 - .../source/codecompletionsextractor.cpp | 2 - src/tools/clangbackend/source/cursor.cpp | 4 - .../clangrefactoringbackend/source/findcursorusr.h | 4 +- .../source/symbolscollector.cpp | 5 +- tests/unit/unittest/clangtooltipinfo-test.cpp | 14 ++-- tests/unit/unittest/conditionally-disabled-tests.h | 12 --- tests/unit/unittest/projectupdater-test.cpp | 1 + tests/unit/unittest/tokenprocessor-test.cpp | 4 +- 20 files changed, 117 insertions(+), 95 deletions(-) diff --git a/README.md b/README.md index 41c0430251..db773ed5ff 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Prerequisites: * Python 3.5 or later (optional, needed for the python enabled debug helper) * On Mac OS X: latest Xcode * On Linux: g++ 5.3 or later -* LLVM/Clang 7.0.0 or later (optional, needed for the Clang Code Model, Clang Tools, ClangFormat, +* LLVM/Clang 8.0.0 or later (optional, needed for the Clang Code Model, Clang Tools, ClangFormat, Clang PCH Manager and Clang Refactoring plugins, see the section "Get LLVM/Clang for the Clang Code Model". The LLVM C++ API provides no compatibility garantee, so if later versions don't compile we don't support that version.) @@ -228,7 +228,7 @@ or using shadow builds. ## Get LLVM/Clang for the Clang Code Model The Clang Code Model depends on the LLVM/Clang libraries. The currently -supported LLVM/Clang version is 7.0. +supported LLVM/Clang version is 8.0. ### Prebuilt LLVM/Clang packages @@ -255,9 +255,9 @@ GCC 4 binaries. On Ubuntu, you can download the package from http://apt.llvm.org/ with: wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -cs`/ llvm-toolchain-`lsb_release -cs`-7.0 main" + sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -cs`/ llvm-toolchain-`lsb_release -cs`-8.0 main" sudo apt-get update - sudo apt-get install llvm-7.0 libclang-7.0-dev + sudo apt-get install llvm-8.0 libclang-8.0-dev There is a workaround to set _GLIBCXX_USE_CXX11_ABI to 1 or 0, but we recommend to download the package from http://apt.llvm.org/. @@ -273,7 +273,7 @@ http://llvm.org/docs/GettingStarted.html#git-mirror: 1. Clone LLVM and checkout a suitable branch - git clone -b release_70-based --recursive https://code.qt.io/clang/llvm + git clone -b release_80-based --recursive https://code.qt.io/clang/llvm 2. Build and install LLVM/Clang diff --git a/qbs/modules/libclang/functions.js b/qbs/modules/libclang/functions.js index 3a75fe1ead..d1bd2dd2ea 100644 --- a/qbs/modules/libclang/functions.js +++ b/qbs/modules/libclang/functions.js @@ -1,7 +1,7 @@ var Environment = require("qbs.Environment") var File = require("qbs.File") var FileInfo = require("qbs.FileInfo") -var MinimumLLVMVersion = "6.0.0" // CLANG-UPGRADE-CHECK: Adapt minimum version numbers. +var MinimumLLVMVersion = "8.0.0" // CLANG-UPGRADE-CHECK: Adapt minimum version numbers. var Process = require("qbs.Process") function readOutput(executable, args) @@ -110,7 +110,7 @@ function formattingLibs(llvmConfig, qtcFunctions, targetOS) var clangVersion = version(llvmConfig) var libs = [] if (qtcFunctions.versionIsAtLeast(clangVersion, MinimumLLVMVersion)) { - if (qtcFunctions.versionIsAtLeast(clangVersion, "7.0.0")) { + if (qtcFunctions.versionIsAtLeast(clangVersion, "8.0.0")) { libs.push( "clangFormat", "clangToolingInclusions", diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index 706c5101a3..8fd2508315 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -527,14 +527,14 @@ private: return; m_options.append(CppTools::XclangArgs({"-add-plugin", - "clang-lazy", - "-plugin-arg-clang-lazy", + "clazy", + "-plugin-arg-clazy", "enable-all-fixits", - "-plugin-arg-clang-lazy", + "-plugin-arg-clazy", "no-autowrite-fixits", - "-plugin-arg-clang-lazy", + "-plugin-arg-clazy", checks, - "-plugin-arg-clang-lazy", + "-plugin-arg-clazy", "ignore-included-files"})); } diff --git a/src/plugins/clangtools/clangtidyclazyrunner.cpp b/src/plugins/clangtools/clangtidyclazyrunner.cpp index a580704243..2bb0caf3aa 100644 --- a/src/plugins/clangtools/clangtidyclazyrunner.cpp +++ b/src/plugins/clangtools/clangtidyclazyrunner.cpp @@ -86,12 +86,12 @@ QStringList ClangTidyClazyRunner::constructCommandLineArguments(const QStringLis const QString clazyChecks = m_diagnosticConfig.clazyChecks(); if (!clazyChecks.isEmpty()) { arguments << XclangArgs({"-add-plugin", - "clang-lazy", - "-plugin-arg-clang-lazy", + "clazy", + "-plugin-arg-clazy", "enable-all-fixits", - "-plugin-arg-clang-lazy", + "-plugin-arg-clazy", "no-autowrite-fixits", - "-plugin-arg-clang-lazy", + "-plugin-arg-clazy", m_diagnosticConfig.clazyChecks()}); } diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index a1e01911d6..7d12b33f05 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -524,6 +524,7 @@ static QStringList languageFeatureMacros() "__cpp_guaranteed_copy_elision", "__cpp_hex_float", "__cpp_if_constexpr", + "__cpp_impl_destroying_delete", "__cpp_inheriting_constructors", "__cpp_init_captures", "__cpp_initializer_lists", diff --git a/src/plugins/cpptools/cpptools_clangtidychecks.h b/src/plugins/cpptools/cpptools_clangtidychecks.h index 20dcbdf120..813e9b9ed5 100644 --- a/src/plugins/cpptools/cpptools_clangtidychecks.h +++ b/src/plugins/cpptools/cpptools_clangtidychecks.h @@ -50,7 +50,33 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "android-", { + { + "uration-", + { + "comparison", + "division", + { + "factory-", + { + "float", + "scale" + } + }, + "subtraction" + } + }, + "aster-strsplit-delimiter", + { + "o-", + { + "internal-dependencies", + "namespace" + } + }, + "edundant-strcat-calls", + "tr-cat-append", "tring-find-startswith", + "pgrade-duration-conversions", { "cloexec-", { @@ -149,6 +175,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "swapped-arguments", "terminating-continue", "throw-keyword-missing", + "too-small-loop-variable", "undefined-memory-manipulation", "undelegated-constructor", { @@ -166,6 +193,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "cert-", { "dcl03-c", + "dcl16-c", "dcl21-cpp", "dcl50-cpp", "dcl54-cpp", @@ -193,6 +221,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "apiModeling.", { + "StdCLibraryFunctions", "TrustNonnull", "google.GTest" } @@ -232,13 +261,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "cplusplus.", { "InnerPointer", + "Move", "NewDelete", "NewDeleteLeaks", "SelfAssignment" } }, "deadcode.DeadStores", - "llvm.Conventions", { "nullability.", { @@ -286,6 +315,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "API", "NumberObjectConversion", + "OSObjectRetainCount", "ObjCProperty", "SecKeychainAPI", { @@ -357,7 +387,6 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "Malloc", "MallocSizeof", "MismatchedDeallocator", - "StdCLibraryFunctions", "Vfork", { "cstring.", @@ -381,11 +410,20 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "cppcoreguidelines-", { - "avoid-goto", + { + "avoid-", + { + "c-arrays", + "goto", + "magic-numbers" + } + }, "c-copy-assignment-signature", "interfaces-global-init", + "macro-usage", "narrowing-conversions", "no-malloc", + "non-private-member-variables-in-classes", "owning-memory", { "pro-", @@ -447,6 +485,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "objc-", { "avoid-throwing-exception", + "function-naming", "global-variable-declaration" } }, @@ -473,7 +512,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "hicpp-", { - "avoid-goto", + { + "avoid-", + { + "c-arrays", + "goto" + } + }, "braces-around-statements", "deprecated-headers", "exception-baseclass", @@ -498,6 +543,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "special-member-functions", "static-assert", "undelegated-constructor", + "uppercase-literal-suffix", { "use-", { @@ -533,7 +579,13 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "definitions-in-headers", "misplaced-const", "new-delete-overloads", - "non-copyable-objects", + { + "non-", + { + "copyable-objects", + "private-member-variables-in-classes" + } + }, "redundant-expression", "static-assert", "throw-by-value-catch-by-reference", @@ -552,8 +604,21 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "modernize-", { - "avoid-bind", - "deprecated-headers", + { + "avoid-", + { + "bind", + "c-arrays" + } + }, + "concat-nested-namespaces", + { + "deprecated-", + { + "headers", + "ios-base-aliases" + } + }, "loop-convert", { "make-", @@ -589,6 +654,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "delete" } }, + "nodiscard", "noexcept", "nullptr", "override", @@ -658,6 +724,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT { "avoid-const-params-in-decls", "braces-around-statements", + "const-return-type", "container-size-empty", "delete-null-pointer", "deleted-default", @@ -666,6 +733,8 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "identifier-naming", "implicit-bool-conversion", "inconsistent-declaration-parameter-name", + "isolate-declaration", + "magic-numbers", "misleading-indentation", "misplaced-array-index", "named-parameter", @@ -677,6 +746,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT "declaration", "function-ptr-dereference", "member-init", + "preprocessor", "smartptr-get", { "string-", @@ -703,6 +773,7 @@ static const TidyNode CLANG_TIDY_CHECKS_ROOT }, "string-compare", "uniqueptr-delete-release", + "uppercase-literal-suffix", "rary-objects" } } diff --git a/src/plugins/cpptools/cpptoolsconstants.h b/src/plugins/cpptools/cpptoolsconstants.h index 2e1aebfd43..8490f2ccf5 100644 --- a/src/plugins/cpptools/cpptoolsconstants.h +++ b/src/plugins/cpptools/cpptoolsconstants.h @@ -100,7 +100,7 @@ const char SYMBOLS_FIND_FILTER_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("CppTools", "C // CLANG_VERSION here because it might denote a version that was not yet // released (e.g. 6.0.1, but only 6.0.0 was released). constexpr const char TIDY_DOCUMENTATION_URL_TEMPLATE[] - = "https://releases.llvm.org/7.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; + = "https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/%1.html"; constexpr const char CLAZY_DOCUMENTATION_URL_TEMPLATE[] = "https://github.com/KDE/clazy/blob/master/docs/checks/README-%1.md"; diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri index 107604a08b..5352624672 100644 --- a/src/shared/clang/clang_installation.pri +++ b/src/shared/clang/clang_installation.pri @@ -141,15 +141,15 @@ win32: BIN_EXTENSION = .exe isEmpty(LLVM_INSTALL_DIR) { unix { - llvm_config = $$system(which llvm-config-7) + llvm_config = $$system(which llvm-config-8) } isEmpty(llvm_config) { llvm_config = llvm-config } } else { - exists($$LLVM_INSTALL_DIR/bin/llvm-config-7$$BIN_EXTENSION) { - llvm_config = $$system_quote($$LLVM_INSTALL_DIR/bin/llvm-config-7) + exists($$LLVM_INSTALL_DIR/bin/llvm-config-8$$BIN_EXTENSION) { + llvm_config = $$system_quote($$LLVM_INSTALL_DIR/bin/llvm-config-8) } else { llvm_config = $$system_quote($$LLVM_INSTALL_DIR/bin/llvm-config) requires(exists($$llvm_config$$BIN_EXTENSION)) @@ -163,10 +163,10 @@ isEmpty(LLVM_VERSION) { $$llvmWarningOrError(\ "Cannot determine clang version. Set LLVM_INSTALL_DIR to build the Clang Code Model",\ "LLVM_INSTALL_DIR does not contain a valid llvm-config, candidate: $$llvm_config") -} else:!versionIsAtLeast($$LLVM_VERSION, 7, 0, 0): { +} else:!versionIsAtLeast($$LLVM_VERSION, 8, 0, 0): { # CLANG-UPGRADE-CHECK: Adapt minimum version numbers. $$llvmWarningOrError(\ - "LLVM/Clang version >= 7.0.0 required, version provided: $$LLVM_VERSION") + "LLVM/Clang version >= 8.0.0 required, version provided: $$LLVM_VERSION") LLVM_VERSION = } else { # CLANG-UPGRADE-CHECK: Remove suppression if this warning is resolved. diff --git a/src/tools/clangbackend/source/clangbackend_global.h b/src/tools/clangbackend/source/clangbackend_global.h index bca0937d59..0e89673b96 100644 --- a/src/tools/clangbackend/source/clangbackend_global.h +++ b/src/tools/clangbackend/source/clangbackend_global.h @@ -36,29 +36,9 @@ enum class PreferredTranslationUnit LastUninitialized, }; -// CLANG-UPGRADE-CHECK: Remove IS_PRETTY_DECL_SUPPORTED once we require clang >= 7.0 -#if defined(CINDEX_VERSION_HAS_PRETTYDECL_BACKPORTED) || CINDEX_VERSION_MINOR >= 46 -# define IS_PRETTY_DECL_SUPPORTED -#endif - -// CLANG-UPGRADE-CHECK: Remove IS_INVALIDDECL_SUPPORTED once we require clang >= 7.0 -#if defined(CINDEX_VERSION_HAS_ISINVALIDECL_BACKPORTED) || CINDEX_VERSION_MINOR >= 46 -# define IS_INVALIDDECL_SUPPORTED -#endif - -// CLANG-UPGRADE-CHECK: Remove IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED once we require clang >= 7.0 -#if defined(CINDEX_VERSION_HAS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_BACKPORTED) || CINDEX_VERSION_MINOR >= 46 -# define IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED -#endif - // CLANG-UPGRADE-CHECK: Remove IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED #if defined(CINDEX_VERSION_HAS_SKIPWARNINGSFROMINCLUDEDFILES_BACKPORTED) # define IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED #endif -// CLANG-UPGRADE-CHECK: Remove IS_COMPLETION_FIXITS_BACKPORTED once we require clang >= 7.0 -#if defined(CINDEX_VERSION_HAS_COMPLETION_FIXITS_BACKPORTED) || CINDEX_VERSION_MINOR >= 49 -# define IS_COMPLETION_FIXITS_BACKPORTED -#endif - } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp index beecf63bb6..0d001ca3d4 100644 --- a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp +++ b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp @@ -87,7 +87,6 @@ Utf8String displayName(const Cursor &cursor) Utf8String textForFunctionLike(const Cursor &cursor) { -#ifdef IS_PRETTY_DECL_SUPPORTED CXPrintingPolicy policy = clang_getCursorPrintingPolicy(cursor.cx()); clang_PrintingPolicy_setProperty(policy, CXPrintingPolicy_FullyQualifiedName, 1); clang_PrintingPolicy_setProperty(policy, CXPrintingPolicy_TerseOutput, 1); @@ -98,17 +97,6 @@ Utf8String textForFunctionLike(const Cursor &cursor) clang_getCursorPrettyPrinted(cursor.cx(), policy)); clang_PrintingPolicy_dispose(policy); return prettyPrinted; -#else - // Printing function declarations with displayName() is quite limited: - // * result type is not included - // * parameter names are not included - // * templates in the result type are not included - // * no full qualification of the function name - return Utf8String(cursor.resultType().spelling()) - + Utf8StringLiteral(" ") - + qualificationPrefix(cursor) - + Utf8String(cursor.displayName()); -#endif } Utf8String textForEnumConstantDecl(const Cursor &cursor) diff --git a/src/tools/clangbackend/source/clangtranslationunitupdater.cpp b/src/tools/clangbackend/source/clangtranslationunitupdater.cpp index a45a898738..fdad057089 100644 --- a/src/tools/clangbackend/source/clangtranslationunitupdater.cpp +++ b/src/tools/clangbackend/source/clangtranslationunitupdater.cpp @@ -177,10 +177,8 @@ uint TranslationUnitUpdater::defaultParseOptions() return CXTranslationUnit_CacheCompletionResults | CXTranslationUnit_PrecompiledPreamble | CXTranslationUnit_CreatePreambleOnFirstParse -#ifdef IS_LIMITSKIPFUNCTIONBODIESTOPREAMBLE_SUPPORTED | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_LimitSkipFunctionBodiesToPreamble -#endif #ifdef IS_SKIPWARNINGSFROMINCLUDEDFILES_SUPPORTED | CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles #endif diff --git a/src/tools/clangbackend/source/codecompleter.cpp b/src/tools/clangbackend/source/codecompleter.cpp index c46118a20c..2db3fbe0f1 100644 --- a/src/tools/clangbackend/source/codecompleter.cpp +++ b/src/tools/clangbackend/source/codecompleter.cpp @@ -197,9 +197,7 @@ ClangCodeCompleteResults CodeCompleter::completeHelper(uint line, uint column) uint CodeCompleter::defaultOptions() const { uint options = CXCodeComplete_IncludeMacros - #ifdef IS_COMPLETION_FIXITS_BACKPORTED | CXCodeComplete_IncludeCompletionsWithFixIts - #endif | CXCodeComplete_IncludeCodePatterns; if (TranslationUnitUpdater::defaultParseOptions() diff --git a/src/tools/clangbackend/source/codecompletionsextractor.cpp b/src/tools/clangbackend/source/codecompletionsextractor.cpp index 0a0265829f..be36cae088 100644 --- a/src/tools/clangbackend/source/codecompletionsextractor.cpp +++ b/src/tools/clangbackend/source/codecompletionsextractor.cpp @@ -370,7 +370,6 @@ SourceRangeContainer toRangeContainer(const UnsavedFile &file, CXSourceRange cxS void CodeCompletionsExtractor::extractRequiredFixIts() { -#ifdef IS_COMPLETION_FIXITS_BACKPORTED unsigned fixItsNumber = clang_getCompletionNumFixIts(cxCodeCompleteResults, cxCodeCompleteResultIndex); @@ -386,7 +385,6 @@ void CodeCompletionsExtractor::extractRequiredFixIts() currentCodeCompletion_.requiredFixIts.push_back( FixItContainer(Utf8String(fixIt), toRangeContainer(unsavedFile, range))); } -#endif } void CodeCompletionsExtractor::adaptPriority() diff --git a/src/tools/clangbackend/source/cursor.cpp b/src/tools/clangbackend/source/cursor.cpp index e76091a661..00fde42cc8 100644 --- a/src/tools/clangbackend/source/cursor.cpp +++ b/src/tools/clangbackend/source/cursor.cpp @@ -107,11 +107,7 @@ bool Cursor::isDeclaration() const bool Cursor::isInvalidDeclaration() const { -#ifdef IS_INVALIDDECL_SUPPORTED return clang_isInvalidDeclaration(m_cxCursor); -#else - return false; -#endif } bool Cursor::isLocalVariable() const diff --git a/src/tools/clangrefactoringbackend/source/findcursorusr.h b/src/tools/clangrefactoringbackend/source/findcursorusr.h index 549086cd3a..06777d8611 100644 --- a/src/tools/clangrefactoringbackend/source/findcursorusr.h +++ b/src/tools/clangrefactoringbackend/source/findcursorusr.h @@ -25,6 +25,8 @@ #pragma once +#include "clangrefactoringbackend_global.h" + #include #include #include @@ -161,7 +163,7 @@ std::vector namedDeclarationsAt(const clang::ASTContex auto declarations = Context.getTranslationUnitDecl()->decls(); for (auto ¤tDeclation : declarations) { - const auto &fileLocation = currentDeclation->getLocStart(); + const auto &fileLocation = currentDeclation->getBeginLoc(); const auto &fileName = sourceManager.getFilename(fileLocation); if (fileName == currentFile) { visitor.TraverseDecl(currentDeclation); diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp index 188d6fd207..84aff74d5f 100644 --- a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp @@ -92,8 +92,9 @@ newFrontendActionFactory(Factory *consumerFactory, m_sourceFileCallbacks(sourceFileCallbacks) {} - std::unique_ptr - CreateASTConsumer(clang::CompilerInstance &instance, StringRef inFile) override { + std::unique_ptr CreateASTConsumer(clang::CompilerInstance &instance, + llvm::StringRef inFile) override + { return m_consumerFactory->newASTConsumer(instance, inFile); } diff --git a/tests/unit/unittest/clangtooltipinfo-test.cpp b/tests/unit/unittest/clangtooltipinfo-test.cpp index 807618deef..fb630e2aa3 100644 --- a/tests/unit/unittest/clangtooltipinfo-test.cpp +++ b/tests/unit/unittest/clangtooltipinfo-test.cpp @@ -153,7 +153,7 @@ TEST_F(ToolTipInfo, MemberVariable) ASSERT_THAT(actual, IsToolTip(::ToolTipInfo(Utf8StringLiteral("int")))); } -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(MemberFunctionCall_QualifiedName)) +TEST_F(ToolTipInfo, MemberFunctionCall_QualifiedName) { const ::ToolTipInfo actual = tooltip(21, 9); @@ -161,7 +161,7 @@ TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(MemberFunctionCall_Qualifi } // ChangeLog: Show extra specifiers. For functions e.g.: virtual, inline, explicit, const, volatile -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(MemberFunctionCall_ExtraSpecifiers)) +TEST_F(ToolTipInfo, MemberFunctionCall_ExtraSpecifiers) { const ::ToolTipInfo actual = tooltip(22, 9); @@ -199,7 +199,7 @@ TEST_F(ToolTipInfo, MemberFunctionCall_qdocCategory) } // TODO: Show the template parameter type, too: "template...)" -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(TemplateFunctionCall)) +TEST_F(ToolTipInfo, TemplateFunctionCall) { const ::ToolTipInfo actual = tooltip(30, 5); @@ -548,7 +548,7 @@ TEST_F(ToolTipInfo, Function_qdocIdCandidatesAreQualified) Utf8StringLiteral("f"))); } -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(Function_HasParameterName)) +TEST_F(ToolTipInfo, Function_HasParameterName) { const ::ToolTipInfo actual = tooltip(167, 5); @@ -621,21 +621,21 @@ TEST_F(ToolTipInfo, AutoTypeClassTemplateType) ASSERT_THAT(actual.text, Utf8StringLiteral("Zii")); } -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(Function_DefaultConstructor)) +TEST_F(ToolTipInfo, Function_DefaultConstructor) { const ::ToolTipInfo actual = tooltip(193, 5); ASSERT_THAT(actual.text, Utf8StringLiteral("inline constexpr Con::Con() noexcept")); } -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(Function_ExplicitDefaultConstructor)) +TEST_F(ToolTipInfo, Function_ExplicitDefaultConstructor) { const ::ToolTipInfo actual = tooltip(194, 5); ASSERT_THAT(actual.text, Utf8StringLiteral("ExplicitCon::ExplicitCon() noexcept = default")); } -TEST_F(ToolTipInfo, DISABLED_WITHOUT_PRETTYDECL_PATCH(Function_CustomConstructor)) +TEST_F(ToolTipInfo, Function_CustomConstructor) { const ::ToolTipInfo actual = tooltip(195, 5); diff --git a/tests/unit/unittest/conditionally-disabled-tests.h b/tests/unit/unittest/conditionally-disabled-tests.h index 0b6f279975..c88a844b96 100644 --- a/tests/unit/unittest/conditionally-disabled-tests.h +++ b/tests/unit/unittest/conditionally-disabled-tests.h @@ -39,15 +39,3 @@ #else # define DISABLED_ON_NON_WINDOWS(x) x #endif - -#ifdef IS_PRETTY_DECL_SUPPORTED -# define DISABLED_WITHOUT_PRETTYDECL_PATCH(x) x -#else -# define DISABLED_WITHOUT_PRETTYDECL_PATCH(x) DISABLED_##x -#endif - -#ifdef IS_INVALIDDECL_SUPPORTED -# define DISABLED_WITHOUT_INVALIDDECL_PATCH(x) x -#else -# define DISABLED_WITHOUT_INVALIDDECL_PATCH(x) DISABLED_##x -#endif diff --git a/tests/unit/unittest/projectupdater-test.cpp b/tests/unit/unittest/projectupdater-test.cpp index 2dd81b444e..8e52ca35ee 100644 --- a/tests/unit/unittest/projectupdater-test.cpp +++ b/tests/unit/unittest/projectupdater-test.cpp @@ -385,6 +385,7 @@ TEST_F(ProjectUpdater, ToolChainArgumentsMSVC) QString{"-U__cpp_guaranteed_copy_elision"}, QString{"-U__cpp_hex_float"}, QString{"-U__cpp_if_constexpr"}, + QString{"-U__cpp_impl_destroying_delete"}, QString{"-U__cpp_inheriting_constructors"}, QString{"-U__cpp_init_captures"}, QString{"-U__cpp_initializer_lists"}, diff --git a/tests/unit/unittest/tokenprocessor-test.cpp b/tests/unit/unittest/tokenprocessor-test.cpp index 8d79bc95cb..c96650472d 100644 --- a/tests/unit/unittest/tokenprocessor-test.cpp +++ b/tests/unit/unittest/tokenprocessor-test.cpp @@ -1552,14 +1552,14 @@ TEST_F(TokenProcessor, NamespaceTypeSpelling) ASSERT_THAT(container.extraInfo.semanticParentTypeSpelling, Utf8StringLiteral("NFoo::NBar::NTest")); } -TEST_F(TokenProcessor, DISABLED_WITHOUT_INVALIDDECL_PATCH(TypeNameOfInvalidDeclarationIsInvalid)) +TEST_F(TokenProcessor, TypeNameOfInvalidDeclarationIsInvalid) { const auto infos = translationUnit.tokenInfosInRange(sourceRange(594, 14)); ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::Invalid)); } -TEST_F(TokenProcessor, DISABLED_WITHOUT_INVALIDDECL_PATCH(VariableNameOfInvalidDeclarationIsInvalid)) +TEST_F(TokenProcessor, VariableNameOfInvalidDeclarationIsInvalid) { const auto infos = translationUnit.tokenInfosInRange(sourceRange(594, 14)); -- cgit v1.2.3