r229291 - More on fixing sized deallocation implementation logic: Fix PR21754.

Nick Lewycky nlewycky at google.com
Sun Feb 15 12:00:02 PST 2015


On 15 February 2015 at 00:16, Larisse Voufo <lvoufo at google.com> wrote:

> Author: lvoufo
> Date: Sun Feb 15 02:16:37 2015
> New Revision: 229291
>
> URL: http://llvm.org/viewvc/llvm-project?rev=229291&view=rev
> Log:
> More on fixing sized deallocation implementation logic: Fix PR21754.
>
> Added:
>     cfe/trunk/test/CodeGenCXX/pr21754.cpp
> Modified:
>     cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=229291&r1=229290&r2=229291&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sun Feb 15 02:16:37 2015
> @@ -1617,11 +1617,14 @@ CodeGenModule::GetOrCreateLLVMFunction(S
>        DeferredDecls.erase(DDI);
>
>        // Otherwise, if this is a sized deallocation function, emit a weak
> -      // definition for it at the end of the translation unit.
> -    } else if (D && cast<FunctionDecl>(D)
> -
> ->getCorrespondingUnsizedGlobalDeallocationFunction()) {
> -      if (getLangOpts().DefaultSizedDelete)
> -        addDeferredDeclToEmit(F, GD);
> +      // definition for it at the end of the translation unit (if
> allowed),
> +      // unless the sized deallocation function is aliased.
> +    } else if (D &&
> +               cast<FunctionDecl>(D)
> +                  ->getCorrespondingUnsizedGlobalDeallocationFunction() &&
> +               !getLangOpts().DefaultSizedDelete &&
> +               !D->hasAttr<AliasAttr>()) {
> +      addDeferredDeclToEmit(F, GD);
>
>        // Otherwise, there are cases we have to worry about where we're
>        // using a declaration for which we must emit a definition but where
>
> Added: cfe/trunk/test/CodeGenCXX/pr21754.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pr21754.cpp?rev=229291&view=auto
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/pr21754.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/pr21754.cpp Sun Feb 15 02:16:37 2015
> @@ -0,0 +1,13 @@
> +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++1y
> %s -o -
> +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++1y
> %s -fdef-sized-delete -o -
> +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11
> -fsized-deallocation %s -o -
> +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11
> -fsized-deallocation -fdef-sized-delete %s -o -
> +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11
> %s -o -
>

Don't all these RUN lines need a " | FileCheck" on the end?

+
> +// CHECK-UNSIZED-NOT: _ZdlPvm
> +// CHECK-UNSIZED-NOT: _ZdaPvm
> +
> +void operator delete(void*, unsigned long) throw()
> __attribute__((alias("foo")));
> +extern "C" void foo(void*, unsigned long) {}
> +
> +// CHECK-DAG: @_ZdlPvm = alias void (i8*, i64)* @my_delete
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150215/3b2c6c5b/attachment.html>


More information about the cfe-commits mailing list