mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 20:46:06 +00:00

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
27 lines
709 B
C++
27 lines
709 B
C++
// RUN: %clang_cc1 -no-opaque-pointers -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -std=c++11 -o - | FileCheck %s
|
|
struct A { virtual ~A(); };
|
|
struct B final : A { };
|
|
struct C { virtual ~C(); int c; };
|
|
|
|
// CHECK: @_Z1fP1B
|
|
C *f(B* b) {
|
|
// CHECK-NOT: call i8* @__dynamic_cast
|
|
// CHECK: ret %struct.C* null
|
|
return dynamic_cast<C*>(b);
|
|
}
|
|
|
|
// CHECK: @_Z1fR1B
|
|
C &f(B& b) {
|
|
// CHECK-NOT: call i8* @__dynamic_cast
|
|
// CHECK: call void @__cxa_bad_cast() [[NR:#[0-9]+]]
|
|
// CHECK: ret %struct.C* undef
|
|
return dynamic_cast<C&>(b);
|
|
}
|
|
|
|
void dont_crash() {
|
|
(void) dynamic_cast<void*>((A*)0);
|
|
(void) dynamic_cast<void*>((B*)0);
|
|
}
|
|
|
|
// CHECK: attributes [[NR]] = { noreturn }
|