================ @@ -429,13 +429,101 @@ void AIX::AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm_unreachable("Unexpected C++ library type; only libc++ is supported."); } +// This function processes all the mtocdata options to build the final +// simplified toc data options to pass to CC1. +static void addTocDataOptions(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CC1Args, + const Driver &D) { + + // Check the global toc-data setting. The default is -mno-tocdata. + // To enable toc-data globally, -mtocdata must be specified. + // Additionally, it must be last to take effect. + const bool TOCDataGloballyinEffect = [&Args]() { + if (!Args.hasArg(options::OPT_mtocdata)) + return false; + + const Arg *LastArg = + Args.getLastArg(options::OPT_mtocdata, options::OPT_mno_tocdata); + return LastArg->getOption().matches(options::OPT_mtocdata); + }(); ---------------- diggerlin wrote:
since ``` bool hasArg(OptSpecifiers ...Ids) const { return getLastArg(Ids...) != nullptr; } | ``` we can change ``` if (!Args.hasArg(options::OPT_mtocdata)) return false; const Arg *LastArg = Args.getLastArg(options::OPT_mtocdata, options::OPT_mno_tocdata); return LastArg->getOption().matches(options::OPT_mtocdata); ``` to ``` if(const Arg *LastArg = Args.getLastArg(options::OPT_mtocdata, options::OPT_mno_tocdata)) return LastArg->getOption().matches(options::OPT_mtocdata); else return false; ``` https://github.com/llvm/llvm-project/pull/67999 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits