[libcxx-commits] [clang] [clang-tools-extra] [libcxx] [clang] Enable sized deallocation by default in C++14 onwards (PR #83774)
Pengcheng Wang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 9 02:34:57 PDT 2024
================
@@ -7238,10 +7238,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.addOptInFlag(CmdArgs, options::OPT_frelaxed_template_template_args,
options::OPT_fno_relaxed_template_template_args);
- // -fsized-deallocation is off by default, as it is an ABI-breaking change for
- // most platforms.
- Args.addOptInFlag(CmdArgs, options::OPT_fsized_deallocation,
- options::OPT_fno_sized_deallocation);
+ // -fsized-deallocation is on by default in C++14 onwards and otherwise off
+ // by default.
+ if (Arg *A = Args.getLastArg(options::OPT_fsized_deallocation,
+ options::OPT_fno_sized_deallocation)) {
+ if (A->getOption().matches(options::OPT_fno_sized_deallocation))
+ CmdArgs.push_back("-fno-sized-deallocation");
----------------
wangpc-pp wrote:
I don't know if I understand correctly, but I think we need both clang and cc1 options for `sized_deallocation`. Please see `aligned_allocation` case, which is the same as `sized_deallocation`:
https://github.com/llvm/llvm-project/blob/24e8c6a09b7d226dbe706aeae7aebf479a1e5087/clang/include/clang/Driver/Options.td#L3355-L3358
And there are a lot of tests assumed we have cc1 options `-fno-sized-deallocation` and `-fsized-deallocation` like [`clang/test/SemaCXX/builtin-operator-new-delete.cpp`](https://github.com/llvm/llvm-project/blob/main/clang/test/SemaCXX/builtin-operator-new-delete.cpp).
https://github.com/llvm/llvm-project/pull/83774
More information about the libcxx-commits
mailing list