Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clazy for openSUSE:Factory checked in at 2022-09-21 14:42:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clazy (Old) and /work/SRC/openSUSE:Factory/.clazy.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clazy" Wed Sep 21 14:42:42 2022 rev:20 rq:1005060 version:1.11 Changes: -------- --- /work/SRC/openSUSE:Factory/clazy/clazy.changes 2022-01-27 23:17:29.958757467 +0100 +++ /work/SRC/openSUSE:Factory/.clazy.new.2083/clazy.changes 2022-09-21 14:43:45.457969155 +0200 @@ -1,0 +2,9 @@ +Tue Sep 20 19:36:06 UTC 2022 - Christophe Giboudeaux <christo...@krop.fr> + +- Add upstream changes: + * 0001-Limit-the-clang-AST-crash-workaround-to-clang-7.0.patch + * 0001-Fix-crash-when-Q_PROPERTY-contents-is-empty.patch + * 0001-Allow-passing-no-check-in-plugin-arg-clazy-commandli.patch + * 0001-Build-fixes-for-LLVM-Clang-15.0.0.patch + +------------------------------------------------------------------- New: ---- 0001-Allow-passing-no-check-in-plugin-arg-clazy-commandli.patch 0001-Build-fixes-for-LLVM-Clang-15.0.0.patch 0001-Fix-crash-when-Q_PROPERTY-contents-is-empty.patch 0001-Limit-the-clang-AST-crash-workaround-to-clang-7.0.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clazy.spec ++++++ --- /var/tmp/diff_new_pack.Kv6ZQt/_old 2022-09-21 14:43:45.917970356 +0200 +++ /var/tmp/diff_new_pack.Kv6ZQt/_new 2022-09-21 14:43:45.921970366 +0200 @@ -26,6 +26,11 @@ Source0: https://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz Source1: https://download.kde.org/stable/%{name}/%{version}/src/%{name}-%{version}.tar.xz.sig Source2: clazy.keyring +# Upstream changes on top of clazy 1.11 +Patch0: 0001-Limit-the-clang-AST-crash-workaround-to-clang-7.0.patch +Patch1: 0001-Fix-crash-when-Q_PROPERTY-contents-is-empty.patch +Patch2: 0001-Allow-passing-no-check-in-plugin-arg-clazy-commandli.patch +Patch3: 0001-Build-fixes-for-LLVM-Clang-15.0.0.patch BuildRequires: clang BuildRequires: clang-devel >= 8.0 BuildRequires: cmake >= 3.7 ++++++ 0001-Allow-passing-no-check-in-plugin-arg-clazy-commandli.patch ++++++ >From d3d2108ed77cc1def6d2d2c8e0cd36c99585356f Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <aa...@kde.org> Date: Fri, 5 Aug 2022 21:59:09 +0200 Subject: [PATCH] Allow passing no-check in -plugin-arg-clazy commandline This way one can define the global checks in an environment variable but fine tune them on a file per file basis with compile flags --- src/checkmanager.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/checkmanager.cpp b/src/checkmanager.cpp index e3d7018f..24aec9f1 100644 --- a/src/checkmanager.cpp +++ b/src/checkmanager.cpp @@ -189,16 +189,15 @@ RegisteredCheck::List CheckManager::requestedChecks(std::vector<std::string> &ar if (args.size() > 1) // we only expect a level and a comma separated list of arguments return {}; + vector<string> userDisabledChecks; if (args.size() == 1) { // #2 Process list of comma separated checks that were passed to compiler - result = checksForCommaSeparatedString(args[0]); - if (result.empty()) // User passed inexisting checks. + result = checksForCommaSeparatedString(args[0], /*by-ref*/ userDisabledChecks); + if (result.empty() && userDisabledChecks.empty()) // User passed inexisting checks. return {}; } // #3 Append checks specified from env variable - - vector<string> userDisabledChecks; RegisteredCheck::List checksFromEnv = requestedChecksThroughEnv(/*by-ref*/ userDisabledChecks); copy(checksFromEnv.cbegin(), checksFromEnv.cend(), back_inserter(result)); -- 2.37.3 ++++++ 0001-Build-fixes-for-LLVM-Clang-15.0.0.patch ++++++ >From 20fca52da739ebefa47e35f6b338bb99a0da3cfe Mon Sep 17 00:00:00 2001 From: Cristian Adam <cristian.a...@qt.io> Date: Tue, 6 Sep 2022 16:30:02 +0200 Subject: [PATCH] Build fixes for LLVM/Clang 15.0.0 Change-Id: Icc39a0b1acffb5a6a4798b1259d8ad4e7dd47bc5 --- CMakeLists.txt | 6 ++++++ src/PreProcessorVisitor.cpp | 2 +- src/PreProcessorVisitor.h | 2 +- src/SourceCompatibilityHelpers.h | 15 +++++++++++++++ src/Utils.cpp | 3 ++- src/checkbase.cpp | 4 ++-- src/checkbase.h | 4 ++-- src/checks/manuallevel/qt6-fwd-fixes.cpp | 2 +- src/checks/manuallevel/qt6-fwd-fixes.h | 2 +- src/checks/manuallevel/qt6-header-fixes.cpp | 2 +- src/checks/manuallevel/qt6-header-fixes.h | 2 +- 11 files changed, 33 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c780b0d..100135af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,10 @@ else() set(clang_tooling_refactoring_lib clangToolingRefactor) endif() +if (${LLVM_VERSION} VERSION_GREATER_EQUAL "15.0.0") + set(clang_support_lib clangSupport) +endif() + macro(link_to_llvm name is_standalone) if (CLAZY_LINK_CLANG_DYLIB) target_link_libraries(${name} clang-cpp) @@ -131,6 +135,7 @@ macro(link_to_llvm name is_standalone) target_link_libraries(${name} ${clang_lib}) endforeach() + target_link_libraries(${name} ${clang_support_lib}) target_link_libraries(${name} clangTooling) target_link_libraries(${name} clangToolingCore) target_link_libraries(${name} ${clang_tooling_refactoring_lib}) @@ -302,6 +307,7 @@ else() clangFrontendTool clangRewrite clangSerialization + ${clang_support_lib} clangTooling clangStaticAnalyzerCheckers clangStaticAnalyzerCore diff --git a/src/PreProcessorVisitor.cpp b/src/PreProcessorVisitor.cpp index 5e63a131..5fdfe5f3 100644 --- a/src/PreProcessorVisitor.cpp +++ b/src/PreProcessorVisitor.cpp @@ -185,7 +185,7 @@ void PreProcessorVisitor::MacroExpands(const Token &MacroNameTok, const MacroDef void PreProcessorVisitor::InclusionDirective (clang::SourceLocation, const clang::Token &, clang::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange, - const clang::FileEntry *, clang::StringRef, clang::StringRef, + clazy::OptionalFileEntryRef, clang::StringRef, clang::StringRef, const clang::Module *, clang::SrcMgr::CharacteristicKind) { if (m_ci.getPreprocessor().isInPrimaryFile() && !clazy::endsWith(FileName.str(), ".moc")) { diff --git a/src/PreProcessorVisitor.h b/src/PreProcessorVisitor.h index dc80ff36..1bb17a5e 100644 --- a/src/PreProcessorVisitor.h +++ b/src/PreProcessorVisitor.h @@ -71,7 +71,7 @@ protected: clang::SourceRange range, const clang::MacroArgs *) override; void InclusionDirective (clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange, - const clang::FileEntry *File, clang::StringRef SearchPath, clang::StringRef RelativePath, + clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override; private: std::string getTokenSpelling(const clang::MacroDefinition &) const; diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h index 4ea923a2..c1a23a4b 100644 --- a/src/SourceCompatibilityHelpers.h +++ b/src/SourceCompatibilityHelpers.h @@ -144,6 +144,21 @@ inline bool contains_lower(clang::StringRef haystack, clang::StringRef needle) #endif } +#if LLVM_VERSION_MAJOR >= 15 +using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>; +#else +using OptionalFileEntryRef = const clang::FileEntry*; +#endif + +inline bool isAscii(clang::StringLiteral *lt) +{ +#if LLVM_VERSION_MAJOR >= 15 + return lt->isOrdinary(); +#else + return lt->isAscii(); +#endif +} + } #endif diff --git a/src/Utils.cpp b/src/Utils.cpp index 3cdf7876..70e0577c 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -25,6 +25,7 @@ #include "Utils.h" #include "StringUtils.h" #include "HierarchyUtils.h" +#include "SourceCompatibilityHelpers.h" #include "StmtBodyRange.h" #include "clazy_stl.h" @@ -670,7 +671,7 @@ const CXXRecordDecl *Utils::recordForMemberCall(CXXMemberCallExpr *call, string bool Utils::isAscii(StringLiteral *lt) { // '??' for some reason has isAscii() == true, so also call containsNonAsciiOrNull - return lt && lt->isAscii() && !lt->containsNonAsciiOrNull(); + return lt && clazy::isAscii(lt) && !lt->containsNonAsciiOrNull(); } bool Utils::isInDerefExpression(Stmt *s, ParentMap *map) diff --git a/src/checkbase.cpp b/src/checkbase.cpp index f5936dfd..dcc7c999 100644 --- a/src/checkbase.cpp +++ b/src/checkbase.cpp @@ -105,7 +105,7 @@ void ClazyPreprocessorCallbacks::MacroDefined(const Token ¯oNameTok, const M } void ClazyPreprocessorCallbacks::InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) { check->VisitInclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, FilenameRange, File, SearchPath, RelativePath, Imported, FileType); @@ -182,7 +182,7 @@ void CheckBase::VisitEndif(SourceLocation, SourceLocation) } void CheckBase::VisitInclusionDirective(clang::SourceLocation , const clang::Token &, clang::StringRef , bool , - clang::CharSourceRange , const clang::FileEntry *, clang::StringRef , + clang::CharSourceRange , clazy::OptionalFileEntryRef, clang::StringRef , clang::StringRef , const clang::Module *, clang::SrcMgr::CharacteristicKind ) { // Overriden in derived classes diff --git a/src/checkbase.h b/src/checkbase.h index c5db2daf..02f6a6bf 100644 --- a/src/checkbase.h +++ b/src/checkbase.h @@ -91,7 +91,7 @@ public: void Else(clang::SourceLocation loc, clang::SourceLocation ifLoc) override; void Endif(clang::SourceLocation loc, clang::SourceLocation ifLoc) override; void InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override; private: CheckBase *const check; @@ -151,7 +151,7 @@ protected: virtual void VisitElse(clang::SourceLocation loc, clang::SourceLocation ifLoc); virtual void VisitEndif(clang::SourceLocation loc, clang::SourceLocation ifLoc); virtual void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType); void enablePreProcessorCallbacks(); diff --git a/src/checks/manuallevel/qt6-fwd-fixes.cpp b/src/checks/manuallevel/qt6-fwd-fixes.cpp index 83bf81ee..c87d9ca0 100644 --- a/src/checks/manuallevel/qt6-fwd-fixes.cpp +++ b/src/checks/manuallevel/qt6-fwd-fixes.cpp @@ -166,7 +166,7 @@ void Qt6FwdFixes::VisitDecl(clang::Decl *decl) } void Qt6FwdFixes::VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) { auto current_file = m_sm.getFilename(HashLoc); diff --git a/src/checks/manuallevel/qt6-fwd-fixes.h b/src/checks/manuallevel/qt6-fwd-fixes.h index 37b59d95..bb928ba6 100644 --- a/src/checks/manuallevel/qt6-fwd-fixes.h +++ b/src/checks/manuallevel/qt6-fwd-fixes.h @@ -47,7 +47,7 @@ public: explicit Qt6FwdFixes(const std::string &name, ClazyContext *context); void VisitDecl(clang::Decl *decl) override; void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override; bool m_including_qcontainerfwd = false; std::set<clang::StringRef> m_qcontainerfwd_included_in_files; diff --git a/src/checks/manuallevel/qt6-header-fixes.cpp b/src/checks/manuallevel/qt6-header-fixes.cpp index d458b77c..aaa28093 100644 --- a/src/checks/manuallevel/qt6-header-fixes.cpp +++ b/src/checks/manuallevel/qt6-header-fixes.cpp @@ -270,7 +270,7 @@ Qt6HeaderFixes::Qt6HeaderFixes(const std::string &name, ClazyContext *context) } void Qt6HeaderFixes::VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) { if (shouldIgnoreFile(HashLoc)) diff --git a/src/checks/manuallevel/qt6-header-fixes.h b/src/checks/manuallevel/qt6-header-fixes.h index ae09f7ad..8ffbb100 100644 --- a/src/checks/manuallevel/qt6-header-fixes.h +++ b/src/checks/manuallevel/qt6-header-fixes.h @@ -46,7 +46,7 @@ class Qt6HeaderFixes public: explicit Qt6HeaderFixes(const std::string &name, ClazyContext *context); void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath, + clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override; }; -- 2.37.3 ++++++ 0001-Fix-crash-when-Q_PROPERTY-contents-is-empty.patch ++++++ >From 3c673d922103424805b6113aaa648f3a42d5fc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= <ivan.cu...@kdab.com> Date: Tue, 21 Jun 2022 23:21:47 +0200 Subject: [PATCH] Fix crash when Q_PROPERTY contents is empty --- src/checks/level1/qproperty-without-notify.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/checks/level1/qproperty-without-notify.cpp b/src/checks/level1/qproperty-without-notify.cpp index 3af9fee2..47b3a72b 100644 --- a/src/checks/level1/qproperty-without-notify.cpp +++ b/src/checks/level1/qproperty-without-notify.cpp @@ -70,6 +70,13 @@ void QPropertyWithoutNotify::VisitMacroExpands(const clang::Token &MacroNameTok, CharSourceRange crange = Lexer::getAsCharRange(range, sm(), lo()); string text = static_cast<std::string>(Lexer::getSourceText(crange, sm(), lo())); + if (text.empty()) { + // If the text is empty, it is more likely there is an error + // in parsing than an empty Q_PROPERTY macro call (which would + // be a moc error anyhow). + return; + } + if (text.back() == ')') text.pop_back(); -- 2.37.3 ++++++ 0001-Limit-the-clang-AST-crash-workaround-to-clang-7.0.patch ++++++ >From 3ab212f4eb8c4e7dc00243070116d5258fa35169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <b...@lindev.ch> Date: Wed, 18 May 2022 12:00:50 +0200 Subject: [PATCH] Limit the clang AST crash workaround to clang 7.0 The workaround disables some functionality when building with clang in order to work around a clang bug that was introduced in 7.0 and fixed in 8.0. Limit the workaround to clang versions actually affected by the bug. Verified to work perfectly when built with clang 14.0.3. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8459c5..22f276c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,8 +56,8 @@ if (CLAZY_ENABLE_SANITIZERS) endif() endif() -if (CLAZY_AST_MATCHERS_CRASH_WORKAROUND AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - message("Enabling AST Matchers workaround. Consider building with gcc instead. See bug #392223.") +if (CLAZY_AST_MATCHERS_CRASH_WORKAROUND AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + message("Enabling AST Matchers workaround. Consider updating clang or building with gcc instead. See bug #392223.") add_definitions(-DCLAZY_DISABLE_AST_MATCHERS) endif() @@ -81,7 +81,7 @@ endif() # Look for std::regex support message("Looking for std::regex support...") -try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp) +try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp CXX_STANDARD 17 CXX_STANDARD_REQUIRED true) if(NOT REGEX_RUN_RESULT EQUAL 0) message("Using boost::regex instead of std::regex") -- 2.37.3