@@ -785,10 +785,7 @@ TCppScope_t GetNamed(const std::string& name,
785785 D = GetUnderlyingScope (D);
786786 Within = llvm::dyn_cast<clang::DeclContext>(D);
787787 }
788- #ifdef CPPINTEROP_USE_CLING
789- if (Within)
790- Within->getPrimaryContext ()->buildLookup ();
791- #endif
788+
792789 compat::SynthesizingCodeRAII RAII (&getInterp ());
793790 auto * ND = CppInternal::utils::Lookup::Named (&getSema (), name, Within);
794791 if (ND && ND != (clang::NamedDecl*)-1 ) {
@@ -918,6 +915,8 @@ int64_t GetBaseClassOffset(TCppScope_t derived, TCppScope_t base) {
918915
919916 assert (derived || base);
920917
918+ compat::SynthesizingCodeRAII RAII (&getInterp ());
919+
921920 auto * DD = (Decl*)derived;
922921 auto * BD = (Decl*)base;
923922 if (!isa<CXXRecordDecl>(DD ) || !isa<CXXRecordDecl>(BD ))
@@ -1045,6 +1044,7 @@ std::vector<TCppFunction_t> GetFunctionsUsingName(TCppScope_t scope,
10451044 clang::LookupResult R (S, DName, SourceLocation (), Sema::LookupOrdinaryName,
10461045 RedeclarationKind::ForVisibleRedeclaration);
10471046
1047+ compat::SynthesizingCodeRAII RAII (&getInterp ());
10481048 CppInternal::utils::Lookup::Named (&S, R, Decl::castToDeclContext (D));
10491049
10501050 if (R.empty ())
@@ -1189,6 +1189,7 @@ bool ExistsFunctionTemplate(const std::string& name, TCppScope_t parent) {
11891189 Within = llvm::dyn_cast<DeclContext>(D);
11901190 }
11911191
1192+ compat::SynthesizingCodeRAII RAII (&getInterp ());
11921193 auto * ND = CppInternal::utils::Lookup::Named (&getSema (), name, Within);
11931194
11941195 if ((intptr_t )ND == (intptr_t )0 )
@@ -1234,6 +1235,8 @@ bool GetClassTemplatedMethods(const std::string& name, TCppScope_t parent,
12341235 clang::LookupResult R (S, DName, SourceLocation (), Sema::LookupOrdinaryName,
12351236 RedeclarationKind::ForVisibleRedeclaration);
12361237 auto * DC = clang::Decl::castToDeclContext (D);
1238+
1239+ compat::SynthesizingCodeRAII RAII (&getInterp ());
12371240 CppInternal::utils::Lookup::Named (&S, R, DC );
12381241
12391242 if (R.getResultKind () == clang_LookupResult_Not_Found && funcs.empty ())
@@ -1547,6 +1550,7 @@ TCppScope_t LookupDatamember(const std::string& name, TCppScope_t parent) {
15471550 Within = llvm::dyn_cast<clang::DeclContext>(D);
15481551 }
15491552
1553+ compat::SynthesizingCodeRAII RAII (&getInterp ());
15501554 auto * ND = CppInternal::utils::Lookup::Named (&getSema (), name, Within);
15511555 if (ND && ND != (clang::NamedDecl*)-1 ) {
15521556 if (llvm::isa_and_nonnull<clang::FieldDecl>(ND )) {
@@ -1593,6 +1597,7 @@ intptr_t GetVariableOffset(compat::Interpreter& I, Decl* D,
15931597 return 0 ;
15941598
15951599 auto & C = I.getSema ().getASTContext ();
1600+ compat::SynthesizingCodeRAII RAII (&getInterp ());
15961601
15971602 if (auto * FD = llvm::dyn_cast<FieldDecl>(D)) {
15981603 clang::RecordDecl* FieldParentRecordDecl = FD ->getParent ();
0 commit comments