[RFC] Always using the diagnostic handler in the LLVMContext

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 15:02:07 PST 2015


Thanks! LGTM.

— 
Mehdi

> On Dec 10, 2015, at 2:19 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> This is not really nice, but probably unavoidable, at least document.
>> 
> 
> Done.
> 
> 
> 
> ===>
>> @@ -579,6 +559,12 @@ void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
>>       return;
>>     ComputeDiagID(Severity, backend_frame_larger_than, DiagID);
>>     break;
>> +  case DK_Linker:
>> 
>> 
>> assert(CurLinkModule)
> 
> Done
> 
> 
>> +  ErrorOr<std::unique_ptr<Module>> ModuleOrErr = parseBitcodeFile(Buf, Ctx);
>> +
>> +  Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext, true);
>> 
>> 
>> 
>> If it is something that needs to be done in other places, some RAII handler would be nice, if it is the only place, OK.
> 
> 
> Given that we have to process the ErorOr anyway I don't think an RAII
> adds much in here.
> 
>> -static void expectNoDiags(const DiagnosticInfo &DI) { EXPECT_TRUE(false); }
>> -
>> 
>> 
>> Is there the same one already present on the Context?
> 
> No. Fixed.
> 
> Cheers,
> Rafael
> <llvm.diff><clang.diff>



More information about the llvm-commits mailing list