================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 %s -triple=i686-pc-win32 -fms-extensions -emit-llvm -o - | 
FileCheck %s
+
+int __cdecl myexit(void (__cdecl *pf)(void));
+
+struct S {
+  S();
+  ~S();
+};
+
+#pragma init_seg(".myseg", myexit)
+
+S s;
+
+// The initializer pointer is still placed in the custom section.
+// CHECK: @__cxx_init_fn_ptr = private constant ptr @"??__Es@@YAXXZ", section 
".myseg"
+
+// The destructor registration calls myexit instead of atexit.
+// CHECK-LABEL: define {{.*}} @"??__Es@@YAXXZ"
+// CHECK: call i32 @"?myexit@@{{[^"]+}}"(
+// CHECK-NOT: call {{.*}} @atexit(
----------------
Artem-B wrote:

\-NOT checks are tricky. In this case the test could succeed if we happen to 
call atexit before myexit.

Quick way to fix it here is to add another check-not above myexit check.

A more robust way to deal with negative tests is to do them in a separate run 
with only -NOT and anchor checks active. E.g in thi case CHECK-label for the 
function start and `-NOT atexit` for the whole function.

https://github.com/llvm/llvm-project/pull/203769
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to