cling: 1.2 -> 1.3
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
|
||||
index eb29252..a62c0de 100644
|
||||
--- a/lib/CMakeLists.txt
|
||||
+++ b/lib/CMakeLists.txt
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
add_subdirectory(Interpreter)
|
||||
add_subdirectory(MetaProcessor)
|
||||
-if(CLING_INCLUDE_TESTS)
|
||||
- add_subdirectory(UserInterface)
|
||||
-endif()
|
||||
+# The UserInterface library (clingUserInterface) is linked unconditionally by the
|
||||
+# cling driver, so it must always be built. Upstream cling 1.3 mistakenly gates it
|
||||
+# behind CLING_INCLUDE_TESTS: the previous EXISTS check on the bundled textinput
|
||||
+# sources was dropped when those were removed in favor of LLVM's LineEditor, but the
|
||||
+# subdirectory must still be added. See lib/UserInterface and tools/driver.
|
||||
+add_subdirectory(UserInterface)
|
||||
add_subdirectory(Utils)
|
||||
@@ -1,54 +0,0 @@
|
||||
From cd4d1d8c4963620a6a84834948845df81fbbd70b Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
|
||||
Date: Tue, 17 Dec 2024 14:54:18 +0100
|
||||
Subject: [PATCH] Use single Parser for LookupHelper
|
||||
|
||||
It is the only construction of a temporary parser, and it seems not
|
||||
necessary (anymore).
|
||||
---
|
||||
include/cling/Interpreter/LookupHelper.h | 2 +-
|
||||
lib/Interpreter/Interpreter.cpp | 11 ++++-------
|
||||
2 files changed, 5 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/include/cling/Interpreter/LookupHelper.h b/include/cling/Interpreter/LookupHelper.h
|
||||
index 6e6e281470..cd79b2a65c 100644
|
||||
--- a/include/cling/Interpreter/LookupHelper.h
|
||||
+++ b/include/cling/Interpreter/LookupHelper.h
|
||||
@@ -56,7 +56,7 @@ namespace cling {
|
||||
WithDiagnostics
|
||||
};
|
||||
private:
|
||||
- std::unique_ptr<clang::Parser> m_Parser;
|
||||
+ clang::Parser* m_Parser;
|
||||
Interpreter* m_Interpreter; // we do not own.
|
||||
std::array<const clang::Type*, kNumCachedStrings> m_StringTy = {{}};
|
||||
/// A map containing the hash of the lookup buffer. This allows us to avoid
|
||||
diff --git a/lib/Interpreter/Interpreter.cpp b/lib/Interpreter/Interpreter.cpp
|
||||
index 13c8409cc5..f04695439b 100644
|
||||
--- a/lib/Interpreter/Interpreter.cpp
|
||||
+++ b/lib/Interpreter/Interpreter.cpp
|
||||
@@ -265,13 +265,6 @@ namespace cling {
|
||||
}
|
||||
|
||||
Sema& SemaRef = getSema();
|
||||
- Preprocessor& PP = SemaRef.getPreprocessor();
|
||||
-
|
||||
- m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,
|
||||
- /*SkipFunctionBodies*/false,
|
||||
- /*isTemp*/true), this));
|
||||
- if (!m_LookupHelper)
|
||||
- return;
|
||||
|
||||
if (!isInSyntaxOnlyMode() && !m_Opts.CompilerOpts.CUDADevice) {
|
||||
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, *getCI(),
|
||||
@@ -317,6 +310,10 @@ namespace cling {
|
||||
return;
|
||||
}
|
||||
|
||||
+ m_LookupHelper.reset(new LookupHelper(m_IncrParser->getParser(), this));
|
||||
+ if (!m_LookupHelper)
|
||||
+ return;
|
||||
+
|
||||
// When not using C++ modules, we now have a PCH and we can safely setup
|
||||
// our callbacks without fearing that they get overwritten by clang code.
|
||||
// The modules setup is handled above.
|
||||
@@ -5,19 +5,18 @@
|
||||
git,
|
||||
lib,
|
||||
libffi,
|
||||
llvmPackages_18,
|
||||
llvmPackages_20,
|
||||
makeWrapper,
|
||||
ncurses,
|
||||
python3,
|
||||
zlib,
|
||||
|
||||
# *NOT* from LLVM 18!
|
||||
# The compiler used to compile Cling may affect the runtime include and lib
|
||||
# directories it expects to be run with. Cling builds against (a fork of) Clang,
|
||||
# so we prefer to use Clang as the compiler as well for consistency.
|
||||
# It would be cleanest to use LLVM 9's clang, but it errors. So, we use a later
|
||||
# version of Clang to compile, but we check out the Cling fork of Clang 9 to
|
||||
# build Cling against.
|
||||
# The compiler used to *compile* Cling, independent of the LLVM/Clang that
|
||||
# Cling is built against (the root-project/llvm-project fork checked out below)
|
||||
# and of llvmPackages_20 (used only for the runtime wrapper flags). The compiler
|
||||
# can affect the runtime include and lib directories Cling expects, and since
|
||||
# Cling builds against a fork of Clang we use Clang as the compiler too for
|
||||
# consistency.
|
||||
clangStdenv,
|
||||
|
||||
# For runtime C++ standard library
|
||||
@@ -34,13 +33,13 @@
|
||||
let
|
||||
stdenv = clangStdenv;
|
||||
|
||||
version = "1.2";
|
||||
version = "1.3";
|
||||
|
||||
clingSrc = fetchFromGitHub {
|
||||
owner = "root-project";
|
||||
repo = "cling";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-ay9FXANJmB/+AdnCR4WOKHuPm6P88wLqoOgiKJwJ8JM=";
|
||||
sha256 = "sha256-/qCHd9KfPW4dMjktaSdnJG+VDD1lLSI4ZFllTcxWsmc=";
|
||||
};
|
||||
|
||||
unwrapped = stdenv.mkDerivation {
|
||||
@@ -50,18 +49,18 @@ let
|
||||
src = fetchFromGitHub {
|
||||
owner = "root-project";
|
||||
repo = "llvm-project";
|
||||
rev = "cling-llvm18-20250721-01";
|
||||
sha256 = "sha256-JGteapyujU5w81DsfPQfTq76cYHgk5PbAFbdYfYIDo4=";
|
||||
rev = "cling-llvm20-20260119-01";
|
||||
sha256 = "sha256-fv7nrpZ5Dhbf+nW0ED0pkc8NDBXeaBs9MV2TW6o7FGU=";
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
cp -r ${clingSrc} cling-source
|
||||
|
||||
# Patch a bug in version 1.2 by backporting a fix. See
|
||||
# https://github.com/root-project/cling/issues/556
|
||||
# cling 1.3 only builds the clingUserInterface library (which the cling
|
||||
# driver always links) when CLING_INCLUDE_TESTS is on. Always build it.
|
||||
chmod -R u+w cling-source
|
||||
pushd cling-source
|
||||
patch -p1 < ${./fix-new-parser.patch}
|
||||
patch -p1 < ${./always-build-user-interface.patch}
|
||||
popd
|
||||
|
||||
cd llvm
|
||||
@@ -106,8 +105,6 @@ let
|
||||
cp -r ../../cling-source/tools/Jupyter/kernel $out/share/Jupyter
|
||||
'';
|
||||
|
||||
buildTargets = [ "cling" ];
|
||||
|
||||
dontStrip = debug;
|
||||
|
||||
meta = {
|
||||
@@ -139,18 +136,18 @@ let
|
||||
"-nostdinc++"
|
||||
|
||||
"-resource-dir"
|
||||
"${llvmPackages_18.llvm.lib}/lib"
|
||||
"${llvmPackages_20.llvm.lib}/lib"
|
||||
|
||||
"-isystem"
|
||||
"${lib.getLib unwrapped}/lib/clang/18/include"
|
||||
"${lib.getLib unwrapped}/lib/clang/20/include"
|
||||
]
|
||||
++ lib.optionals useLLVMLibcxx [
|
||||
"-I"
|
||||
"${lib.getDev llvmPackages_18.libcxx}/include/c++/v1"
|
||||
"${lib.getDev llvmPackages_20.libcxx}/include/c++/v1"
|
||||
"-L"
|
||||
"${llvmPackages_18.libcxx}/lib"
|
||||
"${llvmPackages_20.libcxx}/lib"
|
||||
"-l"
|
||||
"${llvmPackages_18.libcxx}/lib/libc++${stdenv.hostPlatform.extensions.sharedLibrary}"
|
||||
"${llvmPackages_20.libcxx}/lib/libc++${stdenv.hostPlatform.extensions.sharedLibrary}"
|
||||
]
|
||||
++ lib.optionals (!useLLVMLibcxx) [
|
||||
"-I"
|
||||
|
||||
Reference in New Issue
Block a user