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());
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());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits