From 517ba1c5464c05cc7f4e72835500a96cddd9394a Mon Sep 17 00:00:00 2001 From: Devajith Valaparambil Sreeramaswamy Date: Tue, 23 Apr 2024 17:52:47 +0200 Subject: [PATCH] Move processing of `TopLevelDecls` to the function --- lib/Interpreter/IncrementalParser.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index 541c42f1..3a13cf97 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -937,14 +937,6 @@ namespace cling { "Lexer must be EOF when starting incremental parse!"); #endif - // Process any TopLevelDecls generated by #pragma weak. - for (llvm::SmallVector::iterator - I = S.WeakTopLevelDecls().begin(), - E = S.WeakTopLevelDecls().end(); - I != E; ++I) { - m_Consumer->HandleTopLevelDecl(DeclGroupRef(*I)); - } - DiagnosticsEngine& Diags = getCI()->getDiagnostics(); if (m_Consumer->getTransaction()->getIssuedDiags() == Transaction::kErrors) return kFailed; @@ -997,6 +989,13 @@ namespace cling { return true; } + + // Process any TopLevelDecls generated by #pragma weak. + for (Decl* D : S.WeakTopLevelDecls()) { + DeclGroupRef DGR(D); + m_Consumer->HandleTopLevelDecl(DGR); + } + LocalInstantiations.perform(); GlobalInstantiations.perform();