[clang] Fix `pragma-comment.c` test failing on false match (PR #145455)
Dave Bartolomeo via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 23 20:59:26 PDT 2025
https://github.com/dbartol created https://github.com/llvm/llvm-project/pull/145455
Sometimes the forbidden text `foo` or `bar` could appear in the Clang version string metadata. Treating the version string as a `CHECK-LABEL:` prevents this.
Fixes #145453
>From 252441c2a828d9bda1d74cec2f1f37b29348e92f Mon Sep 17 00:00:00 2001
From: Dave Bartolomeo <dave_bartolomeo at apple.com>
Date: Mon, 23 Jun 2025 23:55:27 -0400
Subject: [PATCH] Fix `pragma-comment.c` test failing on false match
Sometimes the forbidden text `foo` or `bar` could appear in the Clang version string metadata. Treating the version string as a `CHECK-LABEL:` prevents this.
---
clang/test/CodeGen/pragma-comment.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/test/CodeGen/pragma-comment.c b/clang/test/CodeGen/pragma-comment.c
index a966840f7c26f..861fba9aece3b 100644
--- a/clang/test/CodeGen/pragma-comment.c
+++ b/clang/test/CodeGen/pragma-comment.c
@@ -32,3 +32,6 @@
// ELF: ![[space]] = !{!"with space"}
// ELF-NOT: bar
// ELF-NOT: foo
+// This following match prevents the clang version metadata from matching the forbidden 'foo' and 'bar' tokens.
+// This can happen if the clang version string contains a Git repo URL that includes one of those substrings.
+// ELF-LABEL: !"clang version
More information about the cfe-commits
mailing list