Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't find external visible decls if we're instantiating templates
Signed-off-by: Jun Zhang <[email protected]>
  • Loading branch information
junaire committed Oct 23, 2022
commit 677d6d30c7bfc5dc1d405a82c2857857a1546de6
18 changes: 14 additions & 4 deletions interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ namespace cling {
}
};

static bool IsInstantiatingTemplates(clang::Sema* S) {
if (!S)
return false;

const auto& CodeSynthesisContexts = S->CodeSynthesisContexts;
return !CodeSynthesisContexts.empty() &&
CodeSynthesisContexts.back().isInstantiationRecord();
}

///\brief Translates 'interesting' for the interpreter ExternalSemaSource
/// events into interpreter callbacks.
///
Expand Down Expand Up @@ -274,10 +283,11 @@ namespace cling {

bool FindExternalVisibleDeclsByName(const clang::DeclContext* DC,
clang::DeclarationName Name) override {
if (m_Callbacks)
return m_Callbacks->LookupObject(DC, Name);

return false;
if (!m_Callbacks)
return false;
if (IsInstantiatingTemplates(m_Sema))
return false;
return m_Callbacks->LookupObject(DC, Name);
}

// Silence warning virtual function was hidden.
Expand Down