[compiler-rt] r328775 - [asan] Split the `throw_invoke_test.cc` into a Linux specific variant
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 29 06:53:50 PDT 2018
Author: delcypher
Date: Thu Mar 29 06:53:50 2018
New Revision: 328775
URL: http://llvm.org/viewvc/llvm-project?rev=328775&view=rev
Log:
[asan] Split the `throw_invoke_test.cc` into a Linux specific variant
and the general version to avoid use of libstdc++ on non-Linux
platforms.
This is motivated by the fact that using `libstdc++` is deprecated on
Darwin and maybe removed some day.
Differential Revision: https://reviews.llvm.org/D44733
Added:
compiler-rt/trunk/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc
- copied, changed from r328753, compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc
Modified:
compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc
Copied: compiler-rt/trunk/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc (from r328753, compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc?p2=compiler-rt/trunk/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc&p1=compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc&r1=328753&r2=328775&rev=328775&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc Thu Mar 29 06:53:50 2018
@@ -1,26 +1,25 @@
-// RUN: %clangxx_asan %s -o %t && %run %t
+// This the basically the `throw_invoke_test.cc` test but using libstdc++
+// instead of the default.
// RUN: %clangxx_asan %s -o %t -stdlib=libstdc++ -static-libstdc++ && %run %t
#include <stdio.h>
static volatile int zero = 0;
inline void pretend_to_do_something(void *x) {
- __asm__ __volatile__("" : : "r" (x) : "memory");
+ __asm__ __volatile__("" : : "r"(x) : "memory");
}
-__attribute__((noinline))
-void ReallyThrow() {
+__attribute__((noinline)) void ReallyThrow() {
fprintf(stderr, "ReallyThrow\n");
try {
if (zero == 0)
throw 42;
else if (zero == 1)
throw 1.;
- } catch(double x) {
+ } catch (double x) {
}
}
-__attribute__((noinline))
-void Throw() {
+__attribute__((noinline)) void Throw() {
int a, b, c, d, e;
pretend_to_do_something(&a);
pretend_to_do_something(&b);
@@ -31,8 +30,7 @@ void Throw() {
ReallyThrow();
}
-__attribute__((noinline))
-void CheckStack() {
+__attribute__((noinline)) void CheckStack() {
int ar[100];
pretend_to_do_something(ar);
for (int i = 0; i < 100; i++)
@@ -40,12 +38,11 @@ void CheckStack() {
fprintf(stderr, "CheckStack stack = %p, %p\n", ar, ar + 100);
}
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
try {
Throw();
- } catch(int a) {
+ } catch (int a) {
fprintf(stderr, "a = %d\n", a);
}
CheckStack();
}
-
Modified: compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc?rev=328775&r1=328774&r2=328775&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/throw_invoke_test.cc Thu Mar 29 06:53:50 2018
@@ -1,5 +1,4 @@
// RUN: %clangxx_asan %s -o %t && %run %t
-// RUN: %clangxx_asan %s -o %t -stdlib=libstdc++ -static-libstdc++ && %run %t
#include <stdio.h>
static volatile int zero = 0;
More information about the llvm-commits
mailing list