stevewan marked an inline comment as done.
stevewan added inline comments.

================
Comment at: clang/lib/Driver/ToolChains/AIX.cpp:28
+                                  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
----------------
stevewan wrote:
> Xiangling_L wrote:
> > The definition of `claimNoWarnArgs` is to suppress warnings for some 
> > options if they are unused, can you explain a little bit about how did you 
> > figure out that we don't want warnings for those?
> > 
> > Some context of `claimNoWarnArgs`:
> > 
> > ```
> > // Claim options we don't want to warn if they are unused. We do this for
> > // options that build systems might add but are unused when assembling or 
> > only
> > // running the preprocessor for example.
> > void tools::claimNoWarnArgs(const ArgList &Args) {
> >   // Don't warn about unused -f(no-)?lto.  This can happen when we're
> >   // preprocessing, precompiling or assembling.
> >   Args.ClaimAllArgs(options::OPT_flto_EQ);
> >   Args.ClaimAllArgs(options::OPT_flto);
> >   Args.ClaimAllArgs(options::OPT_fno_lto);
> > }
> > ```
> > 
> The original reason was that, since we are doing assembling here, and as 
> stated in `claimNoWarnArgs`, there might be an unused `-f(no-)?lto` when 
> we're assembling, and we'd like to suppress the warning(s) for that. 
> 
> Looking into it, the three options [[ 
> https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
>  | `flto`, `fno_lto` ]] , and [[ 
> https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-flto
>  | `flto_EQ` ]] are used to enable/disable link time optimization, but LTO is 
> not supported by the AIX system linker. Driver would just throw error if the 
> user passes it `-flto` or `-flto=<arg>` on AIX, so claiming them or not 
> currently makes no actual difference as far as I'm concerned. 
> 
> That being said, I don't have a strong opinion either way. Let's see how 
> other people think.
It's probably also worth mentioning that, adding `claimNoWarnArgs` does not 
affect those LTO options being parsed and consumed by the driver in 
`Driver::setLTOMode`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69620/new/

https://reviews.llvm.org/D69620



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to