forked from OSchip/llvm-project
PR22419: Give implicit sized deallocation functions default visibility
llvm-svn: 228066
This commit is contained in:
parent
64b2a2628f
commit
fce61d3fc8
|
@ -666,7 +666,12 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
|
|||
// Use global type/value visibility as appropriate.
|
||||
Visibility globalVisibility;
|
||||
if (computation == LVForValue) {
|
||||
globalVisibility = Context.getLangOpts().getValueVisibilityMode();
|
||||
const FunctionDecl *FD = D->getAsFunction();
|
||||
if (FD && FD->getCorrespondingUnsizedGlobalDeallocationFunction())
|
||||
// C++14's implicit sized deallocation functions always have default visibility.
|
||||
globalVisibility = DefaultVisibility;
|
||||
else
|
||||
globalVisibility = Context.getLangOpts().getValueVisibilityMode();
|
||||
} else {
|
||||
assert(computation == LVForType);
|
||||
globalVisibility = Context.getLangOpts().getTypeVisibilityMode();
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++14 %s 2>&1 | FileCheck %s -check-prefix=CHECKDEF -check-prefix=CHECK
|
||||
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - -std=c++14 -fvisibility hidden %s 2>&1 | FileCheck %s -check-prefix=CHECKHID -check-prefix=CHECK
|
||||
|
||||
// PR22419: Implicit sized deallocation functions always have default visibility.
|
||||
|
||||
// CHECKDEF-DAG: define void @_Z3fooPi(i32* %is)
|
||||
// CHECKHID-DAG: define hidden void @_Z3fooPi(i32* %is)
|
||||
void foo(int* is) {
|
||||
|
||||
// CHECK-DAG: call void @_ZdlPvm(i8* %1, i64 4)
|
||||
delete is;
|
||||
}
|
||||
|
||||
// CHECK-DAG: define linkonce void @_ZdlPvm(i8*, i64)
|
||||
|
||||
// CHECK-DAG: %struct.A = type { i8 }
|
||||
struct A { ~A() { }};
|
||||
|
||||
// CHECKDEF-DAG: define void @_Z1fP1A(%struct.A* %p)
|
||||
// CHECKHID-DAG: define hidden void @_Z1fP1A(%struct.A* %p)
|
||||
void f(A *p) {
|
||||
|
||||
// CHECK-DAG: call void @_ZdaPvm(i8* %2, i64 %6)
|
||||
delete[] p;
|
||||
}
|
||||
|
||||
// CHECK-DAG: define linkonce void @_ZdaPvm(i8*, i64)
|
Loading…
Reference in New Issue