From: Fariborz Jahanian Date: Wed, 29 Jun 2011 18:41:17 +0000 (+0000) Subject: Use existing -fcatch-undefined-behavior option, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d9b6bf9de98a33427fc7a3beeca90a3002b4744;p=clang Use existing -fcatch-undefined-behavior option, replacing -freset-local-blocks. // rdar://9227352 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134082 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/LangOptions.h b/include/clang/Basic/LangOptions.h index e99d872209..7eda0aa3fd 100644 --- a/include/clang/Basic/LangOptions.h +++ b/include/clang/Basic/LangOptions.h @@ -72,7 +72,6 @@ public: unsigned POSIXThreads : 1; // Compiling with POSIX thread support // (-pthread) unsigned Blocks : 1; // block extension to C - unsigned ResetLocalBlocks : 1; // reset local blocks going out of scope unsigned EmitAllDecls : 1; // Emit all declarations, even if // they are unused. unsigned MathErrno : 1; // Math functions must respect errno @@ -199,7 +198,7 @@ public: ThreadsafeStatics = 1; POSIXThreads = 0; - Blocks = ResetLocalBlocks = 0; + Blocks = 0; EmitAllDecls = 0; MathErrno = 1; SignedOverflowBehavior = SOB_Undefined; diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 6b580670a6..653f346b9e 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -444,8 +444,6 @@ def femit_all_decls : Flag<"-femit-all-decls">, HelpText<"Emit all declarations, even if unused">; def fblocks : Flag<"-fblocks">, HelpText<"enable the 'blocks' language feature">; -def freset_local_blocks : Flag<"-freset-local-blocks">, - HelpText<"reset local blocks when they go out of scope">; def fheinous_gnu_extensions : Flag<"-fheinous-gnu-extensions">; def fexceptions : Flag<"-fexceptions">, HelpText<"Enable support for exception handling">; diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 3806240ae1..c696548448 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -259,7 +259,6 @@ def fastf : Flag<"-fastf">, Group; def fast : Flag<"-fast">, Group; def fasynchronous_unwind_tables : Flag<"-fasynchronous-unwind-tables">, Group; def fblocks : Flag<"-fblocks">, Group; -def freset_local_blocks : Flag<"-freset-local-blocks">, Group; def fbootclasspath_EQ : Joined<"-fbootclasspath=">, Group; def fborland_extensions : Flag<"-fborland-extensions">, Group; def fbuiltin_strcat : Flag<"-fbuiltin-strcat">, Group; diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 20b5c9bed0..3488f2edb7 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -665,7 +665,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const BlockExpr *blockExpr) { llvm::Value *result = Builder.CreateBitCast(blockAddr, ConvertType(blockInfo.getBlockExpr()->getType())); - if (getLangOptions().ResetLocalBlocks) + if (getLangOptions().CatchUndefined) EHStack.pushCleanup(NormalCleanup, blockAddr, blockInfo.BlockSize); diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index d384c2b739..41be873b35 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1709,8 +1709,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, !Args.hasArg(options::OPT_fno_blocks))) { CmdArgs.push_back("-fblocks"); } - if (Args.hasArg(options::OPT_freset_local_blocks)) - CmdArgs.push_back("-freset-local-blocks"); // -faccess-control is default. if (Args.hasFlag(options::OPT_fno_access_control, diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index f2ca212b3a..12e51a61e1 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -638,8 +638,6 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-pthread"); if (Opts.Blocks) Res.push_back("-fblocks"); - if (Opts.ResetLocalBlocks) - Res.push_back("-freset-local-blocks"); if (Opts.EmitAllDecls) Res.push_back("-femit-all-decls"); if (Opts.MathErrno) @@ -1614,7 +1612,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.RTTI = !Args.hasArg(OPT_fno_rtti); Opts.Blocks = Args.hasArg(OPT_fblocks); - Opts.ResetLocalBlocks = Args.hasArg(OPT_freset_local_blocks); Opts.CharIsSigned = !Args.hasArg(OPT_fno_signed_char); Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar); Opts.ShortEnums = Args.hasArg(OPT_fshort_enums); diff --git a/test/CodeGen/reset-local-block.c b/test/CodeGen/reset-local-block.c index 01b8828a82..6a7262f67e 100644 --- a/test/CodeGen/reset-local-block.c +++ b/test/CodeGen/reset-local-block.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -freset-local-blocks -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fcatch-undefined-behavior -o - %s | FileCheck %s // rdar://9227352 typedef int (^BLOCK)();