[PATCH] D75056: [Driver] Default to -fno-common

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 09:35:15 PST 2020


MaskRay added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5651
+  // -fno-common is the default, set -fcommon only when that flag is set.
+  if (Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common, false))
+    CmdArgs.push_back("-fcommon");
----------------
cc1 does not check -fcommon: `Opts.NoCommon = Args.hasArg(OPT_fno_common);`

I think you can flip it to `Opts.NoCommon = !Args.hasArg(OPT_fcommon);`

and change here to pass `-fcommon` if `Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common, false)`


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

https://reviews.llvm.org/D75056





More information about the cfe-commits mailing list