Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 1 | //===- MultiplexConsumer.cpp - AST Consumer for PCH Generation --*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the MultiplexConsumer class. It also declares and defines |
| 11 | // MultiplexASTDeserializationListener and MultiplexASTMutationListener, which |
| 12 | // are implementation details of MultiplexConsumer. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #include "clang/Frontend/MultiplexConsumer.h" |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 17 | #include "clang/AST/ASTMutationListener.h" |
| 18 | #include "clang/AST/DeclGroup.h" |
| 19 | #include "clang/Serialization/ASTDeserializationListener.h" |
| 20 | |
| 21 | using namespace clang; |
| 22 | |
| 23 | namespace clang { |
| 24 | |
| 25 | // This ASTDeserializationListener forwards its notifications to a set of |
| 26 | // child listeners. |
| 27 | class MultiplexASTDeserializationListener |
| 28 | : public ASTDeserializationListener { |
| 29 | public: |
| 30 | // Does NOT take ownership of the elements in L. |
| 31 | MultiplexASTDeserializationListener( |
| 32 | const std::vector<ASTDeserializationListener*>& L); |
Craig Topper | afa7cb3 | 2014-03-13 06:07:04 +0000 | [diff] [blame] | 33 | void ReaderInitialized(ASTReader *Reader) override; |
| 34 | void IdentifierRead(serialization::IdentID ID, |
| 35 | IdentifierInfo *II) override; |
| 36 | void TypeRead(serialization::TypeIdx Idx, QualType T) override; |
| 37 | void DeclRead(serialization::DeclID ID, const Decl *D) override; |
| 38 | void SelectorRead(serialization::SelectorID iD, Selector Sel) override; |
| 39 | void MacroDefinitionRead(serialization::PreprocessedEntityID, |
| 40 | MacroDefinition *MD) override; |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 41 | private: |
| 42 | std::vector<ASTDeserializationListener*> Listeners; |
| 43 | }; |
| 44 | |
| 45 | MultiplexASTDeserializationListener::MultiplexASTDeserializationListener( |
| 46 | const std::vector<ASTDeserializationListener*>& L) |
| 47 | : Listeners(L) { |
| 48 | } |
| 49 | |
| 50 | void MultiplexASTDeserializationListener::ReaderInitialized( |
| 51 | ASTReader *Reader) { |
| 52 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 53 | Listeners[i]->ReaderInitialized(Reader); |
| 54 | } |
| 55 | |
| 56 | void MultiplexASTDeserializationListener::IdentifierRead( |
| 57 | serialization::IdentID ID, IdentifierInfo *II) { |
| 58 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 59 | Listeners[i]->IdentifierRead(ID, II); |
| 60 | } |
| 61 | |
| 62 | void MultiplexASTDeserializationListener::TypeRead( |
| 63 | serialization::TypeIdx Idx, QualType T) { |
| 64 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 65 | Listeners[i]->TypeRead(Idx, T); |
| 66 | } |
| 67 | |
| 68 | void MultiplexASTDeserializationListener::DeclRead( |
| 69 | serialization::DeclID ID, const Decl *D) { |
| 70 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 71 | Listeners[i]->DeclRead(ID, D); |
| 72 | } |
| 73 | |
| 74 | void MultiplexASTDeserializationListener::SelectorRead( |
| 75 | serialization::SelectorID ID, Selector Sel) { |
| 76 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 77 | Listeners[i]->SelectorRead(ID, Sel); |
| 78 | } |
| 79 | |
| 80 | void MultiplexASTDeserializationListener::MacroDefinitionRead( |
Argyrios Kyrtzidis | 03c40c5 | 2011-09-15 18:02:56 +0000 | [diff] [blame] | 81 | serialization::PreprocessedEntityID ID, MacroDefinition *MD) { |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 82 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 83 | Listeners[i]->MacroDefinitionRead(ID, MD); |
| 84 | } |
| 85 | |
| 86 | // This ASTMutationListener forwards its notifications to a set of |
| 87 | // child listeners. |
| 88 | class MultiplexASTMutationListener : public ASTMutationListener { |
| 89 | public: |
| 90 | // Does NOT take ownership of the elements in L. |
Argyrios Kyrtzidis | 9e0cd46 | 2012-02-10 20:10:38 +0000 | [diff] [blame] | 91 | MultiplexASTMutationListener(ArrayRef<ASTMutationListener*> L); |
Craig Topper | afa7cb3 | 2014-03-13 06:07:04 +0000 | [diff] [blame] | 92 | void CompletedTagDefinition(const TagDecl *D) override; |
| 93 | void AddedVisibleDecl(const DeclContext *DC, const Decl *D) override; |
| 94 | void AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) override; |
| 95 | void AddedCXXTemplateSpecialization(const ClassTemplateDecl *TD, |
| 96 | const ClassTemplateSpecializationDecl *D) override; |
| 97 | void AddedCXXTemplateSpecialization(const VarTemplateDecl *TD, |
| 98 | const VarTemplateSpecializationDecl *D) override; |
| 99 | void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD, |
| 100 | const FunctionDecl *D) override; |
| 101 | void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) override; |
Richard Smith | f813400 | 2015-03-10 01:41:22 +0000 | [diff] [blame] | 102 | void ResolvedOperatorDelete(const CXXDestructorDecl *DD, |
| 103 | const FunctionDecl *Delete) override; |
Craig Topper | afa7cb3 | 2014-03-13 06:07:04 +0000 | [diff] [blame] | 104 | void CompletedImplicitDefinition(const FunctionDecl *D) override; |
| 105 | void StaticDataMemberInstantiated(const VarDecl *D) override; |
| 106 | void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD, |
| 107 | const ObjCInterfaceDecl *IFD) override; |
| 108 | void AddedObjCPropertyInClassExtension(const ObjCPropertyDecl *Prop, |
| 109 | const ObjCPropertyDecl *OrigProp, |
| 110 | const ObjCCategoryDecl *ClassExt) override; |
Craig Topper | a798a9d | 2014-03-02 09:32:10 +0000 | [diff] [blame] | 111 | void DeclarationMarkedUsed(const Decl *D) override; |
Alexey Bataev | 9772000 | 2014-11-11 04:05:39 +0000 | [diff] [blame] | 112 | void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override; |
Eli Friedman | 276dd18 | 2013-09-05 00:02:25 +0000 | [diff] [blame] | 113 | |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 114 | private: |
| 115 | std::vector<ASTMutationListener*> Listeners; |
| 116 | }; |
| 117 | |
| 118 | MultiplexASTMutationListener::MultiplexASTMutationListener( |
Argyrios Kyrtzidis | 9e0cd46 | 2012-02-10 20:10:38 +0000 | [diff] [blame] | 119 | ArrayRef<ASTMutationListener*> L) |
| 120 | : Listeners(L.begin(), L.end()) { |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | void MultiplexASTMutationListener::CompletedTagDefinition(const TagDecl *D) { |
| 124 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 125 | Listeners[i]->CompletedTagDefinition(D); |
| 126 | } |
| 127 | |
| 128 | void MultiplexASTMutationListener::AddedVisibleDecl( |
| 129 | const DeclContext *DC, const Decl *D) { |
| 130 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 131 | Listeners[i]->AddedVisibleDecl(DC, D); |
| 132 | } |
| 133 | |
| 134 | void MultiplexASTMutationListener::AddedCXXImplicitMember( |
| 135 | const CXXRecordDecl *RD, const Decl *D) { |
| 136 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 137 | Listeners[i]->AddedCXXImplicitMember(RD, D); |
| 138 | } |
| 139 | void MultiplexASTMutationListener::AddedCXXTemplateSpecialization( |
| 140 | const ClassTemplateDecl *TD, const ClassTemplateSpecializationDecl *D) { |
| 141 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 142 | Listeners[i]->AddedCXXTemplateSpecialization(TD, D); |
| 143 | } |
Sebastian Redl | 9ab988f | 2011-04-14 14:07:59 +0000 | [diff] [blame] | 144 | void MultiplexASTMutationListener::AddedCXXTemplateSpecialization( |
Larisse Voufo | 39a1e50 | 2013-08-06 01:03:05 +0000 | [diff] [blame] | 145 | const VarTemplateDecl *TD, const VarTemplateSpecializationDecl *D) { |
| 146 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 147 | Listeners[i]->AddedCXXTemplateSpecialization(TD, D); |
| 148 | } |
| 149 | void MultiplexASTMutationListener::AddedCXXTemplateSpecialization( |
Sebastian Redl | 9ab988f | 2011-04-14 14:07:59 +0000 | [diff] [blame] | 150 | const FunctionTemplateDecl *TD, const FunctionDecl *D) { |
| 151 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 152 | Listeners[i]->AddedCXXTemplateSpecialization(TD, D); |
| 153 | } |
Richard Smith | 1fa5d64 | 2013-05-11 05:45:24 +0000 | [diff] [blame] | 154 | void MultiplexASTMutationListener::DeducedReturnType(const FunctionDecl *FD, |
| 155 | QualType ReturnType) { |
| 156 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 157 | Listeners[i]->DeducedReturnType(FD, ReturnType); |
| 158 | } |
Richard Smith | f813400 | 2015-03-10 01:41:22 +0000 | [diff] [blame] | 159 | void MultiplexASTMutationListener::ResolvedOperatorDelete( |
| 160 | const CXXDestructorDecl *DD, const FunctionDecl *Delete) { |
| 161 | for (auto *L : Listeners) |
| 162 | L->ResolvedOperatorDelete(DD, Delete); |
| 163 | } |
Sebastian Redl | ab238a7 | 2011-04-24 16:28:06 +0000 | [diff] [blame] | 164 | void MultiplexASTMutationListener::CompletedImplicitDefinition( |
| 165 | const FunctionDecl *D) { |
| 166 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 167 | Listeners[i]->CompletedImplicitDefinition(D); |
| 168 | } |
Sebastian Redl | 2ac2c72 | 2011-04-29 08:19:30 +0000 | [diff] [blame] | 169 | void MultiplexASTMutationListener::StaticDataMemberInstantiated( |
| 170 | const VarDecl *D) { |
| 171 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 172 | Listeners[i]->StaticDataMemberInstantiated(D); |
| 173 | } |
Argyrios Kyrtzidis | 9262278 | 2012-02-10 20:10:36 +0000 | [diff] [blame] | 174 | void MultiplexASTMutationListener::AddedObjCCategoryToInterface( |
| 175 | const ObjCCategoryDecl *CatD, |
| 176 | const ObjCInterfaceDecl *IFD) { |
| 177 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 178 | Listeners[i]->AddedObjCCategoryToInterface(CatD, IFD); |
| 179 | } |
| 180 | void MultiplexASTMutationListener::AddedObjCPropertyInClassExtension( |
| 181 | const ObjCPropertyDecl *Prop, |
| 182 | const ObjCPropertyDecl *OrigProp, |
| 183 | const ObjCCategoryDecl *ClassExt) { |
| 184 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 185 | Listeners[i]->AddedObjCPropertyInClassExtension(Prop, OrigProp, ClassExt); |
| 186 | } |
Eli Friedman | 276dd18 | 2013-09-05 00:02:25 +0000 | [diff] [blame] | 187 | void MultiplexASTMutationListener::DeclarationMarkedUsed(const Decl *D) { |
| 188 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 189 | Listeners[i]->DeclarationMarkedUsed(D); |
| 190 | } |
Alexey Bataev | 9772000 | 2014-11-11 04:05:39 +0000 | [diff] [blame] | 191 | void MultiplexASTMutationListener::DeclarationMarkedOpenMPThreadPrivate( |
| 192 | const Decl *D) { |
| 193 | for (size_t i = 0, e = Listeners.size(); i != e; ++i) |
| 194 | Listeners[i]->DeclarationMarkedOpenMPThreadPrivate(D); |
| 195 | } |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 196 | |
| 197 | } // end namespace clang |
| 198 | |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 199 | MultiplexConsumer::MultiplexConsumer( |
| 200 | std::vector<std::unique_ptr<ASTConsumer>> C) |
| 201 | : Consumers(std::move(C)), MutationListener(), DeserializationListener() { |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 202 | // Collect the mutation listeners and deserialization listeners of all |
| 203 | // children, and create a multiplex listener each if so. |
| 204 | std::vector<ASTMutationListener*> mutationListeners; |
| 205 | std::vector<ASTDeserializationListener*> serializationListeners; |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 206 | for (auto &Consumer : Consumers) { |
| 207 | if (auto *mutationListener = Consumer->GetASTMutationListener()) |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 208 | mutationListeners.push_back(mutationListener); |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 209 | if (auto *serializationListener = Consumer->GetASTDeserializationListener()) |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 210 | serializationListeners.push_back(serializationListener); |
| 211 | } |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 212 | if (!mutationListeners.empty()) { |
| 213 | MutationListener = |
| 214 | llvm::make_unique<MultiplexASTMutationListener>(mutationListeners); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 215 | } |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 216 | if (!serializationListeners.empty()) { |
| 217 | DeserializationListener = |
| 218 | llvm::make_unique<MultiplexASTDeserializationListener>( |
| 219 | serializationListeners); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 220 | } |
| 221 | } |
| 222 | |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 223 | MultiplexConsumer::~MultiplexConsumer() {} |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 224 | |
| 225 | void MultiplexConsumer::Initialize(ASTContext &Context) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 226 | for (auto &Consumer : Consumers) |
| 227 | Consumer->Initialize(Context); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Argyrios Kyrtzidis | 841dd88 | 2011-11-18 00:26:59 +0000 | [diff] [blame] | 230 | bool MultiplexConsumer::HandleTopLevelDecl(DeclGroupRef D) { |
Argyrios Kyrtzidis | b11f5a4 | 2011-11-28 04:56:00 +0000 | [diff] [blame] | 231 | bool Continue = true; |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 232 | for (auto &Consumer : Consumers) |
| 233 | Continue = Continue && Consumer->HandleTopLevelDecl(D); |
Argyrios Kyrtzidis | b11f5a4 | 2011-11-28 04:56:00 +0000 | [diff] [blame] | 234 | return Continue; |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 235 | } |
| 236 | |
Hans Wennborg | a926d84 | 2014-05-23 20:37:38 +0000 | [diff] [blame] | 237 | void MultiplexConsumer::HandleInlineMethodDefinition(CXXMethodDecl *D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 238 | for (auto &Consumer : Consumers) |
| 239 | Consumer->HandleInlineMethodDefinition(D); |
Hans Wennborg | a926d84 | 2014-05-23 20:37:38 +0000 | [diff] [blame] | 240 | } |
| 241 | |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 242 | void MultiplexConsumer::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) { |
| 243 | for (auto &Consumer : Consumers) |
| 244 | Consumer->HandleCXXStaticMemberVarInstantiation(VD); |
Rafael Espindola | 189fa74 | 2012-03-05 10:54:55 +0000 | [diff] [blame] | 245 | } |
| 246 | |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 247 | void MultiplexConsumer::HandleInterestingDecl(DeclGroupRef D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 248 | for (auto &Consumer : Consumers) |
| 249 | Consumer->HandleInterestingDecl(D); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | void MultiplexConsumer::HandleTranslationUnit(ASTContext &Ctx) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 253 | for (auto &Consumer : Consumers) |
| 254 | Consumer->HandleTranslationUnit(Ctx); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | void MultiplexConsumer::HandleTagDeclDefinition(TagDecl *D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 258 | for (auto &Consumer : Consumers) |
| 259 | Consumer->HandleTagDeclDefinition(D); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 260 | } |
| 261 | |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 262 | void MultiplexConsumer::HandleTagDeclRequiredDefinition(const TagDecl *D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 263 | for (auto &Consumer : Consumers) |
| 264 | Consumer->HandleTagDeclRequiredDefinition(D); |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 265 | } |
| 266 | |
Argyrios Kyrtzidis | e5dc5b3 | 2012-02-10 20:10:44 +0000 | [diff] [blame] | 267 | void MultiplexConsumer::HandleCXXImplicitFunctionInstantiation(FunctionDecl *D){ |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 268 | for (auto &Consumer : Consumers) |
| 269 | Consumer->HandleCXXImplicitFunctionInstantiation(D); |
Argyrios Kyrtzidis | e5dc5b3 | 2012-02-10 20:10:44 +0000 | [diff] [blame] | 270 | } |
| 271 | |
Argyrios Kyrtzidis | b11f5a4 | 2011-11-28 04:56:00 +0000 | [diff] [blame] | 272 | void MultiplexConsumer::HandleTopLevelDeclInObjCContainer(DeclGroupRef D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 273 | for (auto &Consumer : Consumers) |
| 274 | Consumer->HandleTopLevelDeclInObjCContainer(D); |
Argyrios Kyrtzidis | b11f5a4 | 2011-11-28 04:56:00 +0000 | [diff] [blame] | 275 | } |
| 276 | |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 277 | void MultiplexConsumer::HandleImplicitImportDecl(ImportDecl *D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 278 | for (auto &Consumer : Consumers) |
| 279 | Consumer->HandleImplicitImportDecl(D); |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | void MultiplexConsumer::HandleLinkerOptionPragma(llvm::StringRef Opts) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 283 | for (auto &Consumer : Consumers) |
| 284 | Consumer->HandleLinkerOptionPragma(Opts); |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | void MultiplexConsumer::HandleDetectMismatch(llvm::StringRef Name, llvm::StringRef Value) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 288 | for (auto &Consumer : Consumers) |
| 289 | Consumer->HandleDetectMismatch(Name, Value); |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | void MultiplexConsumer::HandleDependentLibrary(llvm::StringRef Lib) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 293 | for (auto &Consumer : Consumers) |
| 294 | Consumer->HandleDependentLibrary(Lib); |
David Blaikie | 1326975 | 2014-07-16 23:52:46 +0000 | [diff] [blame] | 295 | } |
| 296 | |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 297 | void MultiplexConsumer::CompleteTentativeDefinition(VarDecl *D) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 298 | for (auto &Consumer : Consumers) |
| 299 | Consumer->CompleteTentativeDefinition(D); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 300 | } |
| 301 | |
Nico Weber | b6a5d05 | 2015-01-15 04:07:35 +0000 | [diff] [blame] | 302 | void MultiplexConsumer::HandleVTable(CXXRecordDecl *RD) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 303 | for (auto &Consumer : Consumers) |
Nico Weber | b6a5d05 | 2015-01-15 04:07:35 +0000 | [diff] [blame] | 304 | Consumer->HandleVTable(RD); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | ASTMutationListener *MultiplexConsumer::GetASTMutationListener() { |
| 308 | return MutationListener.get(); |
| 309 | } |
| 310 | |
| 311 | ASTDeserializationListener *MultiplexConsumer::GetASTDeserializationListener() { |
| 312 | return DeserializationListener.get(); |
| 313 | } |
| 314 | |
| 315 | void MultiplexConsumer::PrintStats() { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 316 | for (auto &Consumer : Consumers) |
| 317 | Consumer->PrintStats(); |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | void MultiplexConsumer::InitializeSema(Sema &S) { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 321 | for (auto &Consumer : Consumers) |
| 322 | if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get())) |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 323 | SC->InitializeSema(S); |
| 324 | } |
| 325 | |
| 326 | void MultiplexConsumer::ForgetSema() { |
David Blaikie | 6beb6aa | 2014-08-10 19:56:51 +0000 | [diff] [blame] | 327 | for (auto &Consumer : Consumers) |
| 328 | if (SemaConsumer *SC = dyn_cast<SemaConsumer>(Consumer.get())) |
Nico Weber | 2992efa | 2011-01-25 20:34:14 +0000 | [diff] [blame] | 329 | SC->ForgetSema(); |
| 330 | } |