[FIX][clang] Fix unused private field in ExtractAPIVisitor

Fix a build failure where an unused private field in ExtractAPIVisitor
triggered a warning turned into error.
This commit is contained in:
Zixu Wang 2022-01-26 16:22:08 -08:00
parent aae3c4f2b4
commit 98fa46f870
1 changed files with 1 additions and 8 deletions

View File

@ -9,21 +9,14 @@ using namespace clang;
namespace {
class ExtractAPIVisitor : public RecursiveASTVisitor<ExtractAPIVisitor> {
public:
explicit ExtractAPIVisitor(ASTContext *Context) : Context(Context) {}
bool VisitNamedDecl(NamedDecl *Decl) {
llvm::outs() << Decl->getName() << "\n";
return true;
}
private:
ASTContext *Context;
};
class ExtractAPIConsumer : public ASTConsumer {
public:
explicit ExtractAPIConsumer(ASTContext *Context) : Visitor(Context) {}
void HandleTranslationUnit(ASTContext &Context) override {
Visitor.TraverseDecl(Context.getTranslationUnitDecl());
}
@ -35,5 +28,5 @@ private:
std::unique_ptr<ASTConsumer>
ExtractAPIAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
return std::make_unique<ExtractAPIConsumer>(&CI.getASTContext());
return std::make_unique<ExtractAPIConsumer>();
}