gribozavr created this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
It is not clear to me that these callbacks ever did anything, they were empty even in the original implementation (r324808). Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D66136 Files: clang/include/clang/Sema/TemplateInstCallback.h clang/lib/Frontend/FrontendActions.cpp clang/lib/Parse/ParseAST.cpp Index: clang/lib/Parse/ParseAST.cpp =================================================================== --- clang/lib/Parse/ParseAST.cpp +++ 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<Parser> 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"; Index: clang/lib/Frontend/FrontendActions.cpp =================================================================== --- clang/lib/Frontend/FrontendActions.cpp +++ 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<true>(llvm::outs(), TheSema, Inst); Index: clang/include/clang/Sema/TemplateInstCallback.h =================================================================== --- clang/include/clang/Sema/TemplateInstCallback.h +++ 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 <class TemplateInstantiationCallbackPtrs> -void initialize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->initialize(TheSema); - } -} - -template <class TemplateInstantiationCallbackPtrs> -void finalize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->finalize(TheSema); - } -} - template <class TemplateInstantiationCallbackPtrs> void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema,
Index: clang/lib/Parse/ParseAST.cpp =================================================================== --- clang/lib/Parse/ParseAST.cpp +++ 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<Parser> 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"; Index: clang/lib/Frontend/FrontendActions.cpp =================================================================== --- clang/lib/Frontend/FrontendActions.cpp +++ 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<true>(llvm::outs(), TheSema, Inst); Index: clang/include/clang/Sema/TemplateInstCallback.h =================================================================== --- clang/include/clang/Sema/TemplateInstCallback.h +++ 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 <class TemplateInstantiationCallbackPtrs> -void initialize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->initialize(TheSema); - } -} - -template <class TemplateInstantiationCallbackPtrs> -void finalize(TemplateInstantiationCallbackPtrs &Callbacks, - const Sema &TheSema) { - for (auto &C : Callbacks) { - if (C) - C->finalize(TheSema); - } -} - template <class TemplateInstantiationCallbackPtrs> void atTemplateBegin(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits