diff --git a/tools/ClangPlugin.h b/tools/ClangPlugin.h index 3ec1f9be6..3ba226f31 100644 --- a/tools/ClangPlugin.h +++ b/tools/ClangPlugin.h @@ -170,11 +170,12 @@ class CladTimerGroup { bool HandleTopLevelDecl(clang::DeclGroupRef D) override { if (D.isSingleDecl()) if (auto* FD = llvm::dyn_cast(D.getSingleDecl())) - if (m_DFC.IsDerivative(FD)) { - assert(!m_Multiplexer && - "Must happen only if we failed to rearrange the consumers"); + // If we build the derivative in a non-standard (with no Multiplexer) + // setup, we exit early to give control to the non-standard setup for + // code generation. + // FIXME: This should go away if Cling starts using the clang driver. + if (!m_Multiplexer && m_DFC.IsDerivative(FD)) return true; - } HandleTopLevelDeclForClad(D); AppendDelayed({CallKind::HandleTopLevelDecl, D});