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

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 02:47:03 PDT 2016


On Mon, Mar 14, 2016 at 5:50 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> 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).

Fair enough. r263541 only does this when asan or msan is enabled.

>
>>    // 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


More information about the cfe-commits mailing list