Clang Project

clang_source_code/test/Driver/cuda-dwarf-2.cu
1// REQUIRES: clang-driver
2//
3// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 | \
4// RUN:   FileCheck %s -check-prefix DEBUG_DIRECTIVES
5// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 2>&1 | \
6// RUN:   FileCheck %s -check-prefix DEBUG_DIRECTIVES
7// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 | \
8// RUN:   FileCheck %s -check-prefix DEBUG_DIRECTIVES
9// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g0 2>&1 | \
10// RUN:   FileCheck %s -check-prefix NO_DEBUG
11// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 | \
12// RUN:   FileCheck %s -check-prefix NO_DEBUG
13// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-directives-only -O2 --cuda-noopt-device-debug 2>&1 | \
14// RUN:   FileCheck %s -check-prefix DEBUG_DIRECTIVES
15
16// NO_DEBUG-NOT: warning: debug
17// DEBUG_DIRECTIVES-NOT: warning: debug
18// NO_DEBUG: "-fcuda-is-device"
19// NO_DEBUG-NOT: "-debug-info-kind=
20// NO_DEBUG: ptxas
21// NO_DEBUG-NOT: "-g"
22// DEBUG_DIRECTIVES: "-fcuda-is-device"
23// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only"
24// DEBUG_DIRECTIVES: ptxas
25// DEBUG_DIRECTIVES-SAME: "-lineinfo"
26// NO_DEBUG: fatbinary
27// NO_DEBUG-NOT: "-g"
28
29// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g 2>&1 | \
30// RUN:   FileCheck %s -check-prefix HAS_DEBUG
31// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --cuda-noopt-device-debug 2>&1 | \
32// RUN:   FileCheck %s -check-prefix HAS_DEBUG
33// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 | \
34// RUN:   FileCheck %s -check-prefix HAS_DEBUG
35// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --cuda-noopt-device-debug 2>&1 | \
36// RUN:   FileCheck %s -check-prefix HAS_DEBUG
37// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g2 2>&1 | \
38// RUN:   FileCheck %s -check-prefix HAS_DEBUG
39// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb2 -O0 2>&1 | \
40// RUN:   FileCheck %s -check-prefix HAS_DEBUG
41// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g3 -O2 --cuda-noopt-device-debug 2>&1 | \
42// RUN:   FileCheck %s -check-prefix HAS_DEBUG
43// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \
44// RUN:   FileCheck %s -check-prefix HAS_DEBUG
45// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb1 2>&1 | \
46// RUN:   FileCheck %s -check-prefix HAS_DEBUG
47// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \
48// RUN:   FileCheck %s -check-prefix HAS_DEBUG
49
50// HAS_DEBUG-NOT: warning: debug
51// HAS_DEBUG: "-fcuda-is-device"
52// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}"
53// HAS_DEBUG-SAME: "-dwarf-version=2"
54// HAS_DEBUG: ptxas
55// HAS_DEBUG-SAME: "-g"
56// HAS_DEBUG-SAME: "--dont-merge-basicblocks"
57// HAS_DEBUG-SAME: "--return-at-end"
58// HAS_DEBUG: fatbinary
59// HAS_DEBUG-SAME: "-g"
60
61