[llvm] r253553 - gold-plugin.cpp: Fix diagnosticHandler corresponding to r253540.

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 07:46:06 PST 2015


Thanks for the fix. I remove the unused LLVMContext parameter in getFunctionIndexForFile() as a follow-up in r253569.

— 
Mehdi

> On Nov 19, 2015, at 6:09 AM, Teresa Johnson via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> LGTM, thanks for the fix
> Teresa
> 
> On Thu, Nov 19, 2015 at 2:43 AM, NAKAMURA Takumi via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: chapuni
>> Date: Thu Nov 19 04:43:44 2015
>> New Revision: 253553
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=253553&view=rev
>> Log:
>> gold-plugin.cpp: Fix diagnosticHandler corresponding to r253540.
>> 
>> Modified:
>>    llvm/trunk/tools/gold/gold-plugin.cpp
>> 
>> Modified: llvm/trunk/tools/gold/gold-plugin.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=253553&r1=253552&r2=253553&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/gold/gold-plugin.cpp (original)
>> +++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Nov 19 04:43:44 2015
>> @@ -297,7 +297,7 @@ static bool shouldSkip(uint32_t Symflags
>>   return false;
>> }
>> 
>> -static void diagnosticHandler(const DiagnosticInfo &DI, void *Context) {
>> +static void diagnosticHandler(const DiagnosticInfo &DI) {
>>   if (const auto *BDI = dyn_cast<BitcodeDiagnosticInfo>(&DI)) {
>>     std::error_code EC = BDI->getError();
>>     if (EC == BitcodeError::InvalidBitcodeSignature)
>> @@ -327,6 +327,11 @@ static void diagnosticHandler(const Diag
>>   message(Level, "LLVM gold plugin: %s",  ErrStorage.c_str());
>> }
>> 
>> +static void diagnosticHandlerForContext(const DiagnosticInfo &DI,
>> +                                        void *Context) {
>> +  diagnosticHandler(DI);
>> +}
>> +
>> /// Called by gold to see whether this file is one that our plugin can handle.
>> /// We'll try to open it and register all the symbols with add_symbol if
>> /// possible.
>> @@ -361,7 +366,7 @@ static ld_plugin_status claim_file_hook(
>>     BufferRef = Buffer->getMemBufferRef();
>>   }
>> 
>> -  Context.setDiagnosticHandler(diagnosticHandler);
>> +  Context.setDiagnosticHandler(diagnosticHandlerForContext);
>>   ErrorOr<std::unique_ptr<object::IRObjectFile>> ObjOrErr =
>>       object::IRObjectFile::create(BufferRef, Context);
>>   std::error_code EC = ObjOrErr.getError();
>> @@ -617,7 +622,7 @@ getFunctionIndexForFile(LLVMContext &Con
>>   MemoryBufferRef BufferRef(StringRef((const char *)View, Info.filesize),
>>                             Info.name);
>>   ErrorOr<std::unique_ptr<object::FunctionIndexObjectFile>> ObjOrErr =
>> -      object::FunctionIndexObjectFile::create(BufferRef, Context);
>> +      object::FunctionIndexObjectFile::create(BufferRef, diagnosticHandler);
>> 
>>   if (std::error_code EC = ObjOrErr.getError())
>>     message(LDPL_FATAL, "Could not read function index bitcode from file : %s",
>> @@ -892,7 +897,7 @@ static ld_plugin_status allSymbolsReadHo
>>     return LDPS_OK;
>> 
>>   LLVMContext Context;
>> -  Context.setDiagnosticHandler(diagnosticHandler, nullptr, true);
>> +  Context.setDiagnosticHandler(diagnosticHandlerForContext, nullptr, true);
>> 
>>   // If we are doing ThinLTO compilation, simply build the combined
>>   // function index/summary and emit it. We don't need to parse the modules
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 
> 
> 
> -- 
> Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list