Lines Matching refs:Ctx

159 static bool handleCompareAction(const Context &Ctx) {
160 if (Ctx.Inputs.size() != 2)
167 auto LeftIF = getInterfaceFile(Ctx.Inputs.front());
168 auto RightIF = getInterfaceFile(Ctx.Inputs.at(1));
183 if (!Ctx.CmpOpt.ArchsToIgnore.empty()) {
186 for (const auto Arch : Ctx.CmpOpt.ArchsToIgnore) {
192 raw_ostream &OS = Ctx.OutStream ? *Ctx.OutStream : outs();
196 static bool handleWriteAction(const Context &Ctx,
199 if (Ctx.Inputs.size() != 1)
201 Out = getInterfaceFile(Ctx.Inputs.front());
203 raw_ostream &OS = Ctx.OutStream ? *Ctx.OutStream : outs();
204 ExitOnErr(TextAPIWriter::writeToStream(OS, *Out, Ctx.WriteFT, Ctx.Compact));
208 static bool handleMergeAction(const Context &Ctx) {
209 if (Ctx.Inputs.size() < 2)
213 for (StringRef FileName : Ctx.Inputs) {
222 return handleWriteAction(Ctx, std::move(Out));
225 static void stubifyImpl(std::unique_ptr<InterfaceFile> IF, Context &Ctx) {
227 if (Ctx.OutStream == nullptr) {
232 Ctx.OutStream = std::make_unique<llvm::raw_fd_stream>(OutputLoc, EC);
237 handleWriteAction(Ctx, std::move(IF));
240 Ctx.OutStream = nullptr;
243 static void stubifyDirectory(const StringRef InputPath, Context &Ctx) {
292 if (Ctx.StubOpt.DeletePrivate &&
347 if (Ctx.StubOpt.DeletePrivate &&
354 if (Ctx.StubOpt.TraceLibs)
378 stubifyImpl(std::move(Dylib), Ctx);
385 if (Ctx.StubOpt.DeleteInput)
406 if (Ctx.StubOpt.DeleteInput)
436 static bool handleStubifyAction(Context &Ctx) {
437 if (Ctx.Inputs.empty())
440 if ((Ctx.Inputs.size() > 1) && (Ctx.OutStream != nullptr))
443 for (StringRef PathName : Ctx.Inputs) {
449 if (Ctx.OutStream != nullptr)
452 stubifyDirectory(PathName, Ctx);
456 stubifyImpl(getInterfaceFile(PathName), Ctx);
457 if (Ctx.StubOpt.DeleteInput)
467 static bool handleSingleFileAction(const Context &Ctx, const StringRef Action,
469 if (Ctx.Inputs.size() != 1)
471 if (Ctx.Arch == AK_unknown)
474 auto IF = getInterfaceFile(Ctx.Inputs.front(), /*ResetBanner=*/false);
475 auto OutIF = act(*IF, Ctx.Arch);
479 return handleWriteAction(Ctx, std::move(*OutIF));
493 Context Ctx;
512 Ctx.Inputs.push_back(A->getValue());
517 Ctx.OutStream = std::make_unique<llvm::raw_fd_stream>(OutputLoc, EC);
523 Ctx.Compact = Args.hasArg(OPT_compact);
527 Ctx.WriteFT = TextAPIWriter::parseFileType(FT);
528 if (Ctx.WriteFT < FileType::TBD_V3)
530 if (Ctx.WriteFT == FileType::Invalid)
543 Ctx.Arch = SanitizeArch(A);
546 Ctx.CmpOpt.ArchsToIgnore.set(SanitizeArch(A));
553 return handleWriteAction(Ctx);
566 return handleCompareAction(Ctx);
568 return handleMergeAction(Ctx);
570 return handleSingleFileAction(Ctx, "extract", &InterfaceFile::extract);
572 return handleSingleFileAction(Ctx, "remove", &InterfaceFile::remove);
574 setStubOptions(Args, Ctx.StubOpt);
575 return handleStubifyAction(Ctx);