1 // When entry values are emitted, expect a subprogram for extern decls so that
2 // the dwarf generator can describe call site parameters at extern call sites.
3 //
4 // RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
5 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
6 
7 // Similarly, when the debugger tuning is gdb, expect a subprogram for extern
8 // decls so that the dwarf generator can describe information needed for tail
9 // call frame reconstrution.
10 //
11 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -ggdb -S -emit-llvm %s -o - \
12 // RUN:   | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
13 //
14 // Do not emit a subprogram for extern decls when entry values are disabled and
15 // the tuning is not set to gdb.
16 //
17 // RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \
18 // RUN:   | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN
19 
20 // DECLS-FOR-EXTERN: !DISubprogram(name: "fn1"
21 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
22 // DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
23 
24 // NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "fn1"
25 // NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp"
26 // NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name"
27 
28 extern int fn1(int a, int b);
29 extern int memcmp(const void *s1, const void *s2, unsigned long n);
30 extern void __some_reserved_name(void);
31 
32 int fn2 (int *src, int *dst) {
33   int x = 4, y = 5;
34   int res = fn1(x, y);
35   int res2 = memcmp(dst, src, res);
36   __some_reserved_name();
37   return res + res2;
38 }
39 
40