Skip to content

Commit 82fecab

Browse files
committed
[gcov] Bump default version to 11.1
The gcov version is set to 11.1 (compatible with gcov 9) even if `-Xclang -coverage-version=` specified version is less than 11.1. Therefore, we can drop producer support for version < 11.1.
1 parent 30b73ed commit 82fecab

15 files changed

+41
-74
lines changed

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class CodeGenOptions : public CodeGenOptionsBase {
186186
std::string ProfileExcludeFiles;
187187

188188
/// The version string to put into coverage files.
189-
char CoverageVersion[4];
189+
char CoverageVersion[4] = {'0', '0', '0', '0'};
190190

191191
/// Enable additional debugging information.
192192
std::string DebugPass;

clang/lib/Basic/CodeGenOptions.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CodeGenOptions::CodeGenOptions() {
1717
#include "clang/Basic/CodeGenOptions.def"
1818

1919
RelocationModel = llvm::Reloc::PIC_;
20-
memcpy(CoverageVersion, "408*", 4);
2120
}
2221

2322
void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
@@ -54,7 +53,6 @@ void CodeGenOptions::resetNonModularOptions(StringRef ModuleFormat) {
5453
}
5554

5655
RelocationModel = llvm::Reloc::PIC_;
57-
memcpy(CoverageVersion, "408*", 4);
5856
}
5957

6058
} // end namespace clang

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const CodeGenOptions &Opts,
16911691
}
16921692
}
16931693

1694-
if (memcmp(Opts.CoverageVersion, "408*", 4) != 0)
1694+
if (memcmp(Opts.CoverageVersion, "0000", 4))
16951695
GenerateArg(Consumer, OPT_coverage_version_EQ,
16961696
StringRef(Opts.CoverageVersion, 4));
16971697

@@ -2007,7 +2007,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
20072007
} else if (Args.hasArg(OPT_fmemory_profile))
20082008
Opts.MemoryProfileOutput = MemProfileBasename;
20092009

2010-
memcpy(Opts.CoverageVersion, "408*", 4);
20112010
if (Opts.CoverageNotesFile.size() || Opts.CoverageDataFile.size()) {
20122011
if (Args.hasArg(OPT_coverage_version_EQ)) {
20132012
StringRef CoverageVersion = Args.getLastArgValue(OPT_coverage_version_EQ);

clang/test/CodeGen/code-coverage.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@
33
/// 4.7 enables cfg_checksum.
44
/// 4.8 (default, compatible with gcov 7) emits the exit block the second.
55
// RUN: rm -rf %t && mkdir %t && cd %t
6-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='304*' %s -o - | \
7-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,304 %s
8-
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='407*' %s -o - | \
9-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,407 %s
6+
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='B21*' %s -o - | \
7+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,1210 %s
108
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -disable-red-zone -coverage-data-file=/dev/null %s -o - | \
11-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,408 %s
12-
// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='304*' %s -o - | \
13-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,304 %s
14-
// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='407*' %s -o - | \
15-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,407 %s
9+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-CTOR-INIT,1110 %s
10+
// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null -coverage-version='B21*' %s -o - | \
11+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,1210 %s
1612
// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -disable-red-zone -coverage-data-file=/dev/null %s -o - | \
17-
// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,408 %s
13+
// RUN: FileCheck --check-prefixes=CHECK,CHECK-RT-INIT,1110 %s
1814

1915
// RUN: %clang_cc1 -emit-llvm -disable-red-zone -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
2016

@@ -48,12 +44,10 @@ int test2(int b) {
4844
// CHECK-SAME: [%emit_function_args_ty { i32 0, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }, %emit_function_args_ty { i32 1, i32 {{[-0-9]+}}, i32 {{[-0-9]+}} }]
4945

5046
// CHECK: @__llvm_internal_gcov_emit_file_info = internal unnamed_addr constant [1 x %file_info]
51-
/// 0x3330342a '3' '0' '4' '*'
52-
// 304-SAME: i32 858797098
53-
/// 0x3430372a '4' '0' '7' '*'
54-
// 407-SAME: i32 875575082
55-
/// 0x3430382a '4' '0' '8' '*'
56-
// 408-SAME: i32 875575338
47+
/// 0x4231312a 'B' '1' '1' '*'
48+
// 1110-SAME: i32 1110520106
49+
/// 0x4232312a 'B' '2' '1' '*'
50+
// 1210-SAME: i32 1110585642
5751

5852
// Check for gcov initialization function pointers.
5953
// CHECK-RT-INIT: @__llvm_covinit_functions = private constant { ptr, ptr } { ptr @__llvm_gcov_writeout, ptr @__llvm_gcov_reset }, section "__llvm_covinit"

compiler-rt/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-exceptions.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-gcov-exceptions.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT: -: 1:#include <string>
76
// CHECK-NEXT: -: 2:
87
// CHECK-NEXT: 1: 3:void asd(std::string i) {

compiler-rt/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-multiple-bbs-single-line.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-gcov-multiple-bbs-single-line.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT:function main called 1 returned 100% blocks executed 77%
76
// CHECK-NEXT: 1: 1:int main(void)
87
// CHECK-NEXT: -: 2:{

compiler-rt/test/profile/Inputs/instrprof-gcov-one-line-function.c.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-one-line-function.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-gcov-one-line-function.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT: 1: 1:void foo() { }
76
// CHECK-NEXT: -: 2:
87
// CHECK-NEXT: 1: 3:void bar() { }

compiler-rt/test/profile/Inputs/instrprof-gcov-switch1.c.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-switch1.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-gcov-switch1.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT: 1: 1:int main(void)
76
// CHECK-NEXT: -: 2:{
87
// CHECK-NEXT: 1: 3: int i = 22;

compiler-rt/test/profile/Inputs/instrprof-gcov-switch2.c.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-gcov-switch2.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-gcov-switch2.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT: 1: 1:int main(void)
76
// CHECK-NEXT: -: 2:{
87
// CHECK-NEXT: 1: 3: int i = 22;

compiler-rt/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno
33
// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda
44
// CHECK-NEXT: -: 0:Runs:1
5-
// CHECK-NEXT: -: 0:Programs:1
65
// CHECK-NEXT: -: 1:int g1 = 0;
76
// CHECK-NEXT: -: 2:int g2 = 1;
87
// CHECK-NEXT: -: 3:

0 commit comments

Comments
 (0)