diff --git a/desktop/toolkit/qt6/qt6-tools/files/llvm15.patch b/desktop/toolkit/qt6/qt6-tools/files/llvm15.patch new file mode 100644 index 0000000000..55dbf82771 --- /dev/null +++ b/desktop/toolkit/qt6/qt6-tools/files/llvm15.patch @@ -0,0 +1,128 @@ +diff -Nuar a/src/linguist/lupdate/cpp_clang.cpp b/src/linguist/lupdate/cpp_clang.cpp +--- a/src/linguist/lupdate/cpp_clang.cpp 2022-09-23 14:50:40.000000000 +0300 ++++ b/src/linguist/lupdate/cpp_clang.cpp 2023-01-19 11:46:35.771012198 +0300 +@@ -243,40 +243,37 @@ + static clang::tooling::ArgumentsAdjuster getClangArgumentAdjuster() + { + const QByteArrayList compilerIncludeFlags = getIncludePathsFromCompiler(); +- return [=](const clang::tooling::CommandLineArguments &args, +- llvm::StringRef /*unused*/) { +- clang::tooling::CommandLineArguments adjustedArgs; +- for (size_t i = 0, e = args.size(); i < e; ++i) { +- llvm::StringRef arg = args[i]; +- // FIXME: Remove options that generate output. +- if (!arg.startswith("-fcolor-diagnostics") && !arg.startswith("-fdiagnostics-color")) +- adjustedArgs.push_back(args[i]); +- } +- adjustedArgs.push_back("-fparse-all-comments"); +- adjustedArgs.push_back("-nostdinc"); ++ return [=](const clang::tooling::CommandLineArguments &args, llvm::StringRef /*unused*/) { ++ clang::tooling::CommandLineArguments adjustedArgs(args); ++ clang::tooling::CommandLineArguments adjustedArgsTemp; ++ ++ adjustedArgsTemp.push_back("-fparse-all-comments"); ++ adjustedArgsTemp.push_back("-nostdinc"); + + // Turn off SSE support to avoid usage of gcc builtins. + // TODO: Look into what Qt Creator does. + // Pointers: HeaderPathFilter::removeGccInternalIncludePaths() + // and gccInstallDir() in gcctoolchain.cpp + // Also needed for Mac, No need for CLANG_RESOURCE_DIR when this is part of the argument. +- adjustedArgs.push_back("-mno-sse"); ++ adjustedArgsTemp.push_back("-mno-sse"); + +- adjustedArgs.push_back("-fsyntax-only"); + #ifdef Q_OS_WIN +- adjustedArgs.push_back("-fms-compatibility-version=19"); +- adjustedArgs.push_back("-DQ_COMPILER_UNIFORM_INIT"); // qtbase + clang-cl hack ++ adjustedArgsTemp.push_back("-fms-compatibility-version=19"); ++ adjustedArgsTemp.push_back("-DQ_COMPILER_UNIFORM_INIT"); // qtbase + clang-cl hack + // avoid constexpr error connected with offsetof (QTBUG-97380) +- adjustedArgs.push_back("-D_CRT_USE_BUILTIN_OFFSETOF"); ++ adjustedArgsTemp.push_back("-D_CRT_USE_BUILTIN_OFFSETOF"); + #endif +- adjustedArgs.push_back("-Wno-everything"); ++ adjustedArgsTemp.push_back("-Wno-everything"); + + for (const QByteArray &flag : compilerIncludeFlags) +- adjustedArgs.push_back(flag.data()); ++ adjustedArgsTemp.push_back(flag.data()); + + for (auto alias : aliasDefinition) { +- adjustedArgs.push_back(alias); ++ adjustedArgsTemp.push_back(alias); + } ++ ++ clang::tooling::CommandLineArguments::iterator it = llvm::find(adjustedArgs, "--"); ++ adjustedArgs.insert(it, adjustedArgsTemp.begin(), adjustedArgsTemp.end()); + return adjustedArgs; + }; + } +@@ -461,7 +458,11 @@ + ReadSynchronizedRef ppSources(sources); + WriteSynchronizedRef ppStore(stores.Preprocessor); + size_t idealProducerCount = std::min(ppSources.size(), size_t(std::thread::hardware_concurrency())); +- clang::tooling::ArgumentsAdjuster argumentsAdjuster = getClangArgumentAdjuster(); ++ clang::tooling::ArgumentsAdjuster argumentsAdjusterSyntaxOnly = ++ clang::tooling::getClangSyntaxOnlyAdjuster(); ++ clang::tooling::ArgumentsAdjuster argumentsAdjusterLocal = getClangArgumentAdjuster(); ++ clang::tooling::ArgumentsAdjuster argumentsAdjuster = ++ clang::tooling::combineAdjusters(argumentsAdjusterLocal, argumentsAdjusterSyntaxOnly); + + for (size_t i = 0; i < idealProducerCount; ++i) { + std::thread producer([&ppSources, &db, &ppStore, &argumentsAdjuster]() { +diff -Nuar a/src/linguist/lupdate/lupdatepreprocessoraction.cpp b/src/linguist/lupdate/lupdatepreprocessoraction.cpp +--- a/src/linguist/lupdate/lupdatepreprocessoraction.cpp 2022-09-23 14:50:40.000000000 +0300 ++++ b/src/linguist/lupdate/lupdatepreprocessoraction.cpp 2023-01-19 12:01:15.475030465 +0300 +@@ -144,7 +144,7 @@ + const char *end = sm.getCharacterData(sourceRange.getEnd()); + llvm::StringRef skippedText = llvm::StringRef(begin, end - begin); + if (ClangCppParser::stringContainsTranslationInformation(skippedText)) { +- qCDebug(lcClang) << "SourceRangeSkipped: skipped text:" << skippedText.str(); ++ qCDebug(lcClang) << "SourceRangeSkipped: skipped text:" << QString::fromStdString(skippedText.str()); + unsigned int beginLine = sm.getExpansionLineNumber(sourceRange.getBegin()); + unsigned int endLine = sm.getExpansionLineNumber(sourceRange.getEnd()); + qWarning("%s Code with translation information has been skipped " +@@ -156,14 +156,23 @@ + // To list the included files + void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation /*hashLoc*/, + const clang::Token & /*includeTok*/, clang::StringRef /*fileName*/, bool /*isAngled*/, +- clang::CharSourceRange /*filenameRange*/, const clang::FileEntry *file, ++ clang::CharSourceRange /*filenameRange*/, ++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0)) ++ const clang::Optional file, ++#else ++ const clang::FileEntry *file, ++#endif + clang::StringRef /*searchPath*/, clang::StringRef /*relativePath*/, + const clang::Module */*imported*/, clang::SrcMgr::CharacteristicKind /*fileType*/) + { + if (!file) + return; + +- clang::StringRef fileNameRealPath = file->tryGetRealPathName(); ++ clang::StringRef fileNameRealPath = file-> ++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0)) ++ getFileEntry(). ++#endif ++ tryGetRealPathName(); + if (!LupdatePrivate::isFileSignificant(fileNameRealPath.str())) + return; + +diff -Nuar a/src/linguist/lupdate/lupdatepreprocessoraction.h b/src/linguist/lupdate/lupdatepreprocessoraction.h +--- a/src/linguist/lupdate/lupdatepreprocessoraction.h 2022-09-23 14:50:40.000000000 +0300 ++++ b/src/linguist/lupdate/lupdatepreprocessoraction.h 2023-01-19 12:01:57.650503199 +0300 +@@ -51,7 +51,12 @@ + void SourceRangeSkipped(clang::SourceRange sourceRange, clang::SourceLocation endifLoc) override; + void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/, + clang::StringRef /*fileName*/, bool /*isAngled*/, +- clang::CharSourceRange /*filenameRange*/, const clang::FileEntry *file, ++ clang::CharSourceRange /*filenameRange*/, ++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0)) ++ const clang::Optional file, ++#else ++ const clang::FileEntry *file, ++#endif + clang::StringRef /*searchPath*/, clang::StringRef /*relativePath*/, + const clang::Module */*imported*/, + clang::SrcMgr::CharacteristicKind /*fileType*/) override; diff --git a/desktop/toolkit/qt6/qt6-tools/pspec.xml b/desktop/toolkit/qt6/qt6-tools/pspec.xml index cdade593d2..39a9a132d9 100755 --- a/desktop/toolkit/qt6/qt6-tools/pspec.xml +++ b/desktop/toolkit/qt6/qt6-tools/pspec.xml @@ -32,7 +32,7 @@ qt6-declarative-devel - + llvm15.patch