[PATCH] D127641: [clang-cl][MSVC] Enable /Zc:alignedNew for C++17 and /Zc:sizedDealloc by default

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 12:49:35 PDT 2022


rnk added a subscriber: luken-google.
rnk added a comment.

+ at luken-google



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6497
+                         options::OPT_fno_aligned_allocation) &&
+        LanguageStandard == "-std=c++17")
+      CmdArgs.push_back("-faligned-allocation");
----------------
Only for C++17, and not C++17 and above?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6641
   // by default.
   if (Arg *A = Args.getLastArg(options::OPT_faligned_allocation,
                                options::OPT_fno_aligned_allocation,
----------------
steplong wrote:
> There's a check here for faligned-allocation, but I wasn't sure how to get the c++ standard here. Also, I couldn't figure a clean way to compare if the standard was c++17 onwards, so I just enabled -faligned-allocation for C++17 above
What I would do is to compute a boolean above and use it as the default value here. The -cc1 line should be canonical, it shouldn't have duplicate, potentially contradictory flags.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127641



More information about the cfe-commits mailing list