diff --git a/clang/include/clang/Sema/TemplateInstCallback.h b/clang/include/clang/Sema/TemplateInstCallback.h --- a/clang/include/clang/Sema/TemplateInstCallback.h +++ b/clang/include/clang/Sema/TemplateInstCallback.h @@ -24,12 +24,6 @@ public: virtual ~TemplateInstantiationCallback() = default; - /// Called before doing AST-parsing. - virtual void initialize(const Sema &TheSema) = 0; - - /// Called after AST-parsing is completed. - virtual void finalize(const Sema &TheSema) = 0; - /// Called when instantiation of a template just began. virtual void atTemplateBegin(const Sema &TheSema, const Sema::CodeSynthesisContext &Inst) = 0; @@ -39,24 +33,6 @@ const Sema::CodeSynthesisContext &Inst) = 0; }; -template -void initialize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->initialize(TheSema); - } -} - -template -void finalize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->finalize(TheSema); - } -} - template void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema, diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -376,10 +376,6 @@ using CodeSynthesisContext = Sema::CodeSynthesisContext; public: - void initialize(const Sema &) override {} - - void finalize(const Sema &) override {} - void atTemplateBegin(const Sema &TheSema, const CodeSynthesisContext &Inst) override { displayTemplightEntry(llvm::outs(), TheSema, Inst); diff --git a/clang/lib/Parse/ParseAST.cpp b/clang/lib/Parse/ParseAST.cpp --- a/clang/lib/Parse/ParseAST.cpp +++ b/clang/lib/Parse/ParseAST.cpp @@ -122,10 +122,6 @@ bool OldCollectStats = PrintStats; std::swap(OldCollectStats, S.CollectStats); - // Initialize the template instantiation observer chain. - // FIXME: See note on "finalize" below. - initialize(S.TemplateInstCallbacks, S); - ASTConsumer *Consumer = &S.getASTConsumer(); std::unique_ptr ParseOP( @@ -169,14 +165,6 @@ Consumer->HandleTopLevelDecl(DeclGroupRef(D)); Consumer->HandleTranslationUnit(S.getASTContext()); - - // Finalize the template instantiation observer chain. - // FIXME: This (and init.) should be done in the Sema class, but because - // Sema does not have a reliable "Finalize" function (it has a - // destructor, but it is not guaranteed to be called ("-disable-free")). - // So, do the initialization above and do the finalization here: - finalize(S.TemplateInstCallbacks, S); - std::swap(OldCollectStats, S.CollectStats); if (PrintStats) { llvm::errs() << "\nSTATISTICS:\n";