[llvm] [clang] [AIX][TOC] Add -mtocdata/-mno-tocdata options on AIX (PR #67999)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 5 11:57:50 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list