[PATCH] D125272: [clang] Add -fcheck-new support

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 24 18:08:26 PDT 2022


MaskRay requested changes to this revision.
MaskRay added inline comments.
This revision now requires changes to proceed.
Herald added a subscriber: StephenFan.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4117
+  if (const Arg *A = Args.getLastArg(OPT_fcheck_new))
+    Opts.CheckNew = true;
+
----------------
Use `CodeGenOpts<"CheckNew">` and avoid change to this file. CodeGenOpts seems more suitable than LangOpts.


================
Comment at: clang/test/CodeGenCXX/fcheck-new.cpp:3
+// RUN: %clang_cc1 -fcheck-new -triple x86_64-linux-gnu -S -disable-O0-optnone \
+// RUN: -emit-llvm -o - %s | opt -S -mem2reg | FileCheck %s
+
----------------
Please remove `opt`. Optimizations should be tested in the llvm/ layer, not in clang codegen.

If utils/update_cc_test_checks.py does not generate good looking IR, write it by hand.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125272



More information about the cfe-commits mailing list