[PATCH] D108881: [clang][driver] Honor the last -flto= flag even if an earlier -flto is present

Usman Nadeem via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 28 15:38:08 PDT 2021


mnadeem added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4495-4497
+        Arg *A = Args.getLastArg(options::OPT_flto, options::OPT_flto_EQ);
+        if (A && A->getOption().matches(options::OPT_flto))
           CmdArgs.push_back("-flto");
----------------
Another option would be to do the following, but i am not sure if there is any code that explicitly checks for/needs "=full":

```
if (D.getLTOMode() == LTOK_Thin)
    CmdArgs.push_back("-flto=thin");
else
    CmdArgs.push_back("-flto");
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108881



More information about the cfe-commits mailing list