| 1 |
// ============================================================================= |
| 2 |
// No Trap Reasons |
| 3 |
// ============================================================================= |
| 4 |
|
| 5 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 6 |
// RUN: -fsanitize-debug-trap-reasons=none %s -### 2>&1 | \ |
| 7 |
// RUN: FileCheck --check-prefix=NONE %s |
| 8 |
|
| 9 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 10 |
// RUN: -fno-sanitize-debug-trap-reasons %s -### 2>&1 | \ |
| 11 |
// RUN: FileCheck --check-prefix=NONE %s |
| 12 |
|
| 13 |
// NONE: -fsanitize-debug-trap-reasons=none |
| 14 |
|
| 15 |
// ============================================================================= |
| 16 |
// Basic Trap Reasons |
| 17 |
// ============================================================================= |
| 18 |
|
| 19 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 20 |
// RUN: -fsanitize-debug-trap-reasons=basic %s -### 2>&1 | \ |
| 21 |
// RUN: FileCheck --check-prefix=BASIC %s |
| 22 |
// BASIC: -fsanitize-debug-trap-reasons=basic |
| 23 |
|
| 24 |
// ============================================================================= |
| 25 |
// Detailed Trap Reasons |
| 26 |
// ============================================================================= |
| 27 |
|
| 28 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 29 |
// RUN: -fsanitize-debug-trap-reasons=detailed %s -### 2>&1 | \ |
| 30 |
// RUN: FileCheck --check-prefix=DETAILED %s |
| 31 |
|
| 32 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 33 |
// RUN: -fsanitize-debug-trap-reasons %s -### 2>&1 | \ |
| 34 |
// RUN: FileCheck --check-prefix=DETAILED %s |
| 35 |
|
| 36 |
// DETAILED: -fsanitize-debug-trap-reasons=detailed |
| 37 |
|
| 38 |
// ============================================================================= |
| 39 |
// Other cases |
| 40 |
// ============================================================================= |
| 41 |
|
| 42 |
// By default the driver doesn't pass along any value and the default value is |
| 43 |
// whatever is the default in CodeGenOptions. |
| 44 |
// RUN: %clang %s -### 2>&1 | FileCheck --check-prefix=DEFAULT %s |
| 45 |
// DEFAULT-NOT: -fsanitize-debug-trap-reasons |
| 46 |
|
| 47 |
// Warning when not using UBSan |
| 48 |
// RUN: %clang -fsanitize-debug-trap-reasons=none %s -### 2>&1 | \ |
| 49 |
// RUN: FileCheck --check-prefix=WARN %s |
| 50 |
// WARN: warning: argument unused during compilation: '-fsanitize-debug-trap-reasons=none' |
| 51 |
|
| 52 |
// Bad flag arguments are just passed along to the Frontend which handles rejecting |
| 53 |
// invalid values. See `clang/test/Frontend/fsanitize-debug-trap-reasons.c` |
| 54 |
// RUN: %clang -fsanitize=undefined -fsanitize-trap=undefined \ |
| 55 |
// RUN: -fsanitize-debug-trap-reasons=bad_value %s -### 2>&1 | \ |
| 56 |
// RUN: FileCheck --check-prefix=BAD_VALUE %s |
| 57 |
// BAD_VALUE: -fsanitize-debug-trap-reasons=bad_value |