From 89088232b20f77fd240ebe5b709274c109aca3e1 Mon Sep 17 00:00:00 2001 From: Larisse Voufo Date: Fri, 20 Feb 2015 02:07:22 +0000 Subject: [PATCH] Add -fno-sized-deallocation option for completeness of fix in r229241 in documentation in r229818. llvm-svn: 229950 --- clang/include/clang/Driver/Options.td | 4 +++- clang/lib/Driver/Tools.cpp | 4 ++++ clang/lib/Frontend/CompilerInvocation.cpp | 1 + clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp | 1 + clang/test/CodeGenCXX/implicit-allocation-functions.cpp | 1 + clang/test/CodeGenCXX/pr21754.cpp | 4 +--- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 80f68ef..221f545 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -394,8 +394,10 @@ def fasm_blocks : Flag<["-"], "fasm-blocks">, Group, Flags<[CC1Option]> def fno_asm_blocks : Flag<["-"], "fno-asm-blocks">, Group; def fassume_sane_operator_new : Flag<["-"], "fassume-sane-operator-new">, Group; +def fno_sized_deallocation: Flag<["-"], "fno-sized-deallocation">, Group, + HelpText<"Disable sized deallocation functions">, Flags<[CC1Option]>; def fdefine_sized_deallocation: Flag<["-"], "fdefine-sized-deallocation">, Group, - HelpText<"Allow compiler-generated definition of sized deallocation function">, Flags<[CC1Option]>; + HelpText<"Allow compiler-generated definition of sized deallocation functions">, Flags<[CC1Option]>; def fastcp : Flag<["-"], "fastcp">, Group; def fastf : Flag<["-"], "fastf">, Group; def fast : Flag<["-"], "fast">, Group; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index f47a92b..fc6773d 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -4213,6 +4213,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_assume_sane_operator_new)) CmdArgs.push_back("-fno-assume-sane-operator-new"); + // -fno-sized-deallocation: disable sized delete. + if (Args.hasArg(options::OPT_fno_sized_deallocation)) + CmdArgs.push_back("-fno-sized-deallocation"); + // -fdefine-sized-deallocation: default implementation of sized delete as a // weak definition. if (Args.hasArg(options::OPT_fdefine_sized_deallocation)) diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index edfee21..4c1ac0a 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1522,6 +1522,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin); Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new); Opts.SizedDeallocation |= Args.hasArg(OPT_fsized_deallocation); + Opts.SizedDeallocation &= !Args.hasArg(OPT_fno_sized_deallocation); Opts.DefineSizedDeallocation = Opts.SizedDeallocation && Args.hasArg(OPT_fdefine_sized_deallocation); Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); diff --git a/clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp b/clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp index 2daf28c..9f26fa5 100644 --- a/clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp +++ b/clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -std=c++11 -fsized-deallocation %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKUND // RUN: %clang_cc1 -std=c++11 -fsized-deallocation -fdefine-sized-deallocation %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECKDEF // RUN: %clang_cc1 -std=c++11 %s -emit-llvm -triple x86_64-linux-gnu -o - | FileCheck %s --check-prefix=CHECK-UNSIZED +// RUN: %clang_cc1 -std=c++1y %s -emit-llvm -triple x86_64-linux-gnu -fno-sized-deallocation -o - | FileCheck %s --check-prefix=CHECK-UNSIZED // CHECK-UNSIZED-NOT: _ZdlPvm // CHECK-UNSIZED-NOT: _ZdaPvm diff --git a/clang/test/CodeGenCXX/implicit-allocation-functions.cpp b/clang/test/CodeGenCXX/implicit-allocation-functions.cpp index 8988e94..3bac6b9 100644 --- a/clang/test/CodeGenCXX/implicit-allocation-functions.cpp +++ b/clang/test/CodeGenCXX/implicit-allocation-functions.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++11 %s 2>&1 | FileCheck %s -check-prefix=CHECKDEF -check-prefix=CHECK11 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++11 -fvisibility hidden %s 2>&1 | FileCheck %s -check-prefix=CHECKHID -check-prefix=CHECK11 +// RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++14 -fno-sized-deallocation %s 2>&1 | FileCheck %s -check-prefix=CHECKDEF -check-prefix=CHECK11 // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++14 %s 2>&1 | FileCheck %s -check-prefix=CHECKDEF -check-prefix=CHECK14 -check-prefix=CHECK14UND // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++14 -fvisibility hidden %s 2>&1 | FileCheck %s -check-prefix=CHECKHID -check-prefix=CHECK14 -check-prefix=CHECK14UND // RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-unknown -o - -std=c++14 -fdefine-sized-deallocation %s 2>&1 | FileCheck %s -check-prefix=CHECKDEF -check-prefix=CHECK14 -check-prefix=CHECK14DEFCOMDAT diff --git a/clang/test/CodeGenCXX/pr21754.cpp b/clang/test/CodeGenCXX/pr21754.cpp index 295dbfe..65ee765 100644 --- a/clang/test/CodeGenCXX/pr21754.cpp +++ b/clang/test/CodeGenCXX/pr21754.cpp @@ -1,12 +1,10 @@ // RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++1y -o - %s 2>&1 | FileCheck %s // RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++1y -fdefine-sized-deallocation -o - %s 2>&1 | FileCheck %s +// RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++1y -fno-sized-deallocation -o - %s 2>&1 | FileCheck %s // RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11 -fsized-deallocation -o - %s 2>&1 | FileCheck %s // RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11 -fsized-deallocation -fdefine-sized-deallocation -o - %s 2>&1 | FileCheck %s // RUN: %clang -cc1 -emit-llvm -triple x86_64-unknown-unknown -std=c++11 -o - %s 2>&1 | FileCheck %s -// 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) {} -- 2.7.4