mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
clazy, bump version (bump to LLVM18) (#10667)
* clazy, bump version (bump to LLVM18) * Update dev-util/clazy/patches/clazy-1.12.patchset Co-authored-by: Joachim Mairböck <j.mairboeck@gmail.com> --------- Co-authored-by: Joachim Mairböck <j.mairboeck@gmail.com>
This commit is contained in:
@@ -6,10 +6,9 @@ automatic refactoring."
|
||||
HOMEPAGE="https://www.kdab.com"
|
||||
COPYRIGHT="2016-2019 Sérgio Martins"
|
||||
LICENSE="GNU LGPL v2"
|
||||
REVISION="2"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://download.kde.org/stable/clazy/$portVersion/src/clazy-$portVersion.tar.xz"
|
||||
CHECKSUM_SHA256="66165df33be8785218720c8947aa9099bae6d06c90b1501953d9f95fdfa0120a"
|
||||
# upstream patches
|
||||
CHECKSUM_SHA256="611749141d07ce1e006f8a1253f9b2dbd5b7b44d2d5322d471d62430ec2849ac"
|
||||
PATCHES="clazy-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
@@ -31,15 +30,15 @@ PROVIDES="
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libclang_cpp$secondaryArchSuffix
|
||||
lib:libLLVM_17$secondaryArchSuffix
|
||||
lib:libLLVM$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libLLVM_17$secondaryArchSuffix
|
||||
devel:libLLVM_18$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:clang_17
|
||||
cmd:clang_18
|
||||
cmd:cmake
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
@@ -1,463 +0,0 @@
|
||||
From 782b36b80abbe8ebe947883aa0c4dca1179268da Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Adam <cristian.adam@qt.io>
|
||||
Date: Tue, 6 Sep 2022 16:30:02 +0200
|
||||
Subject: Build fixes for LLVM/Clang 15.0.0
|
||||
|
||||
Change-Id: Icc39a0b1acffb5a6a4798b1259d8ad4e7dd47bc5
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f8459c5..d89325e 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 5e63a13..5fdfe5f 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 dc80ff3..1bb17a5 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 4ea923a..c1a23a4 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 3cdf787..70e0577 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 f5936df..dcc7c99 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 c5db2da..02f6a6b 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 83bf81e..c87d9ca 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 37b59d9..bb928ba 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 d458b77..aaa2809 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 ae09f7a..8ffbb10 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.45.1
|
||||
|
||||
|
||||
From 840ccca8ab06fd67760e11bf8dac083877728543 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: Adapt to API changes in clang/llvm 16
|
||||
|
||||
|
||||
diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
|
||||
index c1a23a4..5e2dc60 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 02f6a6b..6a8c634 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 b0da926..1ba1126 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");
|
||||
}
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From 08dd17a6a47b0a375a7d51c37e7a331c190188bf Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Adam <cristian.adam@gmail.com>
|
||||
Date: Mon, 14 Aug 2023 18:16:01 +0200
|
||||
Subject: Fix compilation with LLVM 17.0.0 (rc2)
|
||||
|
||||
Change-Id: I9d3fc86185c1e7c86145da043e1982d2979b36e9
|
||||
|
||||
diff --git a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
index ae1e607..2735404 100644
|
||||
--- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
+++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
@@ -61,9 +61,13 @@ static bool isIntentionallyNotPowerOf2(EnumConstantDecl *en) {
|
||||
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 +162,11 @@ void UnexpectedFlagEnumeratorValue::VisitDecl(clang::Decl *decl)
|
||||
|
||||
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();
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From b27a4294635f87988ca04613aabd15220ef78569 Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Adam <cristian.adam@gmail.com>
|
||||
Date: Mon, 12 Feb 2024 15:42:57 +0100
|
||||
Subject: Fix compiler error with LLVM 18
|
||||
|
||||
Change-Id: Iae75ad46a90a8c0cddf4ab986bb922ce18ffc2af
|
||||
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
|
||||
|
||||
diff --git a/src/FunctionUtils.h b/src/FunctionUtils.h
|
||||
index 37504b0..a0db912 100644
|
||||
--- a/src/FunctionUtils.h
|
||||
+++ b/src/FunctionUtils.h
|
||||
@@ -96,6 +96,15 @@ inline bool parametersMatch(const clang::FunctionDecl *f1, const clang::Function
|
||||
return true;
|
||||
}
|
||||
|
||||
+inline bool isPureVirtual(const clang::CXXMethodDecl *decl)
|
||||
+{
|
||||
+#if LLVM_VERSION_MAJOR >= 18
|
||||
+ return decl->isPureVirtual();
|
||||
+#else
|
||||
+ return decl->isPure();
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Returns true if a class contains a method with a specific signature.
|
||||
* (method->getParent() doesn't need to equal record)
|
||||
@@ -107,7 +116,7 @@ inline bool classImplementsMethod(const clang::CXXRecordDecl *record, const clan
|
||||
|
||||
llvm::StringRef methodName = clazy::name(method);
|
||||
for (auto m : record->methods()) {
|
||||
- if (!m->isPure() && clazy::name(m) == methodName && parametersMatch(m, method))
|
||||
+ if (!clazy::isPureVirtual(m) && clazy::name(m) == methodName && parametersMatch(m, method))
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/checks/level2/virtual-call-ctor.cpp b/src/checks/level2/virtual-call-ctor.cpp
|
||||
index e6af81c..6bc2b34 100644
|
||||
--- a/src/checks/level2/virtual-call-ctor.cpp
|
||||
+++ b/src/checks/level2/virtual-call-ctor.cpp
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "virtual-call-ctor.h"
|
||||
+#include "FunctionUtils.h"
|
||||
#include "HierarchyUtils.h"
|
||||
#include "SourceCompatibilityHelpers.h"
|
||||
#include "clazy_stl.h"
|
||||
@@ -115,7 +116,7 @@ SourceLocation VirtualCallCtor::containsVirtualCall(clang::CXXRecordDecl *classD
|
||||
continue;
|
||||
|
||||
if (memberDecl->getParent() == classDecl) {
|
||||
- if (memberDecl->isPure()) {
|
||||
+ if (clazy::isPureVirtual(memberDecl)) {
|
||||
return clazy::getLocStart(callExpr);
|
||||
} else {
|
||||
if (containsVirtualCall(classDecl, memberDecl->getBody(), processedStmts).isValid())
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From 44f32f88606abc72f7afeca18d51d5a9d43e9dbf Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Adam <cristian.adam@gmail.com>
|
||||
Date: Mon, 12 Feb 2024 15:43:15 +0100
|
||||
Subject: Fix linker error with LLVM 18
|
||||
|
||||
Change-Id: I4090a66912568b007619d6dacc2f91a9f5466767
|
||||
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index d89325e..b503d13 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -118,6 +118,10 @@ if (${LLVM_VERSION} VERSION_GREATER_EQUAL "15.0.0")
|
||||
set(clang_support_lib clangSupport)
|
||||
endif()
|
||||
|
||||
+if (${LLVM_VERSION} VERSION_GREATER_EQUAL "18.0.0")
|
||||
+ set(clang_api_notes_lib clangAPINotes)
|
||||
+endif()
|
||||
+
|
||||
macro(link_to_llvm name is_standalone)
|
||||
if (CLAZY_LINK_CLANG_DYLIB)
|
||||
target_link_libraries(${name} clang-cpp)
|
||||
@@ -139,6 +143,7 @@ macro(link_to_llvm name is_standalone)
|
||||
target_link_libraries(${name} clangTooling)
|
||||
target_link_libraries(${name} clangToolingCore)
|
||||
target_link_libraries(${name} ${clang_tooling_refactoring_lib})
|
||||
+ target_link_libraries(${name} ${clang_api_notes_lib})
|
||||
endif()
|
||||
|
||||
foreach(llvm_lib ${LLVM_LIBS})
|
||||
@@ -312,6 +317,7 @@ else()
|
||||
clangStaticAnalyzerCheckers
|
||||
clangStaticAnalyzerCore
|
||||
clangStaticAnalyzerFrontend
|
||||
+ ${clang_api_notes_lib}
|
||||
)
|
||||
add_executable(clazy-standalone ${CLAZY_STANDALONE_SRCS})
|
||||
|
||||
--
|
||||
2.45.1
|
||||
|
||||
|
||||
From 6fd688c72eda9a1ccf76ac697cc8735ebb7b70fd Mon Sep 17 00:00:00 2001
|
||||
From: Schrijvers Luc <begasus@gmail.com>
|
||||
Date: Thu, 13 Jun 2024 13:50:31 +0200
|
||||
Subject: Disable PCH for 32bit
|
||||
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b503d13..23a39ab 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -178,10 +178,12 @@ macro(add_clang_plugin name)
|
||||
|
||||
add_library(${name} SHARED ${srcs})
|
||||
|
||||
+if(NOT HAIKU)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||
# 30% speedup
|
||||
target_precompile_headers(${name} PRIVATE src/checkbase.h)
|
||||
endif()
|
||||
+endif(HAIKU)
|
||||
|
||||
if(SYMBOL_FILE)
|
||||
set_target_properties(${name} PROPERTIES LINK_FlAGS "-exported_symbols_list ${SYMBOL_FILE}")
|
||||
--
|
||||
2.45.1
|
||||
|
||||
49
dev-util/clazy/patches/clazy-1.12.patchset
Normal file
49
dev-util/clazy/patches/clazy-1.12.patchset
Normal file
@@ -0,0 +1,49 @@
|
||||
From 39aec41779f45c74955a0e228e32cd8c797f03c5 Mon Sep 17 00:00:00 2001
|
||||
From: Schrijvers Luc <begasus@gmail.com>
|
||||
Date: Thu, 13 Jun 2024 13:50:31 +0200
|
||||
Subject: Disable PCH for 32bit
|
||||
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index bd6a584..58e7251 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -166,10 +166,12 @@ macro(add_clang_plugin name)
|
||||
|
||||
add_library(${name} SHARED ${srcs})
|
||||
|
||||
+if(NOT HAIKU)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||
# 30% speedup
|
||||
target_precompile_headers(${name} PRIVATE src/checkbase.h)
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
if(SYMBOL_FILE)
|
||||
set_target_properties(${name} PROPERTIES LINK_FlAGS "-exported_symbols_list ${SYMBOL_FILE}")
|
||||
--
|
||||
2.45.2
|
||||
|
||||
|
||||
From cf44436d1935c4c62a817f387ce0ab0c399f1906 Mon Sep 17 00:00:00 2001
|
||||
From: Schrijvers Luc <begasus@gmail.com>
|
||||
Date: Sat, 6 Jul 2024 11:45:30 +0200
|
||||
Subject: Silense deprecated warnings
|
||||
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 58e7251..f31f645 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -70,7 +70,7 @@ if(MSVC)
|
||||
# disable trigger-happy warnings from Clang/LLVM headers
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244 /wd4291 /wd4800 /wd4141 /wd4146 /wd4251")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -fno-exceptions -fno-rtti")
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wno-deprecated-declarations -Wwrite-strings -fno-exceptions -fno-rtti")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
|
||||
--
|
||||
2.45.2
|
||||
|
||||
Reference in New Issue
Block a user