[Libclc-dev] [PATCH] prepare-builtins: Fix build with LLVM 3.5

Tom Stellard tom at stellard.net
Mon Jul 7 11:47:11 PDT 2014


On Mon, Jul 07, 2014 at 12:46:11PM -0500, Aaron Watry wrote:
> getFileOrSTDIN changed its 2nd argument from a ptr to a size and
> also changed its return type from an error code to ErrorOr<ptr>.
> 

Hi,

I just pushed a fix for this a few minutes ago, it should be working now.

-Tom

> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
>  utils/prepare-builtins.cpp | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
> index 20890ed..53e84e4 100644
> --- a/utils/prepare-builtins.cpp
> +++ b/utils/prepare-builtins.cpp
> @@ -47,16 +47,21 @@ int main(int argc, char **argv) {
>    std::auto_ptr<Module> M;
>  
>    {
> -    UNIQUE_PTR<MemoryBuffer> BufferPtr;
> -    if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
> -      ErrorMessage = ec.message();
> -    else {
>  #if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
> -      ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
> +    ErrorOr<UNIQUE_PTR<MemoryBuffer>> FileOrErr = MemoryBuffer::getFileOrSTDIN(InputFilename);
> +    if (FileOrErr.getError())
> +      ErrorMessage = FileOrErr.getError().message();
> +    else {
> +      ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(FileOrErr.get().get(), Context);
>        if (ERROR_CODE ec = ModuleOrErr.getError())
>          ErrorMessage = ec.message();
>        M.reset(ModuleOrErr.get());
>  #else
> +    UNIQUE_PTR<MemoryBuffer> BufferPtr;
> +    ERROR_CODE ec;
> +    if (ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
> +      ErrorMessage = ec.message();
> +    else {
>        M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
>  #endif
>      }
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev




More information about the Libclc-dev mailing list