bool DeclCollector::HandleTopLevelDecl(DeclGroupRef DGR) { // if that decl comes from an AST File, i.e. PCH/PCM, no transaction needed // pipe it directly to codegen. if (comesFromASTReader(DGR)) { if (m_CodeGen) { for (DeclGroupRef::iterator I = DGR.begin(), E = DGR.end(); I != E; ++I) { if (NamespaceDecl* ND = dyn_cast<NamespaceDecl>(*I)) { for (NamespaceDecl::decl_iterator IN = ND->decls_begin(), EN = ND->decls_end(); IN != EN; ++IN) // Recurse over decls inside the namespace, like // CodeGenModule::EmitNamespace() does. HandleTopLevelDecl(DeclGroupRef(*IN)); } else { if (!shouldIgnoreDeclFromASTReader(*I)) { m_CodeGen->HandleTopLevelDecl(DeclGroupRef(*I)); } // FIXME: once modules are there this is not needed anymore. // it is used to simulate modules and the ASTDeserializationListener // for sources that are included to describe the library that was // built from the sources (ACLiC). if (!(*I)->isFromASTFile() && m_Interp->getASTDeserializationListener()) m_Interp->getASTDeserializationListener()->DeclRead(0, *I); } } } return true; } Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleTopLevelDecl); m_CurTransaction->append(DCI); return true; }
void DeclCollector::HandleInterestingDecl(DeclGroupRef DGR) { // if that decl comes from an AST File, i.e. PCH/PCM, no transaction needed // pipe it directly to codegen. if (comesFromASTReader(DGR)) { HandleTopLevelDecl(DGR); return; } Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleInterestingDecl); m_CurTransaction->append(DCI); }
void HandleInterestingDecl(DeclGroupRef D) override { // Ignore interesting decls from the AST reader after IRGen is finished. if (!IRGenFinished) HandleTopLevelDecl(D); }