26 struct ASTConsumerManagerWrapper :
public ASTConsumer {
27 ASTConsumerManagerWrapper(std::shared_ptr<SymbolIndexManager> SIM)
28 : SymbolIndexMgr(std::move(SIM)) {}
29 std::shared_ptr<SymbolIndexManager> SymbolIndexMgr;
39 std::unique_ptr<clang::ASTConsumer>
41 CI.setExternalSemaSource(SemaSource);
42 SemaSource->setFilePath(InFile);
43 SemaSource->setCompilerInstance(&CI);
44 return std::make_unique<ASTConsumerManagerWrapper>(SymbolIndexMgr);
50 const std::vector<std::string> &Args)
override {
51 StringRef DB =
"yaml";
56 for (StringRef Arg : Args) {
57 if (Arg.starts_with(
"-db="))
58 DB = Arg.substr(strlen(
"-db="));
59 else if (Arg.starts_with(
"-input="))
60 Input = Arg.substr(strlen(
"-input="));
63 std::string InputFile =
64 std::string(CI.getFrontendOpts().Inputs[0].getFile());
65 auto CreateYamlIdx = [=]() -> std::unique_ptr<include_fixer::SymbolIndex> {
66 llvm::ErrorOr<std::unique_ptr<include_fixer::YamlSymbolIndex>> SymbolIdx(
74 SmallString<128> AbsolutePath(tooling::getAbsolutePath(InputFile));
75 StringRef
Directory = llvm::sys::path::parent_path(AbsolutePath);
80 return std::move(*SymbolIdx);
83 SymbolIndexMgr->addSymbolIndex(std::move(CreateYamlIdx));
88 std::shared_ptr<SymbolIndexManager> SymbolIndexMgr;
89 IntrusiveRefCntPtr<IncludeFixerSemaSource> SemaSource;
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))