mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
clazy: update to 1.12.
This commit is contained in:
parent
e82568a0b4
commit
04b0737032
5 changed files with 26 additions and 438 deletions
|
@ -1,66 +1,28 @@
|
||||||
From e49e57e1b12440a365a176ccfaded1d00ab0e62a Mon Sep 17 00:00:00 2001
|
--- clazy-1.12.orig/CMakeLists.txt 2024-06-30 21:33:30.000000000 +0200
|
||||||
From: John Zimmermann <me@johnnynator.dev>
|
+++ clazy-1.12/CMakeLists.txt 2024-08-04 17:17:37.878433212 +0200
|
||||||
Date: Mon, 9 Aug 2021 15:56:40 +0200
|
@@ -26,9 +26,9 @@
|
||||||
Subject: [PATCH] Replace Find* scripts with llvm/clang provided cmake modules
|
|
||||||
|
|
||||||
---
|
|
||||||
CMakeLists.txt | 24 +------
|
|
||||||
cmake/FindClang.cmake | 130 ---------------------------------
|
|
||||||
cmake/FindLLVM.cmake | 162 ------------------------------------------
|
|
||||||
3 files changed, 3 insertions(+), 313 deletions(-)
|
|
||||||
delete mode 100644 cmake/FindClang.cmake
|
|
||||||
delete mode 100644 cmake/FindLLVM.cmake
|
|
||||||
|
|
||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 6e649bfe..79fd1093 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -24,11 +24,10 @@ set(CLAZY_VERSION_PATCH "0")
|
|
||||||
set(CLAZY_VERSION "${CLAZY_VERSION_MAJOR}.${CLAZY_VERSION_MINOR}.${CLAZY_VERSION_PATCH}")
|
|
||||||
set(CLAZY_PRINT_VERSION "${CLAZY_VERSION_MAJOR}.${CLAZY_VERSION_MINOR}")
|
|
||||||
|
|
||||||
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
||||||
if (NOT CLAZY_BUILD_WITH_CLANG)
|
if (NOT CLAZY_BUILD_WITH_CLANG)
|
||||||
- find_package(Clang 8.0 MODULE REQUIRED)
|
- find_package(Clang 11.0 MODULE REQUIRED)
|
||||||
+ find_package(Clang CONFIG REQUIRED)
|
+ find_package(Clang CONFIG REQUIRED)
|
||||||
|
|
||||||
- if (CLANG_CLANG-CPP_LIB AND NOT APPLE)
|
- if (CLANG_CLANG-CPP_LIB AND NOT APPLE)
|
||||||
+ if (TARGET clang-cpp AND NOT APPLE)
|
+ if (TARGET clang-cpp AND NOT APPLE)
|
||||||
set(default_use_clang_cpp ON)
|
set(default_use_clang_cpp ON)
|
||||||
else()
|
else()
|
||||||
set(default_use_clang_cpp OFF)
|
set(default_use_clang_cpp OFF)
|
||||||
@@ -128,24 +127,7 @@ macro(link_to_llvm name is_standalone)
|
@@ -155,6 +155,7 @@
|
||||||
target_link_libraries(${name} ${clang_tooling_refactoring_lib})
|
foreach(llvm_system_lib ${LLVM_SYSTEM_LIBS})
|
||||||
endif()
|
target_link_libraries(${name} ${llvm_system_lib})
|
||||||
|
endforeach()
|
||||||
- foreach(llvm_lib ${LLVM_LIBS})
|
|
||||||
- if(NOT ${is_standalone} AND NOT APPLE AND NOT MINGW AND NOT MSVC)
|
|
||||||
- ## Don't link against LLVMSupport, causes: CommandLine Error: Option 'view-background' registered more than once!
|
|
||||||
- if (NOT llvm_lib MATCHES ".*LLVMSupport.*")
|
|
||||||
- target_link_libraries(${name} ${llvm_lib})
|
|
||||||
- endif()
|
|
||||||
- else()
|
|
||||||
- target_link_libraries(${name} ${llvm_lib})
|
|
||||||
- endif()
|
|
||||||
- endforeach()
|
|
||||||
-
|
|
||||||
- foreach(user_lib ${USER_LIBS})
|
|
||||||
- target_link_libraries(${name} ${user_lib})
|
|
||||||
- endforeach()
|
|
||||||
-
|
|
||||||
- foreach(llvm_system_lib ${LLVM_SYSTEM_LIBS})
|
|
||||||
- target_link_libraries(${name} ${llvm_system_lib})
|
|
||||||
- endforeach()
|
|
||||||
+ target_link_libraries(${name} LLVM)
|
+ target_link_libraries(${name} LLVM)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(${name} version.lib)
|
target_link_libraries(${name} version.lib)
|
||||||
diff --git a/cmake/FindClang.cmake b/cmake/FindClang.cmake
|
--- clazy-1.12.orig/cmake/FindClang.cmake 2024-06-30 21:33:30.000000000 +0200
|
||||||
deleted file mode 100644
|
+++ clazy-1.12/cmake/FindClang.cmake 1970-01-01 01:00:00.000000000 +0100
|
||||||
index 7a40b2fb..00000000
|
@@ -1,112 +0,0 @@
|
||||||
--- a/cmake/FindClang.cmake
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,130 +0,0 @@
|
|
||||||
-# Detect Clang libraries
|
-# Detect Clang libraries
|
||||||
-#
|
-#
|
||||||
-# Defines the following variables:
|
-# Defines the following variables:
|
||||||
|
@ -81,28 +43,9 @@ index 7a40b2fb..00000000
|
||||||
-# See http://clang.llvm.org/docs/InternalsManual.html for full list of libraries
|
-# See http://clang.llvm.org/docs/InternalsManual.html for full list of libraries
|
||||||
-
|
-
|
||||||
-#=============================================================================
|
-#=============================================================================
|
||||||
-# Copyright 2014-2015 Kevin Funk <kfunk@kde.org>
|
-# SPDX-FileCopyrightText: 2014-2015 Kevin Funk <kfunk@kde.org>
|
||||||
-#
|
-#
|
||||||
-# Redistribution and use in source and binary forms, with or without
|
-# SPDX-License-Identifier: BSD-2-Clause
|
||||||
-# modification, are permitted provided that the following conditions
|
|
||||||
-# are met:
|
|
||||||
-#
|
|
||||||
-# 1. Redistributions of source code must retain the above copyright
|
|
||||||
-# notice, this list of conditions and the following disclaimer.
|
|
||||||
-# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
-# notice, this list of conditions and the following disclaimer in the
|
|
||||||
-# documentation and/or other materials provided with the distribution.
|
|
||||||
-#
|
|
||||||
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
-#=============================================================================
|
-#=============================================================================
|
||||||
-
|
-
|
||||||
-if (${Clang_FIND_REQUIRED})
|
-if (${Clang_FIND_REQUIRED})
|
||||||
|
@ -154,6 +97,7 @@ index 7a40b2fb..00000000
|
||||||
- FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
|
- FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
|
||||||
- FIND_AND_ADD_CLANG_LIB(clangSema)
|
- FIND_AND_ADD_CLANG_LIB(clangSema)
|
||||||
- FIND_AND_ADD_CLANG_LIB(clangRewriteCore)
|
- FIND_AND_ADD_CLANG_LIB(clangRewriteCore)
|
||||||
|
- FIND_AND_ADD_CLANG_LIB(clangAPINotes)
|
||||||
-endif()
|
-endif()
|
||||||
-
|
-
|
||||||
-if(CLANG_LIBS OR CLANG_LIBCLANG_LIB OR CLANG_CLANG-CPP_LIB)
|
-if(CLANG_LIBS OR CLANG_LIBCLANG_LIB OR CLANG_CLANG-CPP_LIB)
|
||||||
|
@ -191,12 +135,9 @@ index 7a40b2fb..00000000
|
||||||
- message(FATAL_ERROR "Could NOT find Clang")
|
- message(FATAL_ERROR "Could NOT find Clang")
|
||||||
- endif()
|
- endif()
|
||||||
-endif()
|
-endif()
|
||||||
diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake
|
--- clazy-1.12.orig/cmake/FindLLVM.cmake 2024-06-30 21:33:30.000000000 +0200
|
||||||
deleted file mode 100644
|
+++ clazy-1.12/cmake/FindLLVM.cmake 1970-01-01 01:00:00.000000000 +0100
|
||||||
index fe7e87dd..00000000
|
@@ -1,143 +0,0 @@
|
||||||
--- a/cmake/FindLLVM.cmake
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,162 +0,0 @@
|
|
||||||
-# Find the native LLVM includes and libraries
|
-# Find the native LLVM includes and libraries
|
||||||
-#
|
-#
|
||||||
-# Defines the following variables
|
-# Defines the following variables
|
||||||
|
@ -216,28 +157,9 @@ index fe7e87dd..00000000
|
||||||
-# CMake variables or cache entries.
|
-# CMake variables or cache entries.
|
||||||
-
|
-
|
||||||
-#=============================================================================
|
-#=============================================================================
|
||||||
-# Copyright 2014 Kevin Funk <kfunk@kde.org>
|
-# SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org>
|
||||||
-#
|
-#
|
||||||
-# Redistribution and use in source and binary forms, with or without
|
-# SPDX-License-Identifier: BSD-2-Clause
|
||||||
-# modification, are permitted provided that the following conditions
|
|
||||||
-# are met:
|
|
||||||
-#
|
|
||||||
-# 1. Redistributions of source code must retain the above copyright
|
|
||||||
-# notice, this list of conditions and the following disclaimer.
|
|
||||||
-# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
-# notice, this list of conditions and the following disclaimer in the
|
|
||||||
-# documentation and/or other materials provided with the distribution.
|
|
||||||
-#
|
|
||||||
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
-#=============================================================================
|
-#=============================================================================
|
||||||
-
|
-
|
||||||
-if (NOT LLVM_ROOT AND DEFINED ENV{LLVM_ROOT})
|
-if (NOT LLVM_ROOT AND DEFINED ENV{LLVM_ROOT})
|
||||||
|
@ -359,6 +281,3 @@ index fe7e87dd..00000000
|
||||||
- message(STATUS " LLVM libraries: ${LLVM_LIBS}")
|
- message(STATUS " LLVM libraries: ${LLVM_LIBS}")
|
||||||
- message(STATUS " LLVM System libraries: ${LLVM_SYSTEM_LIBS}")
|
- message(STATUS " LLVM System libraries: ${LLVM_SYSTEM_LIBS}")
|
||||||
-endif()
|
-endif()
|
||||||
--
|
|
||||||
2.32.0
|
|
||||||
|
|
||||||
|
|
|
@ -1,220 +0,0 @@
|
||||||
From 20fca52da739ebefa47e35f6b338bb99a0da3cfe Mon Sep 17 00:00:00 2001
|
|
||||||
From: Cristian Adam <cristian.adam@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 @@ class PreProcessorVisitor
|
|
||||||
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 @@ class ClazyPreprocessorCallbacks
|
|
||||||
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 @@ class CheckBase
|
|
||||||
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 @@ class Qt6FwdFixes
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,83 +0,0 @@
|
||||||
From a05ac7eb6f6198c3f478bd7b5b4bfc062a8d63cc Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= <ivan.cukic@kdab.com>
|
|
||||||
Date: Tue, 7 Feb 2023 11:06:19 +0100
|
|
||||||
Subject: [PATCH] Adapt to API changes in clang/llvm 16
|
|
||||||
|
|
||||||
---
|
|
||||||
src/SourceCompatibilityHelpers.h | 17 ++++++++++++-----
|
|
||||||
src/checkbase.h | 1 +
|
|
||||||
src/checks/level0/lambda-in-connect.cpp | 2 +-
|
|
||||||
3 files changed, 14 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
|
|
||||||
index c1a23a4b..5e2dc606 100644
|
|
||||||
--- a/src/SourceCompatibilityHelpers.h
|
|
||||||
+++ b/src/SourceCompatibilityHelpers.h
|
|
||||||
@@ -107,7 +107,11 @@ inline clang::tooling::Replacements& DiagnosticFix(clang::tooling::Diagnostic &d
|
|
||||||
|
|
||||||
inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *invalid)
|
|
||||||
{
|
|
||||||
-#if LLVM_VERSION_MAJOR >= 12
|
|
||||||
+#if LLVM_VERSION_MAJOR >= 16
|
|
||||||
+ auto buffer = sm.getBufferOrNone(id);
|
|
||||||
+ *invalid = !buffer.has_value();
|
|
||||||
+ return buffer;
|
|
||||||
+#elif LLVM_VERSION_MAJOR >= 12
|
|
||||||
auto buffer = sm.getBufferOrNone(id);
|
|
||||||
*invalid = !buffer.hasValue();
|
|
||||||
return buffer;
|
|
||||||
@@ -116,11 +120,12 @@ inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *in
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if LLVM_VERSION_MAJOR >= 12
|
|
||||||
-
|
|
||||||
+#if LLVM_VERSION_MAJOR >= 16
|
|
||||||
+#define GET_LEXER(id, inputFile, sm, lo) \
|
|
||||||
+clang::Lexer(id, inputFile.value(), sm, lo)
|
|
||||||
+#elif LLVM_VERSION_MAJOR >= 12
|
|
||||||
#define GET_LEXER(id, inputFile, sm, lo) \
|
|
||||||
clang::Lexer(id, inputFile.getValue(), sm, lo)
|
|
||||||
-
|
|
||||||
#else
|
|
||||||
#define GET_LEXER(id, inputFile, sm, lo) \
|
|
||||||
clang::Lexer(id, inputFile, sm, lo)
|
|
||||||
@@ -144,7 +149,9 @@ inline bool contains_lower(clang::StringRef haystack, clang::StringRef needle)
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if LLVM_VERSION_MAJOR >= 15
|
|
||||||
+#if LLVM_VERSION_MAJOR >= 16
|
|
||||||
+using OptionalFileEntryRef = clang::CustomizableOptional<clang::FileEntryRef>;
|
|
||||||
+#elif LLVM_VERSION_MAJOR >= 15
|
|
||||||
using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
|
|
||||||
#else
|
|
||||||
using OptionalFileEntryRef = const clang::FileEntry*;
|
|
||||||
diff --git a/src/checkbase.h b/src/checkbase.h
|
|
||||||
index 02f6a6bf..6a8c634b 100644
|
|
||||||
--- a/src/checkbase.h
|
|
||||||
+++ b/src/checkbase.h
|
|
||||||
@@ -93,6 +93,7 @@ public:
|
|
||||||
void InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
diff --git a/src/checks/level0/lambda-in-connect.cpp b/src/checks/level0/lambda-in-connect.cpp
|
|
||||||
index b0da926f..1ba1126f 100644
|
|
||||||
--- a/src/checks/level0/lambda-in-connect.cpp
|
|
||||||
+++ b/src/checks/level0/lambda-in-connect.cpp
|
|
||||||
@@ -71,7 +71,7 @@ void LambdaInConnect::VisitStmt(clang::Stmt *stmt)
|
|
||||||
|
|
||||||
for (auto capture : captures) {
|
|
||||||
if (capture.getCaptureKind() == clang::LCK_ByRef) {
|
|
||||||
- VarDecl *declForCapture = capture.getCapturedVar();
|
|
||||||
+ auto *declForCapture = capture.getCapturedVar();
|
|
||||||
if (declForCapture && declForCapture != receiverDecl && clazy::isValueDeclInFunctionContext(declForCapture))
|
|
||||||
emitWarning(capture.getLocation(), "captured local variable by reference might go out of scope before lambda is called");
|
|
||||||
}
|
|
||||||
--
|
|
||||||
GitLab
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
--- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp 2022-01-20 18:18:47.000000000 -0500
|
|
||||||
+++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp 2023-11-03 17:12:24.669027622 -0400
|
|
||||||
@@ -61,8 +61,13 @@
|
|
||||||
if (val.isMask() && val.countTrailingOnes() >= MinOnesToQualifyAsMask)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
+#if LLVM_VERSION_MAJOR >= 17
|
|
||||||
+ if (val.isShiftedMask() && val.popcount() >= MinOnesToQualifyAsMask)
|
|
||||||
+ return true;
|
|
||||||
+#else
|
|
||||||
if (val.isShiftedMask() && val.countPopulation() >= MinOnesToQualifyAsMask)
|
|
||||||
return true;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
if (clazy::contains_lower(en->getName(), "mask"))
|
|
||||||
return true;
|
|
||||||
@@ -158,7 +163,11 @@
|
|
||||||
|
|
||||||
for (EnumConstantDecl* enumerator : enumerators) {
|
|
||||||
const auto &initVal = enumerator->getInitVal();
|
|
||||||
+#if LLVM_VERSION_MAJOR >= 17
|
|
||||||
+ if (!initVal.isPowerOf2() && !initVal.isZero() && !initVal.isNegative()) {
|
|
||||||
+#else
|
|
||||||
if (!initVal.isPowerOf2() && !initVal.isNullValue() && !initVal.isNegative()) {
|
|
||||||
+#endif
|
|
||||||
if (isIntentionallyNotPowerOf2(enumerator))
|
|
||||||
continue;
|
|
||||||
const auto value = enumerator->getInitVal().getLimitedValue();
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Template file for 'clazy'
|
# Template file for 'clazy'
|
||||||
pkgname=clazy
|
pkgname=clazy
|
||||||
version=1.11
|
version=1.12
|
||||||
revision=3
|
revision=1
|
||||||
build_style=cmake
|
build_style=cmake
|
||||||
build_helper=qemu
|
build_helper=qemu
|
||||||
hostmakedepends="llvm17 perl"
|
hostmakedepends="llvm18 perl"
|
||||||
makedepends="llvm17-devel"
|
makedepends="llvm18-devel"
|
||||||
depends="clang"
|
depends="clang"
|
||||||
short_desc="Qt oriented code checker based on clang framework"
|
short_desc="Qt oriented code checker based on clang framework"
|
||||||
maintainer="John <me@johnnynator.dev>"
|
maintainer="John <me@johnnynator.dev>"
|
||||||
license="LGPL-2.0-or-later"
|
license="LGPL-2.0-or-later"
|
||||||
homepage="https://apps.kde.org/en/clazy"
|
homepage="https://apps.kde.org/en/clazy"
|
||||||
distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
|
distfiles="${KDE_SITE}/clazy/${version}/src/${pkgname}-${version}.tar.xz"
|
||||||
checksum=66165df33be8785218720c8947aa9099bae6d06c90b1501953d9f95fdfa0120a
|
checksum=611749141d07ce1e006f8a1253f9b2dbd5b7b44d2d5322d471d62430ec2849ac
|
||||||
|
|
Loading…
Add table
Reference in a new issue