nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 54 lines 2.2 kB view raw
1From cd4d1d8c4963620a6a84834948845df81fbbd70b Mon Sep 17 00:00:00 2001 2From: Jonas Hahnfeld <jonas.hahnfeld@cern.ch> 3Date: Tue, 17 Dec 2024 14:54:18 +0100 4Subject: [PATCH] Use single Parser for LookupHelper 5 6It is the only construction of a temporary parser, and it seems not 7necessary (anymore). 8--- 9 include/cling/Interpreter/LookupHelper.h | 2 +- 10 lib/Interpreter/Interpreter.cpp | 11 ++++------- 11 2 files changed, 5 insertions(+), 8 deletions(-) 12 13diff --git a/include/cling/Interpreter/LookupHelper.h b/include/cling/Interpreter/LookupHelper.h 14index 6e6e281470..cd79b2a65c 100644 15--- a/include/cling/Interpreter/LookupHelper.h 16+++ b/include/cling/Interpreter/LookupHelper.h 17@@ -56,7 +56,7 @@ namespace cling { 18 WithDiagnostics 19 }; 20 private: 21- std::unique_ptr<clang::Parser> m_Parser; 22+ clang::Parser* m_Parser; 23 Interpreter* m_Interpreter; // we do not own. 24 std::array<const clang::Type*, kNumCachedStrings> m_StringTy = {{}}; 25 /// A map containing the hash of the lookup buffer. This allows us to avoid 26diff --git a/lib/Interpreter/Interpreter.cpp b/lib/Interpreter/Interpreter.cpp 27index 13c8409cc5..f04695439b 100644 28--- a/lib/Interpreter/Interpreter.cpp 29+++ b/lib/Interpreter/Interpreter.cpp 30@@ -265,13 +265,6 @@ namespace cling { 31 } 32 33 Sema& SemaRef = getSema(); 34- Preprocessor& PP = SemaRef.getPreprocessor(); 35- 36- m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef, 37- /*SkipFunctionBodies*/false, 38- /*isTemp*/true), this)); 39- if (!m_LookupHelper) 40- return; 41 42 if (!isInSyntaxOnlyMode() && !m_Opts.CompilerOpts.CUDADevice) { 43 m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, *getCI(), 44@@ -317,6 +310,10 @@ namespace cling { 45 return; 46 } 47 48+ m_LookupHelper.reset(new LookupHelper(m_IncrParser->getParser(), this)); 49+ if (!m_LookupHelper) 50+ return; 51+ 52 // When not using C++ modules, we now have a PCH and we can safely setup 53 // our callbacks without fearing that they get overwritten by clang code. 54 // The modules setup is handled above.