[clang] 68f5d1b - [UTC] Adapt version matcher to glob CLANG_VENDOR
Alex Brachet via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 5 10:10:56 PDT 2023
Author: Henrik G. Olsson
Date: 2023-07-05T17:10:47Z
New Revision: 68f5d1be3d8f9b2ee2f25098203b24a32057b4e6
URL: https://github.com/llvm/llvm-project/commit/68f5d1be3d8f9b2ee2f25098203b24a32057b4e6
DIFF: https://github.com/llvm/llvm-project/commit/68f5d1be3d8f9b2ee2f25098203b24a32057b4e6.diff
LOG: [UTC] Adapt version matcher to glob CLANG_VENDOR
Both the pattern for finding the clang version metadata, and the emitted
checker, are now more robust, to handle a vendor prefix.
Differential Revision: https://reviews.llvm.org/D154520
Added:
Modified:
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.all.expected
clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.all.expected
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
llvm/utils/UpdateTestChecks/common.py
Removed:
################################################################################
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.all.expected b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.all.expected
index 66959811660d65..6ec61165377512 100644
--- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.all.expected
+++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.all.expected
@@ -247,12 +247,12 @@ void foo(void) {
//.
// OMP: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// OMP: [[META1:![0-9]+]] = !{i32 7, !"openmp", i32 51}
-// OMP: [[META2:![0-9]+]] = !{!"clang version {{.*}}"}
+// OMP: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
// OMP: [[META3:![0-9]+]] = !{[[META4:![0-9]+]]}
// OMP: [[META4]] = !{i64 2, i64 -1, i64 -1, i1 true}
//.
// NOOMP: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
-// NOOMP: [[META1:![0-9]+]] = !{!"clang version {{.*}}"}
+// NOOMP: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
// NOOMP: [[LOOP2]] = distinct !{[[LOOP2]], [[META3:![0-9]+]]}
// NOOMP: [[META3]] = !{!"llvm.loop.mustprogress"}
// NOOMP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]]}
diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.all.expected b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.all.expected
index 219e5ceee6c784..1b0074023a60cb 100644
--- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.all.expected
+++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.all.expected
@@ -118,12 +118,12 @@ void foo(void) {
//.
// OMP: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
// OMP: [[META1:![0-9]+]] = !{i32 7, !"openmp", i32 51}
-// OMP: [[META2:![0-9]+]] = !{!"clang version {{.*}}"}
+// OMP: [[META2:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
// OMP: [[META3:![0-9]+]] = !{[[META4:![0-9]+]]}
// OMP: [[META4]] = !{i64 2, i64 -1, i64 -1, i1 true}
//.
// NOOMP: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
-// NOOMP: [[META1:![0-9]+]] = !{!"clang version {{.*}}"}
+// NOOMP: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
// NOOMP: [[LOOP2]] = distinct !{[[LOOP2]], [[META3:![0-9]+]]}
// NOOMP: [[META3]] = !{!"llvm.loop.mustprogress"}
// NOOMP: [[LOOP4]] = distinct !{[[LOOP4]], [[META3]]}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
index a867c34090123d..ea35ec593720e7 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.globals.expected
@@ -250,13 +250,13 @@ attributes #3 = { nounwind }
; CHECK: attributes #[[ATTR2:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
; CHECK: attributes #[[ATTR3]] = { nounwind }
;.
-; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
; CHECK: [[META1]] = !DIFile(filename: "various_ir_values.c", directory: {{.*}})
; CHECK: [[META2]] = !{}
; CHECK: [[META3:![0-9]+]] = !{i32 7, !"Dwarf Version", i32 4}
; CHECK: [[META4:![0-9]+]] = !{i32 2, !"Debug Info Version", i32 3}
; CHECK: [[META5:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
-; CHECK: [[META6:![0-9]+]] = !{!"clang version {{.*}}"}
+; CHECK: [[META6:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
; CHECK: [[DBG7]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 1, type: [[META8:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META12:![0-9]+]])
; CHECK: [[META8]] = !DISubroutineType(types: [[META9:![0-9]+]])
; CHECK: [[META9]] = !{null, [[META10:![0-9]+]]}
diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
index debe0911d91120..73d17052212e10 100644
--- a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/various_ir_values.ll.funcsig.transitiveglobals.expected
@@ -243,7 +243,7 @@ attributes #3 = { nounwind }
!61 = !{!"branch_weights", i32 1, i32 1048575}
!62 = distinct !DIAssignID()
;.
-; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C99, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: [[META2:![0-9]+]], splitDebugInlining: false, nameTableKind: None)
; CHECK: [[META1]] = !DIFile(filename: "various_ir_values.c", directory: {{.*}})
; CHECK: [[META2]] = !{}
; CHECK: [[META7:![0-9]+]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 1, type: [[META8:![0-9]+]], scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META12:![0-9]+]])
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 7f89b21c317ba3..81b1335d78cbdc 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -1571,17 +1571,16 @@ def add(var):
]
-# The capture group is kept as is, followed by a {{.*}} glob
METADATA_FILTERS = [
- r"(\w+ version )[\d.]+(?: \([^)]+\))?",
- r'(!DIFile\(filename: ".+", directory: )".+"',
+ (r"(?<=\")(\w+ )?(\w+ version )[\d.]+(?: \([^)]+\))?", r"{{.*}}\2{{.*}}"), # preface with glob also, to capture optional CLANG_VENDOR
+ (r'(!DIFile\(filename: ".+", directory: )".+"', r"\1{{.*}}"),
]
-METADATA_FILTERS_RE = [re.compile(s) for s in METADATA_FILTERS]
+METADATA_FILTERS_RE = [(re.compile(f),r) for (f,r) in METADATA_FILTERS]
def filter_unstable_metadata(line):
- for f in METADATA_FILTERS_RE:
- line = f.sub(r"\1{{.*}}", line)
+ for (f,replacement) in METADATA_FILTERS_RE:
+ line = f.sub(replacement, line)
return line
More information about the cfe-commits
mailing list