[PATCH] PR22419
Larisse Voufo
lvoufo at gmail.com
Tue Feb 3 14:40:19 PST 2015
Hi rsmith,
I think this is good to go. I just want a quick-check to make sure I have not overlooked anything.
http://reviews.llvm.org/D7392
Files:
lib/AST/Decl.cpp
test/CodeGenCXX/cxx14-implicit-sized-delete.cpp
Index: lib/AST/Decl.cpp
===================================================================
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -666,7 +666,12 @@
// 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();
Index: test/CodeGenCXX/cxx14-implicit-sized-delete.cpp
===================================================================
--- /dev/null
+++ test/CodeGenCXX/cxx14-implicit-sized-delete.cpp
@@ -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)
\ No newline at end of file
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7392.19274.patch
Type: text/x-patch
Size: 2071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150203/23c0aa1a/attachment.bin>
More information about the llvm-commits
mailing list