[gcov] Unify driver and CC1 option names for -ftest-coverage & -fprofile-arcs

No need to use -femit-coverage-notes and -femit-coverage-data.
This commit is contained in:
Fangrui Song 2020-10-19 22:17:32 -07:00
parent 51892a42da
commit 545c687c4b
7 changed files with 23 additions and 27 deletions

View File

@ -1794,7 +1794,7 @@ def fpass_plugin_EQ : Joined<["-"], "fpass-plugin=">,
HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">; HelpText<"Load pass plugin from a dynamic shared object file (only with new pass manager).">;
defm preserve_as_comments : OptOutFFlag<"preserve-as-comments", "", defm preserve_as_comments : OptOutFFlag<"preserve-as-comments", "",
"Do not preserve comments in inline assembly">; "Do not preserve comments in inline assembly">;
def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>, Flags<[LinkOption]>; def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>, Flags<[CC1Option,LinkOption]>;
def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group<f_Group>; def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group<f_Group>;
def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>; def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;
def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>; def frandom_seed_EQ : Joined<["-"], "frandom-seed=">, Group<clang_ignored_f_Group>;
@ -1899,7 +1899,7 @@ def foptimization_record_passes_EQ : Joined<["-"], "foptimization-record-passes=
HelpText<"Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)">, HelpText<"Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)">,
MetaVarName<"<regex>">; MetaVarName<"<regex>">;
def ftest_coverage : Flag<["-"], "ftest-coverage">, Group<f_Group>; def ftest_coverage : Flag<["-"], "ftest-coverage">, Flags<[CC1Option]>, Group<f_Group>;
def fno_test_coverage : Flag<["-"], "fno-test-coverage">, Group<f_Group>; def fno_test_coverage : Flag<["-"], "fno-test-coverage">, Group<f_Group>;
def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>, def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>,
HelpText<"Enable the loop vectorization passes">; HelpText<"Enable the loop vectorization passes">;
@ -3791,10 +3791,6 @@ def fdump_vtable_layouts : Flag<["-"], "fdump-vtable-layouts">,
HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">; HelpText<"Dump the layouts of all vtables that will be emitted in a translation unit">;
def fmerge_functions : Flag<["-"], "fmerge-functions">, def fmerge_functions : Flag<["-"], "fmerge-functions">,
HelpText<"Permit merging of identical functions when optimizing.">; HelpText<"Permit merging of identical functions when optimizing.">;
def femit_coverage_notes : Flag<["-"], "femit-coverage-notes">,
HelpText<"Emit a gcov coverage notes file when compiling.">;
def femit_coverage_data: Flag<["-"], "femit-coverage-data">,
HelpText<"Instrument the program to emit gcov coverage data when run.">;
def coverage_data_file : Separate<["-"], "coverage-data-file">, def coverage_data_file : Separate<["-"], "coverage-data-file">,
HelpText<"Emit coverage data to this filename.">; HelpText<"Emit coverage data to this filename.">;
def coverage_data_file_EQ : Joined<["-"], "coverage-data-file=">, def coverage_data_file_EQ : Joined<["-"], "coverage-data-file=">,

View File

