Skip to content

Commit 60a6cbb

Browse files
committed
[cling] Use single Parser for LookupHelper
It is the only construction of a temporary parser, and it seems not necessary (anymore).
1 parent 139d3f4 commit 60a6cbb

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Diff for: interpreter/cling/include/cling/Interpreter/LookupHelper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace cling {
5656
WithDiagnostics
5757
};
5858
private:
59-
std::unique_ptr<clang::Parser> m_Parser;
59+
clang::Parser* m_Parser;
6060
Interpreter* m_Interpreter; // we do not own.
6161
std::array<const clang::Type*, kNumCachedStrings> m_StringTy = {{}};
6262
/// A map containing the hash of the lookup buffer. This allows us to avoid

Diff for: interpreter/cling/lib/Interpreter/Interpreter.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,6 @@ namespace cling {
265265
}
266266

267267
Sema& SemaRef = getSema();
268-
Preprocessor& PP = SemaRef.getPreprocessor();
269-
270-
m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,
271-
/*SkipFunctionBodies*/false,
272-
/*isTemp*/true), this));
273-
if (!m_LookupHelper)
274-
return;
275268

276269
if (!isInSyntaxOnlyMode() && !m_Opts.CompilerOpts.CUDADevice) {
277270
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, *getCI(),
@@ -317,6 +310,10 @@ namespace cling {
317310
return;
318311
}
319312

313+
m_LookupHelper.reset(new LookupHelper(m_IncrParser->getParser(), this));
314+
if (!m_LookupHelper)
315+
return;
316+
320317
// When not using C++ modules, we now have a PCH and we can safely setup
321318
// our callbacks without fearing that they get overwritten by clang code.
322319
// The modules setup is handled above.

0 commit comments

Comments
 (0)