r228066 - PR22419: Give implicit sized deallocation functions default visibility
Justin Bogner
mail at justinbogner.com
Tue Feb 3 16:20:04 PST 2015
Larisse Voufo <lvoufo at google.com> writes:
> Author: lvoufo
> Date: Tue Feb 3 17:31:50 2015
> New Revision: 228066
>
> URL: http://llvm.org/viewvc/llvm-project?rev=228066&view=rev
> Log:
> PR22419: Give implicit sized deallocation functions default visibility
>
> Added:
> cfe/trunk/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp
> Modified:
> cfe/trunk/lib/AST/Decl.cpp
>
> Modified: cfe/trunk/lib/AST/Decl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=228066&r1=228065&r2=228066&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/Decl.cpp (original)
> +++ cfe/trunk/lib/AST/Decl.cpp Tue Feb 3 17:31:50 2015
> @@ -666,7 +666,12 @@ static LinkageInfo getLVForNamespaceScop
> // 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.
80-column please.
> + globalVisibility = DefaultVisibility;
> + else
> + globalVisibility = Context.getLangOpts().getValueVisibilityMode();
> } else {
> assert(computation == LVForType);
> globalVisibility = Context.getLangOpts().getTypeVisibilityMode();
>
> Added: cfe/trunk/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp?rev=228066&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp Tue Feb 3 17:31:50 2015
> @@ -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
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list