Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions clang-uml-clang21.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/tests/test_clang_util.cc b/tests/test_clang_util.cc
index 3197efa..2117824 100644
--- a/tests/test_clang_util.cc
+++ b/tests/test_clang_util.cc
@@ -144,14 +144,14 @@ TEST_CASE("Test diagnostic_consumer")
auto fs = llvm::vfs::getRealFileSystem();
FileSystemOptions file_opts;
FileManager file_mgr(file_opts, fs);
- auto diagnostic_engine = DiagnosticsEngine(
- llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()),
- new DiagnosticOptions());
+ auto diagIDs1 = llvm::makeIntrusiveRefCnt<clang::DiagnosticIDs>();
+ clang::DiagnosticOptions diagOpts1;
+ auto diagnostic_engine = clang::DiagnosticsEngine(diagIDs1, diagOpts1);
SourceManager source_mgr(diagnostic_engine, file_mgr);

- DiagnosticsEngine diag_engine(
- llvm::IntrusiveRefCntPtr<DiagnosticIDs>(new DiagnosticIDs()),
- new DiagnosticOptions());
+ auto diagIDs2 = llvm::makeIntrusiveRefCnt<clang::DiagnosticIDs>();
+ clang::DiagnosticOptions diagOpts2;
+ clang::DiagnosticsEngine diag_engine(diagIDs2, diagOpts2);

diag_engine.setClient(&consumer, false);
auto id_note = diag_engine.getCustomDiagID(
@@ -198,4 +198,4 @@ TEST_CASE("Test diagnostic_consumer")
CHECK(consumer.diagnostics.size() == 4);
CHECK(consumer.diagnostics[3].level == DiagnosticsEngine::Fatal);
CHECK(consumer.diagnostics[3].description == "test fatal message");
-}
\ No newline at end of file
+}
18 changes: 18 additions & 0 deletions clang-uml-yamlcpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aad3092..839a8f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -145,12 +145,7 @@ find_package(yaml-cpp REQUIRED)
if(MSVC)
add_definitions(-DYAML_CPP_STATIC_DEFINE)
endif(MSVC)
-if(APPLE)
- set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
-endif(APPLE)
-if(LINUX)
- set(YAML_CPP_LIBRARIES yaml-cpp)
-endif(LINUX)
+set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
message(STATUS "Found yaml-cpp at: ${YAML_CPP_INCLUDE_DIR}, library: ${YAML_CPP_LIBRARIES}")

#
10 changes: 7 additions & 3 deletions clang-uml.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
### RPM external clang-uml 0.5.2
### RPM external clang-uml 0.6.2x

%define tag cd6dce2b0b34d55534d3de512ab088b9ad71bc76
%define tag 5e2993e75ebc88af6cb239f2ffae88da7431cb0d
%define branch master

%define github_user bkryza
Source: git+https://github.com/%{github_user}/clang-uml.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Patch0: clang-uml-clang21
Patch1: clang-uml-yamlcpp
BuildRequires: cmake ninja
Requires: yaml-cpp llvm zlib

%prep
%setup -n %{n}-%{realversion}
%patch0 -p1
%patch1 -p1

%build
rm -rf ../build
Expand All @@ -28,7 +32,7 @@ cmake ../%{n}-%{realversion} \
-DCMAKE_CXX_FLAGS="-Wno-sign-compare" \
%endif
-DGIT_VERSION="%{realversion}" \
-DCMAKE_PREFIX_PATH="${YAML_CPP_ROOT}/lib64/cmake/yaml-cpp;${ZLIB_ROOT}"
-DCMAKE_PREFIX_PATH="${YAML_CPP_ROOT};${ZLIB_ROOT}"

ninja -v %{makeprocesses}

Expand Down
14 changes: 6 additions & 8 deletions llvm.spec
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
### RPM external llvm 18.1.6
### RPM external llvm 21.1.4

## INITENV +PATH LD_LIBRARY_PATH %{i}/lib64
## INITENV +PATH PYTHON3PATH %{i}/lib64/python%{cms_python3_major_minor_version}/site-packages

BuildRequires: cmake ninja
Requires: gcc zlib python3 libxml2 zstd libunwind
%{!?without_cuda:Requires: cuda}

%define llvmCommit 02c7568fc9f555b2c72fc169c8c68e2116d97382
%define llvmBranch cms/release/18.x/1118c2e
%define iwyuCommit 377eaef70cdda47368939f4d9beabfabe3f628f0
%define iwyuBranch clang_18
%define llvmCommit 3063d23cfa249166b2e0c33a02c7300c20ffb2d
%define llvmBranch cms/llvmorg-21.1.4
%define iwyuCommit 791e69ea4662cb3e74e8128fd5fd69bd7f4ea6b3
%define iwyuBranch clang_21

Source0: git+https://github.com/cms-externals/llvm-project.git?obj=%{llvmBranch}/%{llvmCommit}&export=llvm-%{realversion}-%{llvmCommit}&module=llvm-%{realversion}-%{llvmCommit}&output=/llvm-%{realversion}-%{llvmCommit}.tgz
Source1: git+https://github.com/include-what-you-use/include-what-you-use.git?obj=%{iwyuBranch}/%{iwyuCommit}&export=iwyu-%{realversion}-%{iwyuCommit}&module=iwyu-%{realversion}-%{iwyuCommit}&output=/iwyu-%{realversion}-%{iwyuCommit}.tgz
# GCC 15 fix: include cstdint
Patch0: llvm-gcc15
%define keep_archives true

