From b47c36f8e113f238124fa00ae7d444d02f5b470e Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 5 Nov 2013 09:12:18 +0000 Subject: C++1y sized deallocation: if we have a use, but not a definition, of a sized deallocation function (and the corresponding unsized deallocation function has been declared), emit a weak discardable definition of the function that forwards to the corresponding unsized deallocation. This allows a C++ standard library implementation to provide both a sized and an unsized deallocation function, where the unsized one does not just call the sized one, for instance by putting both in the same object file within an archive. llvm-svn: 194055 --- clang/lib/Frontend/CompilerInvocation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 3da8ba7309a..a523acfc431 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1093,6 +1093,9 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK, Opts.Trigraphs = !Opts.GNUMode; Opts.DollarIdents = !Opts.AsmPreprocessor; + + // C++1y onwards has sized global deallocation functions. + Opts.SizedDeallocation = Opts.CPlusPlus1y; } /// Attempt to parse a visibility value out of the given argument. @@ -1310,7 +1313,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding; 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_fsized_deallocation); Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); -- cgit v1.2.3