From 4f5052a92ca402c4d90fbfdb9a18549b16d5a716 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 16 May 2021 19:51:52 +0200 Subject: [PATCH] clazy: rebuild for llvm12 --- ...a6e3393ebc75e16c91e606ad2015a16295c3.patch | 88 +++++++++++++++++++ srcpkgs/clazy/template | 2 +- 2 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/clazy/patches/2592a6e3393ebc75e16c91e606ad2015a16295c3.patch diff --git a/srcpkgs/clazy/patches/2592a6e3393ebc75e16c91e606ad2015a16295c3.patch b/srcpkgs/clazy/patches/2592a6e3393ebc75e16c91e606ad2015a16295c3.patch new file mode 100644 index 00000000000..9a91341513d --- /dev/null +++ b/srcpkgs/clazy/patches/2592a6e3393ebc75e16c91e606ad2015a16295c3.patch @@ -0,0 +1,88 @@ +From 2592a6e3393ebc75e16c91e606ad2015a16295c3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christian=20Sch=C3=A4rf?= +Date: Sat, 23 Jan 2021 15:34:10 +0100 +Subject: [PATCH] Fix build with Clang 12 + +Required due to Clang changes https://github.com/llvm/llvm-project/commit/b3eff6b7bb31e7ef059a3d238de138849839fbbd and https://github.com/llvm/llvm-project/commit/d758f79e5d381bd4f5122193a9538d89c907c812 +--- + src/SourceCompatibilityHelpers.h | 26 ++++++++++++++++++++++++++ + src/SuppressionManager.cpp | 5 ++--- + 2 files changed, 28 insertions(+), 3 deletions(-) + +diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h +index 4db141ab..1737d5a5 100644 +--- src/SourceCompatibilityHelpers.h ++++ src/SourceCompatibilityHelpers.h +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + + #if defined(CLAZY_USES_BOOST_REGEX) +@@ -103,6 +104,31 @@ inline clang::tooling::Replacements& DiagnosticFix(clang::tooling::Diagnostic &d + #endif + } + ++inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *invalid) ++{ ++#if LLVM_VERSION_MAJOR >= 12 ++ auto buffer = sm.getBufferOrNone(id); ++ *invalid = !buffer.hasValue(); ++ return buffer; ++#else ++ return sm.getBuffer(id, invalid); ++#endif ++} ++ ++#if LLVM_VERSION_MAJOR >= 12 ++inline clang::Lexer getLexer(clang::FileID id, llvm::Optional inputFile, ++ const clang::SourceManager &sm, const clang::LangOptions &lo) ++{ ++ return clang::Lexer(id, inputFile.getValue(), sm, lo); ++} ++#else ++inline clang::Lexer getLexer(clang::FileID id, const llvm::MemoryBuffer *inputFile, ++ const clang::SourceManager &sm, const clang::LangOptions &lo) ++{ ++ return clang::Lexer(id, inputFile, sm, lo); ++} ++#endif ++ + } + + #endif +diff --git a/src/SuppressionManager.cpp b/src/SuppressionManager.cpp +index 9d774ea6..9881388d 100644 +--- src/SuppressionManager.cpp ++++ src/SuppressionManager.cpp +@@ -24,7 +24,6 @@ + #include "clazy_stl.h" + + #include +-#include + #include + #include + #include +@@ -84,7 +83,7 @@ void SuppressionManager::parseFile(FileID id, const SourceManager &sm, const cla + Suppressions &suppressions = (*it).second; + + bool invalid = false; +- auto buffer = sm.getBuffer(id, &invalid); ++ auto buffer = clazy::getBuffer(sm, id, &invalid); + if (invalid) { + llvm::errs() << "SuppressionManager::parseFile: Invalid buffer "; + if (buffer) +@@ -92,7 +91,7 @@ void SuppressionManager::parseFile(FileID id, const SourceManager &sm, const cla + return; + } + +- Lexer lexer(id, buffer, sm, lo); ++ auto lexer = clazy::getLexer(id, buffer, sm, lo); + lexer.SetCommentRetentionState(true); + + Token token; +-- +GitLab + diff --git a/srcpkgs/clazy/template b/srcpkgs/clazy/template index 39f529593eb..2c958d5d481 100644 --- a/srcpkgs/clazy/template +++ b/srcpkgs/clazy/template @@ -1,7 +1,7 @@ # Template file for 'clazy' pkgname=clazy version=1.9 -revision=1 +revision=2 build_style=cmake makedepends="clang llvm" depends="clang"