Clang Project

clang_source_code/test/CodeGen/debug-info-gline-tables-only.c
1// RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -S -emit-llvm -o - | FileCheck %s
2// RUN: %clang_cc1 %s -debug-info-kind=line-directives-only -S -emit-llvm -o - | FileCheck %s
3// Checks that clang with "-gline-tables-only" or "-gline-directives-only" doesn't emit debug info
4// for variables and types.
5
6// CHECK-NOT: DW_TAG_variable
7int global = 42;
8
9// CHECK-NOT: DW_TAG_typedef
10// CHECK-NOT: DW_TAG_const_type
11// CHECK-NOT: DW_TAG_pointer_type
12// CHECK-NOT: DW_TAG_array_type
13typedef const char* constCharPtrArray[10];
14
15// CHECK-NOT: DW_TAG_structure_type
16struct S {
17  // CHECK-NOT: DW_TAG_member
18  char a;
19  double b;
20  constCharPtrArray c;
21};
22
23// CHECK-NOT: DW_TAG_enumerator
24// CHECK-NOT: DW_TAG_enumeration_type
25enum E { ZERO = 0, ONE = 1 };
26
27// CHECK-NOT: DILocalVariable
28int sum(int p, int q) {
29  int r = p + q;
30  struct S s;
31  enum E e;
32  return r;
33}
34