@ -831,9 +831,9 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
Args.hasArg(options::OPT_coverage); Args.hasArg(options::OPT_coverage);
bool EmitCovData = TC.needsGCovInstrumentation(Args); bool EmitCovData = TC.needsGCovInstrumentation(Args);
if (EmitCovNotes) if (EmitCovNotes)
CmdArgs.push_back("-femit-coverage-notes"); CmdArgs.push_back("-ftest-coverage");
if (EmitCovData) if (EmitCovData)
CmdArgs.push_back("-femit-coverage-data"); CmdArgs.push_back("-fprofile-arcs");
if (Args.hasFlag(options::OPT_fcoverage_mapping, if (Args.hasFlag(options::OPT_fcoverage_mapping,
options::OPT_fno_coverage_mapping, false)) { options::OPT_fno_coverage_mapping, false)) {

View File

@ -1052,8 +1052,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.ControlFlowGuardNoChecks = Args.hasArg(OPT_cfguard_no_checks); Opts.ControlFlowGuardNoChecks = Args.hasArg(OPT_cfguard_no_checks);
Opts.ControlFlowGuard = Args.hasArg(OPT_cfguard); Opts.ControlFlowGuard = Args.hasArg(OPT_cfguard);
Opts.EmitGcovArcs = Args.hasArg(OPT_femit_coverage_data); Opts.EmitGcovNotes = Args.hasArg(OPT_ftest_coverage);
Opts.EmitGcovNotes = Args.hasArg(OPT_femit_coverage_notes); Opts.EmitGcovArcs = Args.hasArg(OPT_fprofile_arcs);
if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) { if (Opts.EmitGcovArcs || Opts.EmitGcovNotes) {
Opts.CoverageDataFile = Opts.CoverageDataFile =
std::string(Args.getLastArgValue(OPT_coverage_data_file)); std::string(Args.getLastArgValue(OPT_coverage_data_file));

View File

@ -1,6 +1,6 @@
/// -fprofile-update=atomic (implied by -fsanitize=thread) requires the /// -fprofile-update=atomic (implied by -fsanitize=thread) requires the
/// (potentially concurrent) counter updates to be atomic. /// (potentially concurrent) counter updates to be atomic.
// RUN: %clang_cc1 %s -triple x86_64 -emit-llvm -fprofile-update=atomic -femit-coverage-notes -femit-coverage-data \ // RUN: %clang_cc1 %s -triple x86_64 -emit-llvm -fprofile-update=atomic -ftest-coverage -fprofile-arcs \
// RUN: -coverage-notes-file /dev/null -coverage-data-file /dev/null -o - | FileCheck %s // RUN: -coverage-notes-file /dev/null -coverage-data-file /dev/null -o - | FileCheck %s
// CHECK-LABEL: void @foo() // CHECK-LABEL: void @foo()

View File

@ -2,17 +2,17 @@
/// 3.4 redesigns the format and changed .da to .gcda /// 3.4 redesigns the format and changed .da to .gcda
/// 4.7 enables cfg_checksum. /// 4.7 enables cfg_checksum.
/// 4.8 (default, compatible with gcov 7) emits the exit block the second. /// 4.8 (default, compatible with gcov 7) emits the exit block the second.
// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data -coverage-version='304*' %s -o - | \ // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-version='304*' %s -o - | \
// RUN: FileCheck --check-prefixes=CHECK,304 %s // RUN: FileCheck --check-prefixes=CHECK,304 %s
// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data -coverage-version='407*' %s -o - | \ // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-version='407*' %s -o - | \
// RUN: FileCheck --check-prefixes=CHECK,407 %s // RUN: FileCheck --check-prefixes=CHECK,407 %s
// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data %s -o - | \ // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs %s -o - | \
// RUN: FileCheck --check-prefixes=CHECK,408 %s // RUN: FileCheck --check-prefixes=CHECK,408 %s
// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data -coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix GCOV_FILE_INFO // RUN: %clang_cc1 -emit-llvm -disable-red-zone -fprofile-arcs -coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix GCOV_FILE_INFO
// RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -femit-coverage-data %s 2>&1 | FileCheck --check-prefix=NEWPM %s // RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=NEWPM %s
// RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -femit-coverage-data -O3 %s 2>&1 | FileCheck --check-prefix=NEWPM-O3 %s // RUN: %clang_cc1 -emit-llvm-bc -o /dev/null -fexperimental-new-pass-manager -fdebug-pass-manager -fprofile-arcs -O3 %s 2>&1 | FileCheck --check-prefix=NEWPM-O3 %s
// NEWPM-NOT: Running pass // NEWPM-NOT: Running pass
// NEWPM: Running pass: GCOVProfilerPass // NEWPM: Running pass: GCOVProfilerPass

View File

@ -1,16 +1,16 @@
// RUN: %clang -### -S -ftest-coverage %s 2>&1 | FileCheck --check-prefix=TEST-COVERAGE %s // RUN: %clang -### -S -ftest-coverage %s 2>&1 | FileCheck --check-prefix=TEST-COVERAGE %s
// RUN: %clang -### -S -ftest-coverage -fno-test-coverage %s 2>&1 | FileCheck --check-prefix=NO-TEST-COVERAGE %s // RUN: %clang -### -S -ftest-coverage -fno-test-coverage %s 2>&1 | FileCheck --check-prefix=NO-TEST-COVERAGE %s
// TEST-COVERAGE: "-femit-coverage-notes" // TEST-COVERAGE: "-ftest-coverage"
// TEST-COVERAGE: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.gcno" // TEST-COVERAGE: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.gcno"
// NO-TEST-COVERAGE-NOT: "-coverage-notes-file" // NO-TEST-COVERAGE-NOT: "-coverage-notes-file"
// RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=PROFILE-ARCS %s // RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=PROFILE-ARCS %s
// RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck --check-prefix=NO-PROFILE-ARCS %s // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck --check-prefix=NO-PROFILE-ARCS %s
// PROFILE-ARCS: "-femit-coverage-data" // PROFILE-ARCS: "-fprofile-arcs"
// PROFILE-ARCS: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.c" // PROFILE-ARCS: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.c"
// NO-PROFILE-ARCS-NOT: "-femit-coverage-data" // NO-PROFILE-ARCS-NOT: "-ftest-coverage"
// RUN: %clang -### -S -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s // RUN: %clang -### -S -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s
// RUN: %clang_cl -### /c --coverage /Fo/foo/bar.obj -- %s 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s // RUN: %clang_cl -### /c --coverage /Fo/foo/bar.obj -- %s 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s

View File

@ -9,19 +9,19 @@
// //
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -fprofile-instr-generate %s 2>&1 | \ // RUN: -fprofile-instr-generate %s 2>&1 | \
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefixes=CHECK,PROF %s // RUN: FileCheck --check-prefixes=CHECK,PROF %s
// //
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -coverage %s 2>&1 | \ // RUN: -coverage %s 2>&1 | \
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefixes=CHECK,GCOV %s // RUN: FileCheck --check-prefixes=CHECK,GCOV %s
// //
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -ftest-coverage %s 2>&1 | \ // RUN: -ftest-coverage %s 2>&1 | \
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefixes=CHECK,GCOV %s // RUN: FileCheck --check-prefixes=CHECK,GCOV %s
// //
// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \ // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 \
// RUN: -fprofile-instr-generate -fcoverage-mapping %s 2>&1 | \ // RUN: -fprofile-instr-generate -fcoverage-mapping %s 2>&1 | \
// RUN: FileCheck -allow-deprecated-dag-overlap --check-prefixes=CHECK,PROF,GCOV %s // RUN: FileCheck --check-prefixes=CHECK,PROF %s
// //
// //
// CHECK-NOT: error: unsupported option '-fprofile // CHECK-NOT: error: unsupported option '-fprofile
@ -30,5 +30,5 @@
// CHECK-NOT: "-f{{[^"]*coverage.*}}" // CHECK-NOT: "-f{{[^"]*coverage.*}}"
// CHECK-NOT: "-fprofile{{[^"]*}}" // CHECK-NOT: "-fprofile{{[^"]*}}"
// CHECK: "-triple" "x86_64-unknown-linux-gnu" // CHECK: "-triple" "x86_64-unknown-linux-gnu"
// PROF-DAG: "-fprofile{{.*}}" // PROF: "-fprofile{{.*}}"
// GCOV-DAG: "-f{{(coverage|emit-coverage).*}}" // GCOV: "-ftest-coverage"