[clang] eee6a12 - [clang-repl][NFC] Split weak symbol test to a new test

Jun Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 7 18:18:35 PDT 2022


Author: Jun Zhang
Date: 2022-07-08T09:17:11+08:00
New Revision: eee6a12227a608e4c9aa4d9428d3fe55071f2d64

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

LOG: [clang-repl][NFC] Split weak symbol test to a new test

Windows has some issues when we try to use `__attribute__((weak))` in
JIT, so we disabled that. But it's not worth to disable the whole test
just for this single feature. This patch split that part from the
original test so we can keep testing stuff that normally working in
Windows.

Signed-off-by: Jun Zhang <jun at junz.org>

Differential Revision: https://reviews.llvm.org/D129250

Added: 
    clang/test/Interpreter/execute-weak.cpp

Modified: 
    clang/test/Interpreter/execute.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Interpreter/execute-weak.cpp b/clang/test/Interpreter/execute-weak.cpp
new file mode 100644
index 0000000000000..e4577e3ced6e9
--- /dev/null
+++ b/clang/test/Interpreter/execute-weak.cpp
@@ -0,0 +1,14 @@
+// RUN: clang-repl "int x = 10;" "int y=7; err;" "int y = 10;"
+// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
+// RUN:            'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
+// REQUIRES: host-supports-jit
+// UNSUPPORTED: system-aix
+// XFAIL: system-windows
+// CHECK-DRIVER: i = 10
+// RUN: cat %s | clang-repl | FileCheck %s
+extern "C" int printf(const char *, ...);
+int __attribute__((weak)) bar() { return 42; }
+auto r4 = printf("bar() = %d\n", bar());
+// CHECK: bar() = 42
+
+%quit

diff  --git a/clang/test/Interpreter/execute.cpp b/clang/test/Interpreter/execute.cpp
index b5dad4722c0ba..f5c70c21ac507 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -3,7 +3,6 @@
 // RUN:            'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
 // REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
-// XFAIL: system-windows
 // CHECK-DRIVER: i = 10
 // RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
@@ -19,8 +18,4 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, reinterpret_cast<unsigned long long
 inline int foo() { return 42; }
 int r3 = foo();
 
-int __attribute__((weak)) bar() { return 1; }
-auto r4 = printf("bar() = %d\n", bar());
-// CHECK-NEXT: bar() = 1
-
 %quit


        


More information about the cfe-commits mailing list