[llvm] r243764 - DI: Rewrite the DIBuilder local variable API

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Jul 31 12:05:46 PDT 2015


+random people that hack on Go bindings

> On 2015-Jul-31, at 10:55, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> Author: dexonsmith
> Date: Fri Jul 31 12:55:53 2015
> New Revision: 243764
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=243764&view=rev
> Log:
> DI: Rewrite the DIBuilder local variable API
> 
> Replace the general `createLocalVariable()` with two more specific
> functions: `createParameterVariable()` and `createAutoVariable()`, and
> rewrite the documentation.
> 
> Besides cleaning up the API, this avoids exposing the fake DWARF tags
> `DW_TAG_arg_variable` and `DW_TAG_auto_variable` to frontends, and is
> preparation for removing them completely.
> 
> Modified:
>    llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
>    llvm/trunk/docs/tutorial/LangImpl8.rst
>    llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
>    llvm/trunk/include/llvm/IR/DIBuilder.h
>    llvm/trunk/lib/IR/DIBuilder.cpp
>    llvm/trunk/unittests/Transforms/Utils/Cloning.cpp
> 
> Modified: llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp?rev=243764&r1=243763&r2=243764&view=diff
> ==============================================================================
> --- llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp (original)
> +++ llvm/trunk/bindings/go/llvm/DIBuilderBindings.cpp Fri Jul 31 12:55:53 2015
> @@ -84,13 +84,18 @@ LLVMMetadataRef LLVMDIBuilderCreateFunct
> }
> 
> LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
> -    LLVMDIBuilderRef Dref, unsigned Tag, LLVMMetadataRef Scope,
> +    LLVMDIBuilderRef Dref, unsigned, LLVMMetadataRef Scope,
>     const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
>     int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
>   DIBuilder *D = unwrap(Dref);
> -  return wrap(D->createLocalVariable(
> -      Tag, unwrap<DIScope>(Scope), Name, unwrap<DIFile>(File), Line,
> -      unwrap<DIType>(Ty), AlwaysPreserve, Flags, ArgNo));
> +  // FIXME: Update the Go bindings to match the DIBuilder API.

FYI.

This API still works, but I expect you'll want to update the
bindings to better match `DIBuilder`?

> +  if (ArgNo)
> +    return wrap(D->createParameterVariable(
> +        unwrap<DIScope>(Scope), Name, ArgNo, unwrap<DIFile>(File), Line,
> +        unwrap<DIType>(Ty), AlwaysPreserve, Flags));
> +  return wrap(D->createAutoVariable(unwrap<DIScope>(Scope), Name,
> +                                    unwrap<DIFile>(File), Line,
> +                                    unwrap<DIType>(Ty), AlwaysPreserve, Flags));
> }
> 
> LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
> 





More information about the llvm-commits mailing list