r228066 - PR22419: Give implicit sized deallocation functions default visibility

Juergen Ributzka juergen at apple.com
Tue Feb 3 17:14:18 PST 2015


Hi Larisse,

the unit test is a little too restrictive and is failing on my system (OS X):
/x/src/trunk/clang/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp:10:16: error: expected string not found in input
 // CHECK-DAG: call void @_ZdlPvm(i8* %1, i64 4)
               ^
<stdin>:1:1: note: scanning from here
; ModuleID = '/x/src/trunk/clang/test/CodeGenCXX/cxx14-implicit-sized-delete.cpp'
^
<stdin>:17:2: note: possible intended match here
 call void @_ZdlPvm(i8* %5, i64 4) #2
 ^

—Juergen

> On Feb 3, 2015, at 3:31 PM, Larisse Voufo <lvoufo at google.com> wrote:
> 
> 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.
> +          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