File: debug-info-extern-call.c

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 995,836 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (45 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
// When entry values are emitted, expect a subprogram for extern decls so that
// the dwarf generator can describe call site parameters at extern call sites.
//
// Initial implementation relied on the 'retainedTypes:' from the corresponding
// DICompileUnit, so we also ensure that we do not store the extern declaration
// subprogram into the 'retainedTypes:'.
//
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
// RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN

// Similarly, when the debugger tuning is gdb, expect a subprogram for extern
// decls so that the dwarf generator can describe information needed for tail
// call frame reconstrution.
//
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -ggdb -S -emit-llvm %s -o - \
// RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
//
// Do not emit a subprogram for extern decls when entry values are disabled and
// the tuning is not set to gdb.
//
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
// RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN

// DECLS-FOR-EXTERN-NOT: !DICompileUnit({{.*}}retainedTypes: ![[RETTYPES:[0-9]+]]
// DECLS-FOR-EXTERN-NOT: ![[RETTYPES]] = !{
// DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
// DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
// DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"

// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "fn1"
// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"

extern int fn1(int a, int b);
extern int memcmp(const void *s1, const void *s2, unsigned long n);
extern void __some_reserved_name(void);

int fn2 (int *src, int *dst) {
  int x = 4, y = 5;
  int res = fn1(x, y);
  int res2 = memcmp(dst, src, res);
  __some_reserved_name();
  return res + res2;
}