[Mesa-dev] [PATCH 1/1] clover: Fix build after LLVM r313390

Jan Vesely jan.vesely at rutgers.edu
Sat Sep 16 01:41:53 UTC 2017


On Fri, 2017-09-15 at 17:59 -0700, Francisco Jerez wrote:
> Jan Vesely <jan.vesely at rutgers.edu> writes:
> 
> > On Fri, 2017-09-15 at 17:48 -0700, Francisco Jerez wrote:
> > > Jan Vesely <jan.vesely at rutgers.edu> writes:
> > > 
> > > > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > > > ---
> > > >  src/gallium/state_trackers/clover/llvm/compat.hpp     | 10 ++++++++++
> > > >  src/gallium/state_trackers/clover/llvm/invocation.cpp |  2 +-
> > > >  2 files changed, 11 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/src/gallium/state_trackers/clover/llvm/compat.hpp b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > > > index b22ecfa6b2..9bca6d82e8 100644
> > > > --- a/src/gallium/state_trackers/clover/llvm/compat.hpp
> > > > +++ b/src/gallium/state_trackers/clover/llvm/compat.hpp
> > > > @@ -198,6 +198,16 @@ namespace clover {
> > > >                 f(mod.getError().message());
> > > >  #endif
> > > >           }
> > > > +
> > > > +        template<typename T> void
> > > > +        set_diagnostic_handler(::llvm::LLVMContext *ctx,
> > > > +                               T *diagnostic_handler, void *data) {
> > > > +#if HAVE_LLVM >= 0x0600
> > > > +           ctx->setDiagnosticHandlerCallBack(diagnostic_handler, data);
> > > > +#else
> > > > +           ctx->setDiagnosticHandler(diagnostic_handler, data);
> > > > +#endif
> > > > +        }
> > > >        }
> > > >     }
> > > >  }
> > > > diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > > > index 6412377faa..2aad960bb7 100644
> > > > --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > > > +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> > > > @@ -89,7 +89,7 @@ namespace {
> > > >     create_context(std::string &r_log) {
> > > >        init_targets();
> > > >        std::unique_ptr<LLVMContext> ctx { new LLVMContext };
> > > > -      ctx->setDiagnosticHandler(diagnostic_handler, &r_log);
> > > > +      compat::set_diagnostic_handler(ctx.get(), diagnostic_handler, &r_log);
> > > 
> > > Would rather pass the first argument by reference here like '*ctx' since
> > > it should always be non-null.
> > 
> > would you prefer a reference to ctx, or reference to unique_ptr?
> > 
> 
> To LLVMContext, because that works regardless of whether the caller has
> a unique_ptr to the object or not.

makes sense. Fixed locally and pushed.

thanks,
Jan

> 
> > Jan
> > 
> > > Other than that:
> > > 
> > > Reviewed-by: Francisco Jerez <currojerez at riseup.net>
> > > 
> > > Thanks.
> > > 
> > > >        return ctx;
> > > >     }
> > > >  
> > > > -- 
> > > > 2.13.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170915/c3ecaddb/attachment.sig>


More information about the mesa-dev mailing list