[PATCH] D35338: Add the -fdestroy-globals flag

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 19:19:56 PDT 2017


vsk added a comment.

This is interesting. Do you have any results/metrics to share (e.g some any binary size reduction for projects you've looked at)?



================
Comment at: lib/Frontend/CompilerInvocation.cpp:585
   Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
+  Opts.DestroyGlobals = !Args.hasArg(OPT_fno_destroy_globals);
   Opts.CodeModel = getCodeModel(Args, Diags);
----------------
I think this will do the wrong thing when passed: -cc1 -fno-destroy-globals -fdestroy-globals. Using hasFlag here should fix the issue. I'm just noting this as a FYI, there's no need to update the diff right away, since I'd first like to find out if there are any correctness concerns / what the use cases for this functionality are.


https://reviews.llvm.org/D35338





More information about the cfe-commits mailing list