[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / clang / test / CodeGen / redefine_extname.c
blobff9ac20a4dbb5ef4883d644c80b824963cf7ebe0
1 // RUN: %clang_cc1 -triple=i386-pc-solaris2.11 -w -emit-llvm %s -o - | FileCheck %s
3 #pragma redefine_extname fake real
4 #pragma redefine_extname name alias
6 extern int fake(void);
8 int name;
10 // __PRAGMA_REDEFINE_EXTNAME should be defined. This will fail if it isn't...
11 int fish(void) { return fake() + __PRAGMA_REDEFINE_EXTNAME + name; }
12 // Check that the call to fake() is emitted as a call to real()
13 // CHECK: call i32 @real()
14 // Check that this also works with variables names
15 // CHECK: load i32, ptr @alias
17 // This is a case when redefenition is deferred *and* we have a local of the
18 // same name. PR23923.
19 #pragma redefine_extname foo bar
20 int f(void) {
21 int foo = 0;
22 return foo;
24 extern int foo(void) { return 1; }
25 // CHECK: define{{.*}} i32 @bar()
27 // Check that pragma redefine_extname applies to external declarations only.
28 #pragma redefine_extname foo_static bar_static
29 static int foo_static(void) { return 1; }
30 int baz(void) { return foo_static(); }
31 // CHECK-NOT: call i32 @bar_static()
33 // Check that pragma redefine_extname applies to builtin functions.
34 typedef unsigned long size_t;
35 extern void *memcpy(void *, const void *, size_t);
36 #pragma redefine_extname memcpy __GI_memcpy
37 void *test_memcpy(void *dst, const void *src, size_t n) { return memcpy(dst, src, n); }
38 // CHECK: call ptr @__GI_memcpy(