[clang][Index][NFC] Move IndexDataConsumer default implementation

llvm-svn: 370116
This commit is contained in:
Jan Korous 2019-08-27 21:49:39 +00:00
parent 4368971b05
commit cfd641d84a
2 changed files with 11 additions and 26 deletions

View File

@ -32,7 +32,7 @@ public:
const DeclContext *ContainerDC;
};
virtual ~IndexDataConsumer() {}
virtual ~IndexDataConsumer() = default;
virtual void initialize(ASTContext &Ctx) {}
@ -41,12 +41,16 @@ public:
/// \returns true to continue indexing, or false to abort.
virtual bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles,
ArrayRef<SymbolRelation> Relations,
SourceLocation Loc, ASTNodeInfo ASTNode);
SourceLocation Loc, ASTNodeInfo ASTNode) {
return true;
}
/// \returns true to continue indexing, or false to abort.
virtual bool handleMacroOccurence(const IdentifierInfo *Name,
const MacroInfo *MI, SymbolRoleSet Roles,
SourceLocation Loc);
SourceLocation Loc) {
return true;
}
/// \returns true to continue indexing, or false to abort.
///
@ -54,8 +58,10 @@ public:
/// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the
/// 'reference' role, and a call for 'SubMod' with the 'declaration' role.
virtual bool handleModuleOccurence(const ImportDecl *ImportD,
const Module *Mod,
SymbolRoleSet Roles, SourceLocation Loc);
const Module *Mod, SymbolRoleSet Roles,
SourceLocation Loc) {
return true;
}
virtual void finish() {}
};

View File

@ -21,27 +21,6 @@
using namespace clang;
using namespace clang::index;
bool IndexDataConsumer::handleDeclOccurence(const Decl *D, SymbolRoleSet Roles,
ArrayRef<SymbolRelation> Relations,
SourceLocation Loc,
ASTNodeInfo ASTNode) {
return true;
}
bool IndexDataConsumer::handleMacroOccurence(const IdentifierInfo *Name,
const MacroInfo *MI,
SymbolRoleSet Roles,
SourceLocation Loc) {
return true;
}
bool IndexDataConsumer::handleModuleOccurence(const ImportDecl *ImportD,
const Module *Mod,
SymbolRoleSet Roles,
SourceLocation Loc) {
return true;
}
namespace {
class IndexASTConsumer : public ASTConsumer {