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