[clang] Fix `pragma-comment.c` test failing on false match (PR #145455)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 23 21:00:15 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Dave Bartolomeo (dbartol)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/145455.diff


1 Files Affected:

- (modified) clang/test/CodeGen/pragma-comment.c (+3) 


``````````diff
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

``````````

</details>


https://github.com/llvm/llvm-project/pull/145455


More information about the cfe-commits mailing list