r263429 - [Frontend] Disable value name discarding for all sanitizers.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 09:50:03 PDT 2016


On 14 Mar 2016 6:28 a.m., "Benjamin Kramer via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:
>
> Author: d0k
> Date: Mon Mar 14 08:23:58 2016
> New Revision: 263429
>
> URL: http://llvm.org/viewvc/llvm-project?rev=263429&view=rev
> Log:
> [Frontend] Disable value name discarding for all sanitizers.
>
> ASan also relies on names on allocas and will emit unhelpful output if
> they're not present. Just force-enable value names for now. Should
> unbreak release builds of asan.
>
> Modified:
>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=263429&r1=263428&r2=263429&view=diff
>
==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Mar 14 08:23:58 2016
> @@ -541,6 +541,7 @@ static bool ParseCodeGenArgs(CodeGenOpti
>    Opts.DisableFPElim =
>        (Args.hasArg(OPT_mdisable_fp_elim) || Args.hasArg(OPT_pg));
>    Opts.DisableFree = Args.hasArg(OPT_disable_free);
> +  Opts.DiscardValueNames = Args.hasArg(OPT_discard_value_names);
>    Opts.DisableTailCalls = Args.hasArg(OPT_mdisable_tail_calls);
>    Opts.FloatABI = Args.getLastArgValue(OPT_mfloat_abi);
>    if (Arg *A = Args.getLastArg(OPT_meabi)) {
> @@ -793,12 +794,6 @@ static bool ParseCodeGenArgs(CodeGenOpti
>    Opts.CudaGpuBinaryFileNames =
>        Args.getAllArgValues(OPT_fcuda_include_gpubinary);
>
> -  // DiscardValueNames is set here so that it can depend (perhaps
temporarily)
> -  // on other options.
> -  // We check SanitizeMemoryTrackOrigins here because the backend pass
depends
> -  // on the name of the alloca in order to print out names.
> -  Opts.DiscardValueNames =
> -      Args.hasArg(OPT_discard_value_names) &&
!Opts.SanitizeMemoryTrackOrigins;
>    return Success;
>  }
>
> @@ -2158,6 +2153,12 @@ bool CompilerInvocation::CreateFromArgs(
>      if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
>        Res.getLangOpts()->ObjCExceptions = 1;
>    }
> +
> +  // FIXME: Override value name discarding when sanitizers are used
because the
> +  // backend passes depend on the name of the alloca in order to print
out
> +  // names.
> +  Res.getCodeGenOpts().DiscardValueNames &=
Res.getLangOpts()->Sanitize.empty();

This should not be applied to all sanitizers. UBSan checks have no need of
this (there is no backend pass).

>    // FIXME: ParsePreprocessorArgs uses the FileManager to read the
contents of
>    // PCH file and find the original header name. Remove the need to do
that in
>    // ParsePreprocessorArgs and remove the FileManager
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160314/dc372517/attachment.html>


More information about the cfe-commits mailing list