aboutsummaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc
blob: 88d41b6d5fea67b6e7e18599b7053cd2e81c9a95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Test dedup_token_length
// RUN: %clangxx -O0 %s -o %t
// RUN: env %tool_options='abort_on_error=0'                    not %run %t 2>&1   | FileCheck %s --check-prefix=CHECK0
// RUN: env %tool_options='abort_on_error=0, dedup_token_length=0' not %run %t 2>&1   | FileCheck %s --check-prefix=CHECK0
// RUN: env %tool_options='abort_on_error=0, dedup_token_length=1' not %run %t 2>&1   | FileCheck %s --check-prefix=CHECK1
// RUN: env %tool_options='abort_on_error=0, dedup_token_length=2' not %run %t 2>&1   | FileCheck %s --check-prefix=CHECK2
// RUN: env %tool_options='abort_on_error=0, dedup_token_length=3' not %run %t 2>&1   | FileCheck %s --check-prefix=CHECK3

// REQUIRES: stable-runtime
// FIXME: implement SEGV handler in other sanitizers, not just asan.
// XFAIL: msan
// XFAIL: lsan
// XFAIL: tsan

volatile int *null = 0;

namespace Xyz {
  template<class A, class B> void Abc() {
    *null = 0;
  }
}

extern "C" void bar() {
  Xyz::Abc<int, int>();
}

void FOO() {
  bar();
}

int main(int argc, char **argv) {
  FOO();
}

// CHECK0-NOT: DEDUP_TOKEN:
// CHECK1: DEDUP_TOKEN: void Xyz::Abc<int, int>()
// CHECK1-NOT: bar
// CHECK2: DEDUP_TOKEN: void Xyz::Abc<int, int>()--bar
// CHECK2-NOT: FOO
// CHECK3: DEDUP_TOKEN: void Xyz::Abc<int, int>()--bar--FOO()