From 1e10357aaf3c25745754c56accd6cdc07239e105 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Fri, 4 Nov 2016 10:14:56 +0100 Subject: [PATCH] Unloaded declarations are now put back into CodeGen; no need to mark them used. --- interpreter/cling/lib/Interpreter/CIFactory.cpp | 2 -- interpreter/cling/lib/Interpreter/DeclCollector.cpp | 12 +----------- interpreter/cling/lib/Interpreter/DeclCollector.h | 8 +------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp index f6186dc7c413d..7490b68ffb9c6 100644 --- a/interpreter/cling/lib/Interpreter/CIFactory.cpp +++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp @@ -752,8 +752,6 @@ namespace { std::unique_ptr stateCollector(new cling::DeclCollector()); - // Set up the ASTConsumers - CI->getASTContext().setASTMutationListener(stateCollector.get()); // Add the callback keeping track of the macro definitions PP.addPPCallbacks(stateCollector->MakePPAdapter()); CI->setASTConsumer(std::move(stateCollector)); diff --git a/interpreter/cling/lib/Interpreter/DeclCollector.cpp b/interpreter/cling/lib/Interpreter/DeclCollector.cpp index 69ac526043ea0..93f1a01893404 100644 --- a/interpreter/cling/lib/Interpreter/DeclCollector.cpp +++ b/interpreter/cling/lib/Interpreter/DeclCollector.cpp @@ -73,17 +73,7 @@ namespace cling { // pin the vtable here. DeclCollector::~DeclCollector() { } - void DeclCollector::AddedCXXImplicitMember(const CXXRecordDecl *RD, - const Decl *D) { - assert(D->isImplicit()); - // We need to mark the decls coming from the modules - if (comesFromASTReader(RD) || comesFromASTReader(D)) { - Decl* implicitD = const_cast(D); - implicitD->addAttr(UsedAttr::CreateImplicit(implicitD->getASTContext())); - } - } - - ASTTransformer::Result DeclCollector::TransformDecl(Decl* D) const { + ASTTransformer::Result DeclCollector::TransformDecl(Decl* D) const { // We are sure it's safe to pipe it through the transformers // Consume late transformers init for (size_t i = 0; D && i < m_TransactionTransformers.size(); ++i) { diff --git a/interpreter/cling/lib/Interpreter/DeclCollector.h b/interpreter/cling/lib/Interpreter/DeclCollector.h index ace34757f9947..ac2afff462662 100644 --- a/interpreter/cling/lib/Interpreter/DeclCollector.h +++ b/interpreter/cling/lib/Interpreter/DeclCollector.h @@ -11,7 +11,6 @@ #define CLING_DECL_COLLECTOR_H #include "clang/AST/ASTConsumer.h" -#include "clang/AST/ASTMutationListener.h" #include "clang/Lex/PPCallbacks.h" #include "ASTTransformer.h" @@ -57,8 +56,7 @@ namespace cling { /// cling::DeclCollector is responsible for appending all the declarations /// seen by clang. /// - class DeclCollector: public clang::ASTMutationListener, - public clang::ASTConsumer { + class DeclCollector: public clang::ASTConsumer { private: ///\brief Contains the transaction AST transformers. /// @@ -120,10 +118,6 @@ namespace cling { void MacroDefined(const clang::Token &MacroNameTok, const clang::MacroDirective *MD); /// \} - /// \name ASTMutationListeners overrides - virtual void AddedCXXImplicitMember(const clang::CXXRecordDecl *RD, - const clang::Decl *D); - /// \} /// \{ /// \name ASTConsumer overrides