1*67e74705SXin Li // RUN: %clang_cc1 -triple=i386-pc-solaris2.11 -w -emit-llvm %s -o - | FileCheck %s 2*67e74705SXin Li 3*67e74705SXin Li extern "C" { 4*67e74705SXin Li struct statvfs64 { 5*67e74705SXin Li int f; 6*67e74705SXin Li }; 7*67e74705SXin Li #pragma redefine_extname statvfs64 statvfs 8*67e74705SXin Li int statvfs64(struct statvfs64 *); 9*67e74705SXin Li } 10*67e74705SXin Li some_func()11*67e74705SXin Livoid some_func() { 12*67e74705SXin Li struct statvfs64 st; 13*67e74705SXin Li statvfs64(&st); 14*67e74705SXin Li // Check that even if there is a structure with redefined name before the 15*67e74705SXin Li // pragma, subsequent function name redefined properly. PR5172, Comment 11. 16*67e74705SXin Li // CHECK: call i32 @statvfs(%struct.statvfs64* %st) 17*67e74705SXin Li } 18*67e74705SXin Li 19*67e74705SXin Li // This is a case when redefenition is deferred *and* we have a local of the 20*67e74705SXin Li // same name. PR23923. 21*67e74705SXin Li #pragma redefine_extname foo bar f()22*67e74705SXin Liint f() { 23*67e74705SXin Li int foo = 0; 24*67e74705SXin Li return foo; 25*67e74705SXin Li } 26*67e74705SXin Li extern "C" { foo()27*67e74705SXin Li int foo() { return 1; } 28*67e74705SXin Li // CHECK: define i32 @bar() 29*67e74705SXin Li } 30*67e74705SXin Li 31*67e74705SXin Li // Check that #pragma redefine_extname applies to C code only, and shouldn't be 32*67e74705SXin Li // applied to C++. 33*67e74705SXin Li #pragma redefine_extname foo_cpp bar_cpp foo_cpp()34*67e74705SXin Liextern int foo_cpp() { return 1; } 35*67e74705SXin Li // CHECK-NOT: define i32 @bar_cpp() 36*67e74705SXin Li 37