[compiler-rt] 6d01ff1 - [NFC][cfi] Update diagnostic tests for better location matching (#194557)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 10:55:23 PDT 2026


Author: Vitaly Buka
Date: 2026-04-28T17:55:18Z
New Revision: 6d01ff1c503c8f1de7c86d5b94424695bc85d655

URL: https://github.com/llvm/llvm-project/commit/6d01ff1c503c8f1de7c86d5b94424695bc85d655
DIFF: https://github.com/llvm/llvm-project/commit/6d01ff1c503c8f1de7c86d5b94424695bc85d655.diff

LOG: [NFC][cfi] Update diagnostic tests for better location matching (#194557)

Added: 
    

Modified: 
    compiler-rt/test/cfi/cross-dso-diagnostic.cpp
    compiler-rt/test/cfi/cross-dso/icall/diag.cpp
    compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
    compiler-rt/test/cfi/cross-dso/icall/icall.cpp
    compiler-rt/test/cfi/icall/bad-signature.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/cfi/cross-dso-diagnostic.cpp b/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
index ed2cab04c9180..9d0e077a7eaf7 100644
--- a/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
+++ b/compiler-rt/test/cfi/cross-dso-diagnostic.cpp
@@ -33,7 +33,7 @@ int main() {
   }
 
   // CHECK: runtime error: control flow integrity check for type 'void *()' failed during indirect function call
-  // CHECK: dso_symbol defined here
+  // CHECK: cross-dso-diagnostic.cpp:[[@LINE-13]]: note: dso_symbol defined here
   // CHECK: check failed in {{.*}}_exe_suffix, destination function located in {{.*}}[[DSONAME]]
   void *S = fp(); // trigger cfi-icall failure
 

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/diag.cpp b/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
index 4df0a3858b418..a8c7f36608980 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/diag.cpp
@@ -113,7 +113,7 @@ int main(int argc, char *argv[]) {
   void *p;
   if (argv[1][0] == 'i') {
     // ICALL-DIAG: runtime error: control flow integrity check for type 'void *(int)' failed during indirect function call
-    // ICALL-DIAG-NEXT: note: create_B() defined here
+    // ICALL-DIAG-NEXT: dynamic.so+0x{{[[:xdigit:]]+}}): note: create_B() defined here
     // ICALL-NODIAG-NOT: runtime error: control flow integrity check {{.*}} during indirect function call
     p = ((void *(*)(int))create_B)(42);
   } else {

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp b/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
index b08135758efcf..d9f128ddf1026 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/icall-from-dso.cpp
@@ -18,7 +18,7 @@ void f() {
   // CHECK: =2=
   fprintf(stderr, "=2=\n");
   // CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
-  // CFI-DIAG-NEXT: note: g() defined here
+  // CFI-DIAG-NEXT: ({{.*}}exe+0x{{[[:xdigit:]]+}}): note: g() defined here
   ((void (*)(int))g)(42); // UB here
   // CHECK-DIAG: =3=
   // CHECK-NOT: =3=

diff  --git a/compiler-rt/test/cfi/cross-dso/icall/icall.cpp b/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
index b4ee48d94ea03..479047a6b05d6 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/icall.cpp
@@ -21,7 +21,7 @@ int main() {
   // CHECK: =2=
   fprintf(stderr, "=2=\n");
   // CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
-  // CFI-DIAG-NEXT: note: f() defined here
+  // CFI-DIAG-NEXT: ({{.*}}dynamic.so+0x{{[[:xdigit:]]+}}): note: f() defined here
   ((void (*)(int))f)(42); // UB here
   // CHECK-DIAG: =3=
   // CHECK-NOT: =3=

diff  --git a/compiler-rt/test/cfi/icall/bad-signature.c b/compiler-rt/test/cfi/icall/bad-signature.c
index 183e62738bb26..044c0e0f3cb4f 100644
--- a/compiler-rt/test/cfi/icall/bad-signature.c
+++ b/compiler-rt/test/cfi/icall/bad-signature.c
@@ -9,8 +9,7 @@
 
 #include <stdio.h>
 
-void f() {
-}
+void f() {}
 
 int main() {
   // CFI: 1
@@ -18,7 +17,7 @@ int main() {
   fprintf(stderr, "1\n");
 
   // CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
-  // CFI-DIAG: f defined here
+  // CFI-DIAG: bad-signature.c:[[@LINE-8]]: note: f defined here
   ((void (*)(int))f)(42); // UB here
 
   // CFI-NOT: 2


        


More information about the llvm-commits mailing list