%prep
%setup -T -b0 -n llvm-%{realversion}-%{llvmCommit}
%patch0 -p1

# include-what-you-see is not LLVM project, we add it explicitly to the clang tools
%setup -T -D -a1 -c -n llvm-%{realversion}-%{llvmCommit}/clang/tools
Expand Down
62 changes: 62 additions & 0 deletions mozsearch-clang21.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/clang-plugin/MozsearchIndexer.cpp b/clang-plugin/MozsearchIndexer.cpp
index a601b05..380cbcd 100644
--- a/clang-plugin/MozsearchIndexer.cpp
+++ b/clang-plugin/MozsearchIndexer.cpp
@@ -1485,7 +1485,9 @@ public:
QualType CanonicalFieldType = FieldType.getCanonicalType();
LangOptions langOptions;
PrintingPolicy Policy(langOptions);
+#if LLVM_VERSION_MAJOR < 21
Policy.PrintCanonicalTypes = true;
+#endif
J.attribute("type", CanonicalFieldType.getAsString(Policy));

const TagDecl *tagDecl = CanonicalFieldType->getAsTagDecl();
diff --git a/clang-plugin/from-clangd/HeuristicResolver.cpp b/clang-plugin/from-clangd/HeuristicResolver.cpp
index 719094d..54184a4 100644
--- a/clang-plugin/from-clangd/HeuristicResolver.cpp
+++ b/clang-plugin/from-clangd/HeuristicResolver.cpp
@@ -27,7 +27,7 @@ const auto StaticFilter = [](const NamedDecl *D) {
};
const auto ValueFilter = [](const NamedDecl *D) { return isa<ValueDecl>(D); };
const auto TypeFilter = [](const NamedDecl *D) { return isa<TypeDecl>(D); };
-const auto TemplateFilter = [](const NamedDecl *D) {
+[[maybe_unused]] const auto TemplateFilter = [](const NamedDecl *D) {
return isa<TemplateDecl>(D);
};

@@ -203,12 +203,22 @@ std::vector<const NamedDecl *> HeuristicResolver::resolveDependentNameType(
DNT->getIdentifier(), TypeFilter);
}

+
+#include "clang/Basic/Version.h"
std::vector<const NamedDecl *>
HeuristicResolver::resolveTemplateSpecializationType(
const DependentTemplateSpecializationType *DTST) const {
+#if LLVM_VERSION_MAJOR >= 21
+ // In LLVM 21+, DependentTemplateSpecializationType no longer exposes
+ // getQualifier(), getIdentifier(), or getTemplateName().
+ // We can’t meaningfully resolve it here — return an empty result.
+ return {};
+#else
+ // Legacy LLVM ≤ 20 path.
return resolveDependentMember(
resolveNestedNameSpecifierToType(DTST->getQualifier()),
DTST->getIdentifier(), TemplateFilter);
+#endif
}

std::vector<const NamedDecl *>
@@ -249,8 +259,11 @@ const Type *HeuristicResolver::resolveNestedNameSpecifierToType(
// that may be dependent as well, so for convenience handle
// the TypeSpec cases too.
switch (NNS->getKind()) {
+#if LLVM_VERSION_MAJOR >= 21
case NestedNameSpecifier::TypeSpec:
+#else
case NestedNameSpecifier::TypeSpecWithTemplate:
+#endif
return NNS->getAsType();
case NestedNameSpecifier::Identifier: {
return resolveDeclsToType(
6 changes: 4 additions & 2 deletions mozsearch.spec
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
### RPM external mozsearch 20240514
### RPM external mozsearch 20251022

%define tag d697005b97f28d493a24887ed25fd2e68839c716
%define tag 1c886cc95c4e811709e97f711d7691ff8b87bda9
%define branch master

%define github_user mozsearch
Source: git+https://github.com/%{github_user}/%{n}.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Patch0: mozsearch-gcc-toolchain
Patch1: mozsearch-clang21
BuildRequires: gmake
Requires: llvm

%prep
%setup -n %{n}-%{realversion}
%patch0 -p1
%patch1 -p1

%build
cd clang-plugin
Expand Down
4 changes: 2 additions & 2 deletions py3-dxr.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
## INITENV +PATH PYTHON3PATH %i/${PYTHON3_LIB_SITE_PACKAGES}
Requires: zlib llvm sqlite
Requires: py3-Jinja2 py3-parsimonious py3-pysqlite3 py3-Pygments
%define dxrCommit 737d3b0570e5e4a7845e8cba7c0b000d2911f24e
%define branch cms/6ea764102a/clang18
%define dxrCommit b55cf0eeacc494adc575562eac290b3e4871a6ac
%define branch cms/clang21

Source0: git+https://github.com/cms-externals/dxr.git?obj=%{branch}/%{dxrCommit}&export=dxr-%{dxrCommit}&module=dxr-%dxrCommit&output=/dxr-%{dxrCommit}.tgz
%define keep_archives true
Expand Down