Files
clang-p2996/clang/test/CodeGenCXX/redefine_extname.cpp
Nikita Popov 532dc62b90 [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC)
This adds -no-opaque-pointers to clang tests whose output will
change when opaque pointers are enabled by default. This is
intended to be part of the migration approach described in
https://discourse.llvm.org/t/enabling-opaque-pointers-by-default/61322/9.

The patch has been produced by replacing %clang_cc1 with
%clang_cc1 -no-opaque-pointers for tests that fail with opaque
pointers enabled. Worth noting that this doesn't cover all tests,
there's a remaining ~40 tests not using %clang_cc1 that will need
a followup change.

Differential Revision: https://reviews.llvm.org/D123115
2022-04-07 12:09:47 +02:00

37 lines
980 B
C++

// RUN: %clang_cc1 -no-opaque-pointers -triple=i386-pc-solaris2.11 -w -emit-llvm %s -o - | FileCheck %s
extern "C" {
struct statvfs64 {
int f;
};
#pragma redefine_extname statvfs64 statvfs
int statvfs64(struct statvfs64 *);
}
void some_func() {
struct statvfs64 st;
statvfs64(&st);
// Check that even if there is a structure with redefined name before the
// pragma, subsequent function name redefined properly. PR5172, Comment 11.
// CHECK: call i32 @statvfs(%struct.statvfs64* noundef %st)
}
// This is a case when redefenition is deferred *and* we have a local of the
// same name. PR23923.
#pragma redefine_extname foo bar
int f() {
int foo = 0;
return foo;
}
extern "C" {
int foo() { return 1; }
// CHECK: define{{.*}} i32 @bar()
}
// Check that #pragma redefine_extname applies to C code only, and shouldn't be
// applied to C++.
#pragma redefine_extname foo_cpp bar_cpp
extern int foo_cpp() { return 1; }
// CHECK-NOT: define{{.*}} i32 @bar_cpp()