2019-11-14 10:19:32 +08:00
|
|
|
// 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.
|
|
|
|
//
|
2020-03-19 19:13:18 +08:00
|
|
|
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \
|
2019-11-14 10:19:32 +08:00
|
|
|
// RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN
|
2019-06-27 14:44:44 +08:00
|
|
|
|
2019-11-14 10:19:32 +08:00
|
|
|
// 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: !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"
|
2019-06-27 14:44:44 +08:00
|
|
|
|
|
|
|
extern int fn1(int a, int b);
|
2019-11-14 10:19:32 +08:00
|
|
|
extern int memcmp(const void *s1, const void *s2, unsigned long n);
|
|
|
|
extern void __some_reserved_name(void);
|
2019-06-27 14:44:44 +08:00
|
|
|
|
2019-11-14 10:19:32 +08:00
|
|
|
int fn2 (int *src, int *dst) {
|
2019-06-27 14:44:44 +08:00
|
|
|
int x = 4, y = 5;
|
|
|
|
int res = fn1(x, y);
|
2019-11-14 10:19:32 +08:00
|
|
|
int res2 = memcmp(dst, src, res);
|
|
|
|
__some_reserved_name();
|
|
|
|
return res + res2;
|
2019-06-27 14:44:44 +08:00
|
|
|
}
|
|
|
|
|