public:
virtual ~IndexProvider();
virtual void GetTranslationUnitsFor(Entity Ent,
- TranslationUnitHandler *Handler) = 0;
+ TranslationUnitHandler &Handler) = 0;
};
} // namespace idx
void IndexAST(TranslationUnit *TU);
virtual void GetTranslationUnitsFor(Entity Ent,
- TranslationUnitHandler *Handler);
+ TranslationUnitHandler &Handler);
typedef TUSetTy::iterator translation_unit_iterator;
~Program();
/// \brief Traverses the AST and passes all the entities to the Handler.
- void FindEntities(ASTContext &Ctx, EntityHandler *Handler);
+ void FindEntities(ASTContext &Ctx, EntityHandler &Handler);
};
} // namespace idx
void Indexer::IndexAST(TranslationUnit *TU) {
EntityIndexer Idx(TU, Map);
- Prog.FindEntities(TU->getASTContext(), &Idx);
+ Prog.FindEntities(TU->getASTContext(), Idx);
}
void Indexer::GetTranslationUnitsFor(Entity Ent,
- TranslationUnitHandler *Handler) {
+ TranslationUnitHandler &Handler) {
assert(Ent.isValid() && "Expected valid Entity");
assert(!Ent.isInternalToTU() &&
"Expected an Entity visible outside of its translation unit");
TUSetTy &Set = I->second;
for (TUSetTy::iterator I = Set.begin(), E = Set.end(); I != E; ++I)
- Handler->Handle(*I);
+ Handler.Handle(*I);
}
static Indexer::TUSetTy EmptySet;
delete static_cast<ProgramImpl *>(Impl);
}
-static void FindEntitiesInDC(DeclContext *DC, Program &Prog, EntityHandler *Handler) {
+static void FindEntitiesInDC(DeclContext *DC, Program &Prog,
+ EntityHandler &Handler) {
for (DeclContext::decl_iterator
I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) {
if (I->getLocation().isInvalid())
continue;
Entity Ent = Entity::get(*I, Prog);
if (Ent.isValid())
- Handler->Handle(Ent);
+ Handler.Handle(Ent);
if (DeclContext *SubDC = dyn_cast<DeclContext>(*I))
FindEntitiesInDC(SubDC, Prog, Handler);
}
}
/// \brief Traverses the AST and passes all the entities to the Handler.
-void Program::FindEntities(ASTContext &Ctx, EntityHandler *Handler) {
+void Program::FindEntities(ASTContext &Ctx, EntityHandler &Handler) {
FindEntitiesInDC(Ctx.getTranslationUnitDecl(), *this, Handler);
}