[PATCH] D149206: [clang][driver] Enable MisExpect diagnostics flag outside of CC!
Paul Kirth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 25 14:34:46 PDT 2023
paulkirth created this revision.
paulkirth added reviewers: hans, tejohnson, phosek.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.
Previously we only accepted the `-fdiagnostics-misexpect-tolerance=` at
CC1, when it should have been handled identically to
`-fdiagnostics-hotness-threshold=`. It should not have been required to
pass this flag w/ `-Xclang` as reported here:
https://reviews.llvm.org/D115907#inline-1440745
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149206
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Profile/misexpect-branch.c
Index: clang/test/Profile/misexpect-branch.c
===================================================================
--- clang/test/Profile/misexpect-branch.c
+++ clang/test/Profile/misexpect-branch.c
@@ -7,6 +7,7 @@
// there should be no diagnostics when the tolerance is sufficiently high, or when -Wmisexpect is not requested
// RUN: %clang_cc1 %s -O2 -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify=foo -fdiagnostics-misexpect-tolerance=10 -Wmisexpect -debug-info-kind=line-tables-only
+// RUN: %clang -c -S %s -O2 -o - -emit-llvm -fprofile-instr-use=%t.profdata -Xclang -verify=foo -fdiagnostics-misexpect-tolerance=10 -Wmisexpect -gline-tables-only
// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify=foo
// Ensure we emit an error when we don't use pgo with tolerance threshold
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4027,6 +4027,13 @@
CmdArgs.push_back(Args.MakeArgString(Opt));
}
+ if (const Arg *A =
+ Args.getLastArg(options::OPT_fdiagnostics_misexpect_tolerance_EQ)) {
+ std::string Opt =
+ std::string("-fdiagnostics-misexpect-tolerance=") + A->getValue();
+ CmdArgs.push_back(Args.MakeArgString(Opt));
+ }
+
if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
CmdArgs.push_back("-fdiagnostics-format");
CmdArgs.push_back(A->getValue());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149206.516922.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/c0b0cafc/attachment.bin>
More information about the cfe-commits
mailing list