llvm-c patch for atomicrmw & dibuilder

Carlo Kok ck at remobjects.com
Tue Apr 23 07:36:46 PDT 2013


Op 23-4-2013 01:14, Eric Christopher schreef:
> OK, I've committed my patch. You'll need to rebase and make some
> changes to your current set of patches so that we keep the C++ out of
> the C headers.
>

Attached is an updated DIBuilder; I didn't put the c++ stuff in "Wrap.h" 
as this was the only file using them, let me know if this is ok, I'll 
commit then.

--
Carlo Kok

-------------- next part --------------
Index: include/llvm-c/DIBuilder.h
===================================================================
--- include/llvm-c/DIBuilder.h	(revision 0)
+++ include/llvm-c/DIBuilder.h	(working copy)
@@ -0,0 +1,495 @@
+/*===-- llvm-c/DIBuilder.h - Debug Info Builder C Interface -------*- C -*-===*\
+|*                                                                            *|
+|*                     The LLVM Compiler Infrastructure                       *|
+|*                                                                            *|
+|* This file is distributed under the University of Illinois Open Source      *|
+|* License. See LICENSE.TXT for details.                                      *|
+|*                                                                            *|
+|*===----------------------------------------------------------------------===*|
+|*                                                                            *|
+|* This header declares the C interface to libLLVMCore.a, which implements    *|
+|* the LLVM intermediate representation.                                      *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef LLVM_C_DIBUILDER_H
+#define LLVM_C_DIBUILDER_H
+
+#include "llvm/Support/DataTypes.h"
+
+#ifdef __cplusplus
+
+#include "llvm-c/Core.h"
+#include "llvm-c/BitReader.h"
+#include "llvm/DebugInfo.h"
+#include "llvm/DIBuilder.h"
+
+
+extern "C" {
+#endif
+
+/**
+ * @defgroup LLVMC DIBuilder: C interface to DIBuilder
+ * @ingroup LLVMC
+ *
+ * @{
+ */
+
+typedef struct LLVMDIBuilder *LLVMDIBuilderRef;
+LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef module);
+void LLVMDestroyDIBuilder(LLVMDIBuilderRef builder);
+LLVMValueRef LLVMDIBuilderGetCU(LLVMDIBuilderRef builder);
+void LLVMDIBuilderFinalize(LLVMDIBuilderRef builder);
+
+/// createCompileUnit - A CompileUnit provides an anchor for all debugging
+/// information generated during this instance of compilation.
+/// @param Lang     Source programming language, eg. dwarf::DW_LANG_C99
+/// @param File     File name
+/// @param Dir      Directory
+/// @param Producer String identify producer of debugging information.
+///                 Usuall this is a compiler version string.
+/// @param isOptimized A boolean flag which indicates whether optimization
+///                    is ON or not.
+/// @param Flags    This string lists command line options. This string is
+///                 directly embedded in debug info output which may be used
+///                 by a tool analyzing generated debugging information.
+/// @param RV       This indicates runtime version for languages like
+///                 Objective-C.
+void LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef builder, unsigned Lang,
+                                    char *File, char *Dir, char *Producer,
+                                    LLVMBool isOptimized, char *Flags,
+                                    unsigned RV);
+/// createFile - Create a file descriptor to hold debugging information
+/// for a file.
+LLVMValueRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef builder, char *File,
+                                     char *Dir);
+/// createEnumerator - Create a single enumerator value.
+LLVMValueRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef builder, char *Name,
+                                           uint64_t Val);
+/// createNullPtrType - Create C++0x nullptr type.
+LLVMValueRef LLVMDIBuilderCreateNullPtr(LLVMDIBuilderRef builder, char *Name);
+/// createBasicType - Create debugging information entry for a basic
+void LLVMBuilderAssociatePosition(LLVMBuilderRef builder, int Row, int Col,
+                                  LLVMValueRef Scope);
+void LLVMBuilderDeassociatePosition(LLVMBuilderRef builder);
+/// createBasicType - Create debugging information entry for a basic
+/// type.
+/// @param Name        Type name.
+/// @param SizeInBits  Size of the type.
+/// @param AlignInBits Type alignment.
+/// @param Encoding    DWARF encoding code, e.g. dwarf::DW_ATE_float.
+LLVMValueRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef builder, char *Name,
+                                          uint64_t sizeInBits,
+                                          uint64_t alignInBits,
+                                          unsigned Encoding);
+/// createQualifiedType - Create debugging information entry for a qualified
+/// type, e.g. 'const int'.
+/// @param Tag         Tag identifing type, e.g. dwarf::TAG_volatile_type
+/// @param FromTy      Base Type.
+LLVMValueRef LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef builder,
+                                              unsigned Tag,
+                                              LLVMValueRef FromTy);
+/// createPointerType - Create debugging information entry for a pointer.
+/// @param PointeeTy   Type pointed by this pointer.
+/// @param SizeInBits  Size.
+/// @param AlignInBits Alignment. (optional)
+/// @param Name        Pointer type name. (optional)
+LLVMValueRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef builder,
+                                            LLVMValueRef pointeeTy,
+                                            uint64_t SizeInBits,
+                                            uint64_t AlignInBits);
+/// createReferenceType - Create debugging information entry for a c++
+/// style reference or rvalue reference type.
+LLVMValueRef LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef builder,
+                                              unsigned Tag, LLVMValueRef RTy);
+/// createTypedef - Create debugging information entry for a typedef.
+/// @param Ty          Original type.
+/// @param Name        Typedef name.
+/// @param File        File where this type is defined.
+/// @param LineNo      Line number.
+/// @param Context     The surrounding context for the typedef.
+LLVMValueRef LLVMDIBuilderCreateTypeDef(LLVMDIBuilderRef builder,
+                                        LLVMValueRef Ty, char *Name,
+                                        LLVMValueRef File, unsigned LineNo,
+                                        LLVMValueRef Context);
+/// createFriend - Create debugging information entry for a 'friend'.
+LLVMValueRef LLVMDIBuilderCreateFriend(LLVMDIBuilderRef builder,
+                                       LLVMValueRef Ty, LLVMValueRef FriendTy);
+/// createInheritance - Create debugging information entry to establish
+/// inheritance relationship between two types.
+/// @param Ty           Original type.
+/// @param BaseTy       Base type. Ty is inherits from base.
+/// @param BaseOffset   Base offset.
+/// @param Flags        Flags to describe inheritance attribute,
+///                     e.g. private
+LLVMValueRef LLVMDIBuilderCreateInheritence(LLVMDIBuilderRef builder,
+                                            LLVMValueRef Ty,
+                                            LLVMValueRef BaseTy,
+                                            uint64_t BaseOffset,
+                                            unsigned flags);
+/// createMemberType - Create debugging information entry for a member.
+/// @param Scope        Member scope.
+/// @param Name         Member name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param OffsetInBits Member offset.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Ty           Parent type.
+LLVMValueRef LLVMDIBuilderCreateMemberType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
+    uint64_t OffsetInBits, unsigned Flags, LLVMValueRef Ty);
+/// createObjCIVar - Create debugging information entry for Objective-C
+/// instance variable.
+/// @param Name         Member name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param OffsetInBits Member offset.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Ty           Parent type.
+/// @param PropertyName Name of the Objective C property assoicated with
+///                     this ivar.
+/// @param GetterName   Name of the Objective C property getter selector.
+/// @param SetterName   Name of the Objective C property setter selector.
+/// @param PropertyAttributes Objective C property attributes.
+LLVMValueRef LLVMDIBuilderCreateObjCIVar(
+    LLVMDIBuilderRef builder, char *name, LLVMValueRef File, unsigned LineNo,
+    uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
+    unsigned Flags, LLVMValueRef Ty, char *PropertyName,
+    char *PropertyGetterName, char *PropertySetterName,
+    unsigned PropertyAttributes);
+/// createObjCIVar - Create debugging information entry for Objective-C
+/// instance variable.
+/// @param Name         Member name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param OffsetInBits Member offset.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Ty           Parent type.
+/// @param Property     Property associated with this ivar.
+
+LLVMValueRef LLVMDIBuilderCreateObjCPropertyIVar(
+    LLVMDIBuilderRef builder, char *name, LLVMValueRef File, unsigned LineNo,
+    uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
+    unsigned Flags, LLVMValueRef Ty, LLVMValueRef Property);
+
+/// createObjCProperty - Create debugging information entry for Objective-C
+/// property.
+/// @param Name         Property name.
+/// @param File         File where this property is defined.
+/// @param LineNumber   Line number.
+/// @param GetterName   Name of the Objective C property getter selector.
+/// @param SetterName   Name of the Objective C property setter selector.
+/// @param PropertyAttributes Objective C property attributes.
+/// @param Ty           Type.
+LLVMValueRef LLVMDIBuilderCreateProperty(LLVMDIBuilderRef builder, char *Name,
+                                         LLVMValueRef File, unsigned LineNumber,
+                                         char *GetterName, char *SetterName,
+                                         unsigned PropertyAttributes,
+                                         LLVMValueRef Ty);
+/// createClassType - Create debugging information entry for a class.
+/// @param Scope        Scope in which this class is defined.
+/// @param Name         class name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param OffsetInBits Member offset.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Elements     class members.
+/// @param VTableHolder Debug info of the base class that contains vtable
+///                     for this type. This is used in
+///                     DW_AT_containing_type. See DWARF documentation
+///                     for more info.
+/// @param TemplateParms Template type parameters.
+LLVMValueRef LLVMDIBuilderCreateClassType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
+    uint64_t OffsetInBits, unsigned Flags, LLVMValueRef DerivedFrom,
+    LLVMValueRef Elements, LLVMValueRef VTableHolder,
+    LLVMValueRef TemplateParms);
+/// createStructType - Create debugging information entry for a struct.
+/// @param Scope        Scope in which this struct is defined.
+/// @param Name         Struct name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Elements     Struct elements.
+/// @param RunTimeLang  Optional parameter, Objective-C runtime version.
+LLVMValueRef LLVMDIBuilderCreateStructType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNum, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
+    LLVMValueRef Elements, unsigned RunTimeLang);
+/// createUnionType - Create debugging information entry for an union.
+/// @param Scope        Scope in which this union is defined.
+/// @param Name         Union name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param Flags        Flags to encode member attribute, e.g. private
+/// @param Elements     Union elements.
+/// @param RunTimeLang  Optional parameter, Objective-C runtime version.
+LLVMValueRef LLVMDIBuilderCreateUnionType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNum, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
+    LLVMValueRef Elements, unsigned RunTimeLang);
+/// createTemplateValueParameter - Create debugging information for template
+/// value parameter.
+/// @param Scope        Scope in which this type is defined.
+/// @param Name         Value parameter name.
+/// @param Ty           Parameter type.
+/// @param Value        Constant parameter value.
+/// @param File         File where this type parameter is defined.
+/// @param LineNo       Line number.
+/// @param ColumnNo     Column Number.
+LLVMValueRef LLVMDIBuilderCreateTemplateValueParameter(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef Ty,
+    uint64_t Value, LLVMValueRef File, unsigned LineNo, unsigned ColumnNo);
+/// createArrayType - Create debugging information entry for an array.
+/// @param Size         Array size.
+/// @param AlignInBits  Alignment.
+/// @param Ty           Element type.
+/// @param Subscripts   Subscripts.
+LLVMValueRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef builder,
+                                          uint64_t Size, uint64_t AlignInBits,
+                                          LLVMValueRef Ty,
+                                          LLVMValueRef Subscripts);
+/// createVectorType - Create debugging information entry for a vector type.
+/// @param Size         Array size.
+/// @param AlignInBits  Alignment.
+/// @param Ty           Element type.
+/// @param Subscripts   Subscripts.
+LLVMValueRef LLVMDIBuilderCreateVector(LLVMDIBuilderRef builder, uint64_t Size,
+                                       uint64_t AlignInBits, LLVMValueRef Ty,
+                                       LLVMValueRef Subscripts);
+/// createEnumerationType - Create debugging information entry for an
+/// enumeration.
+/// @param Scope        Scope in which this enumeration is defined.
+/// @param Name         Union name.
+/// @param File         File where this member is defined.
+/// @param LineNo       Line number.
+/// @param SizeInBits   Member size.
+/// @param AlignInBits  Member alignment.
+/// @param Elements     Enumeration elements.
+LLVMValueRef LLVMDIBuilderCreateEnumerationType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
+    LLVMValueRef Elements, LLVMValueRef ClassType);
+/// createSubroutineType - Create subroutine type.
+/// @param File          File in which this subroutine is defined.
+/// @param ParamterTypes An array of subroutine parameter types. This
+///                      includes return type at 0th index.
+LLVMValueRef LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef builder,
+                                               LLVMValueRef File,
+                                               LLVMValueRef ParameterTypes);
+/// createArtificialType - Create a new DIType with "artificial" flag set.
+LLVMValueRef LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef builder,
+                                               LLVMValueRef Ty);
+/// createForwardDecl - Create a temporary forward-declared type.
+LLVMValueRef LLVMDIBuilderCreateForwardDecl(LLVMDIBuilderRef builder,
+                                            unsigned Tag, char *Name,
+                                            LLVMValueRef Scope,
+                                            LLVMValueRef File, unsigned Line,
+                                            unsigned RuntimeLang);
+/// retainType - Retain DIType in a module even if it is not referenced
+/// through debug info anchors.
+void LLVMDIBuilderRetainType(LLVMDIBuilderRef builder, LLVMValueRef Ty);
+/// createUnspecifiedParameter - Create unspeicified type descriptor
+/// for a subroutine type.
+LLVMValueRef LLVMDIBuilderCreateUnspecifiedParameter(LLVMDIBuilderRef builder);
+/// getOrCreateArray - Get a DIArray, create one if required.
+LLVMValueRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef builder,
+                                           LLVMValueRef *Elements,
+                                           int ElementCount);
+/// getOrCreateSubrange - Create a descriptor for a value range.  This
+/// implicitly uniques the values returned.
+LLVMValueRef LLVMDIBuilderGetOrCreateRange(LLVMDIBuilderRef builder, int64_t Lo,
+                                           int64_t Hi);
+/// createGlobalVariable - Create a new descriptor for the specified global.
+/// @param Name        Name of the variable.
+/// @param File        File where this variable is defined.
+/// @param LineNo      Line number.
+/// @param Ty          Variable Type.
+/// @param isLocalToUnit Boolean flag indicate whether this variable is
+///                      externally visible or not.
+/// @param Val         llvm::Value of the variable.
+LLVMValueRef LLVMDIBuilderCreateGlobalVariable(LLVMDIBuilderRef builder,
+                                               char *Name, LLVMValueRef File,
+                                               unsigned LineNo, LLVMValueRef Ty,
+                                               bool IsLocalToUnit,
+                                               LLVMValueRef Val);
+/// createStaticVariable - Create a new descriptor for the specified
+/// variable.
+/// @param Conext      Variable scope.
+/// @param Name        Name of the variable.
+/// @param LinakgeName Mangled  name of the variable.
+/// @param File        File where this variable is defined.
+/// @param LineNo      Line number.
+/// @param Ty          Variable Type.
+/// @param isLocalToUnit Boolean flag indicate whether this variable is
+///                      externally visible or not.
+/// @param Val         llvm::Value of the variable.
+LLVMValueRef LLVMDIBuilderCreateStaticVariable(
+    LLVMDIBuilderRef builder, LLVMValueRef Context, char *Name,
+    char *LinkageName, LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty,
+    bool IsLocalToUnit, LLVMValueRef Val);
+/// createLocalVariable - Create a new descriptor for the specified
+/// local variable.
+/// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
+///                    DW_TAG_arg_variable.
+/// @param Scope       Variable scope.
+/// @param Name        Variable name.
+/// @param File        File where this variable is defined.
+/// @param LineNo      Line number.
+/// @param Ty          Variable Type
+/// @param AlwaysPreserve Boolean. Set to true if debug info for this
+///                       variable should be preserved in optimized build.
+/// @param Flags          Flags, e.g. artificial variable.
+/// @param ArgNo       If this variable is an arugment then this argument's
+///                    number. 1 indicates 1st argument.
+LLVMValueRef LLVMDIBuilderCreateLocalVariable(LLVMDIBuilderRef builder,
+                                              unsigned Tag, LLVMValueRef Scope,
+                                              char *Name, LLVMValueRef File,
+                                              unsigned LineNo, LLVMValueRef Ty,
+                                              bool AlwaysPreserve,
+                                              unsigned Flags, unsigned ArgNo);
+/// createComplexVariable - Create a new descriptor for the specified
+/// variable which has a complex address expression for its address.
+/// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
+///                    DW_TAG_arg_variable.
+/// @param Scope       Variable scope.
+/// @param Name        Variable name.
+/// @param File        File where this variable is defined.
+/// @param LineNo      Line number.
+/// @param Ty          Variable Type
+/// @param Addr        An array of complex address operations.
+/// @param ArgNo       If this variable is an arugment then this argument's
+///                    number. 1 indicates 1st argument.
+LLVMValueRef LLVMDIBuilderCreateComplexVariable(
+    LLVMDIBuilderRef builder, unsigned Tag, LLVMValueRef Scope, char *Name,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, LLVMValueRef *Addrs,
+    int AddrCount, unsigned ArgNo);
+
+/// createFunction - Create a new descriptor for the specified subprogram.
+/// See comments in DISubprogram for descriptions of these fields.
+/// @param Scope         Function scope.
+/// @param Name          Function name.
+/// @param LinkageName   Mangled function name.
+/// @param File          File where this variable is defined.
+/// @param LineNo        Line number.
+/// @param Ty            Function type.
+/// @param isLocalToUnit True if this function is not externally visible..
+/// @param isDefinition  True if this is a function definition.
+/// @param ScopeLine     Set to the beginning of the scope this starts
+/// @param Flags         e.g. is this function prototyped or not.
+///                      This flags are used to emit dwarf attributes.
+/// @param isOptimized   True if optimization is ON.
+/// @param Fn            llvm::Function pointer.
+/// @param TParam        Function template parameters.
+LLVMValueRef LLVMDIBuilderCreateFunction(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, char *LinkageName,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, bool IsLocalToUnit,
+    bool IsDefinition, unsigned ScopeLine, unsigned Flags, bool IsOptimized,
+    LLVMValueRef function, LLVMValueRef TParam, LLVMValueRef Decl);
+/// createMethod - Create a new descriptor for the specified C++ method.
+/// See comments in DISubprogram for descriptions of these fields.
+/// @param Scope         Function scope.
+/// @param Name          Function name.
+/// @param LinkageName   Mangled function name.
+/// @param File          File where this variable is defined.
+/// @param LineNo        Line number.
+/// @param Ty            Function type.
+/// @param isLocalToUnit True if this function is not externally visible..
+/// @param isDefinition  True if this is a function definition.
+/// @param Virtuality    Attributes describing virtualness. e.g. pure
+///                      virtual function.
+/// @param VTableIndex   Index no of this method in virtual table.
+/// @param VTableHolder  Type that holds vtable.
+/// @param Flags         e.g. is this function prototyped or not.
+///                      This flags are used to emit dwarf attributes.
+/// @param isOptimized   True if optimization is ON.
+/// @param Fn            llvm::Function pointer.
+/// @param TParam        Function template parameters.
+LLVMValueRef LLVMDIBuilderCreateMethod(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, char *LinkageName,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, bool lIsLocalToUnit,
+    bool IsDefintiion, unsigned Virtuality, unsigned VTableIndex,
+    LLVMValueRef VTableHolder, unsigned Flags, bool IsOptimized,
+    LLVMValueRef Fn, LLVMValueRef TParam);
+/// createNameSpace - This creates new descriptor for a namespace
+/// with the specified parent scope.
+/// @param Scope       Namespace scope
+/// @param Name        Name of this namespace
+/// @param File        Source file
+/// @param LineNo      Line number
+LLVMValueRef LLVMDIBuilderCreateNamespace(LLVMDIBuilderRef builder,
+                                          LLVMValueRef Scope, char *Name,
+                                          LLVMValueRef File, unsigned LineNo);
+/// createLexicalBlockFile - This creates a descriptor for a lexical
+/// block with a new file attached. This merely extends the existing
+/// lexical block as it crosses a file.
+/// @param Scope       Lexical block.
+/// @param File        Source file.
+LLVMValueRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef builder,
+                                                 LLVMValueRef Scope,
+                                                 LLVMValueRef File);
+/// createLexicalBlock - This creates a descriptor for a lexical block
+/// with the specified parent context.
+/// @param Scope       Parent lexical scope.
+/// @param File        Source file
+/// @param Line        Line number
+/// @param Col         Column number
+LLVMValueRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef builder,
+                                             LLVMValueRef Scope,
+                                             LLVMValueRef File, unsigned Line,
+                                             unsigned Col);
+/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+/// @param Storage     llvm::Value of the variable
+/// @param VarInfo     Variable's debug info descriptor.
+/// @param InsertAtEnd Location for the new intrinsic.
+LLVMValueRef LLVMDIBuilderInsertDeclare(LLVMDIBuilderRef builder,
+                                        LLVMValueRef Storage,
+                                        LLVMValueRef VarInfo,
+                                        LLVMBasicBlockRef InsertAtEnd);
+/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+/// @param Storage      llvm::Value of the variable
+/// @param VarInfo      Variable's debug info descriptor.
+/// @param InsertBefore Location for the new intrinsic.
+LLVMValueRef LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef builder,
+                                              LLVMValueRef Storage,
+                                              LLVMValueRef VarInfo,
+                                              LLVMValueRef InsertBefore);
+/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
+/// @param Val          llvm::Value of the variable
+/// @param Offset       Offset
+/// @param VarInfo      Variable's debug info descriptor.
+/// @param InsertAtEnd Location for the new intrinsic.
+LLVMValueRef LLVMDIBuilderInsertDgbValueInstrinsic(
+    LLVMDIBuilderRef builder, LLVMValueRef Val, uint64_t Offset,
+    LLVMValueRef VarInfo, LLVMBasicBlockRef InsertAtEnd);
+/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
+/// @param Val          llvm::Value of the variable
+/// @param Offset       Offset
+/// @param VarInfo      Variable's debug info descriptor.
+/// @param InsertBefore Location for the new intrinsic.
+LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
+    LLVMDIBuilderRef builder, LLVMValueRef Val, uint64_t Offset,
+    LLVMValueRef VarInfo, LLVMValueRef InsertBefore);
+
+void LLVMDIBuilderReplaceStructBody(LLVMDIBuilderRef builder,
+                                    LLVMValueRef Struct, LLVMValueRef NewBody);
+
+#ifdef __cplusplus
+}
+#endif /* !defined(__cplusplus) */
+
+#endif /* !LLVM_C_DIBUILDER_H */
Index: lib/IR/CMakeLists.txt
===================================================================
--- lib/IR/CMakeLists.txt	(revision 180098)
+++ lib/IR/CMakeLists.txt	(working copy)
@@ -10,6 +10,7 @@
   DebugInfo.cpp
   DebugLoc.cpp
   DIBuilder.cpp
+  DIBuilderC.cpp
   Dominators.cpp
   Function.cpp
   GCOV.cpp
Index: lib/IR/DIBuilderC.cpp
===================================================================
--- lib/IR/DIBuilderC.cpp	(revision 0)
+++ lib/IR/DIBuilderC.cpp	(working copy)
@@ -0,0 +1,458 @@
+//===-- DIBuilderC.cpp
+//----------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the the C binding for DIBuilder
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-c/Core.h"
+#include "llvm/Wrap.h"
+#include "llvm-c/DIBuilder.h"
+
+using namespace llvm;
+
+inline DIBuilder *unwrap(LLVMDIBuilderRef P) {
+    return reinterpret_cast<DIBuilder*>(P);
+}
+
+inline LLVMDIBuilderRef wrap(const DIBuilder *P) {
+    return reinterpret_cast<LLVMDIBuilderRef>(const_cast<DIBuilder*>(P)); 
+}
+
+
+LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef module) {
+  Module *mod = unwrap(module);
+  return wrap(new DIBuilder(*mod));
+}
+
+void LLVMDestroyDIBuilder(LLVMDIBuilderRef builder) { delete unwrap(builder); }
+
+LLVMValueRef LLVMDIBuilderGetCU(LLVMDIBuilderRef builder) {
+  return wrap(unwrap(builder)->getCU());
+}
+
+void LLVMDIBuilderFinalize(LLVMDIBuilderRef builder) {
+  unwrap(builder)->finalize();
+}
+
+void LLVMDIBuilderCreateCompileUnit(LLVMDIBuilderRef builder, unsigned Lang,
+                                    char *File, char *Dir, char *Producer,
+                                    LLVMBool isOptimized, char *Flags,
+                                    unsigned RV) {
+  StringRef file(File);
+  StringRef dir(Dir);
+  StringRef producer(Producer);
+  StringRef flags(Flags);
+  unwrap(builder)
+      ->createCompileUnit(Lang, file, dir, producer, isOptimized, flags, RV);
+}
+
+LLVMValueRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef builder, char *File,
+                                     char *Dir) {
+  StringRef filename(File);
+  StringRef directory(Dir);
+  DIDescriptor descr = unwrap(builder)->createFile(File, Dir);
+  return wrap(descr);
+}
+
+LLVMValueRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef builder, char *Name,
+                                           uint64_t Val) {
+  StringRef name(Name);
+  return wrap(unwrap(builder)->createEnumerator(name, Val));
+}
+
+LLVMValueRef LLVMDIBuilderCreateNullPtr(LLVMDIBuilderRef builder, char *Name) {
+  StringRef name(Name);
+  return wrap(unwrap(builder)->createNullPtrType(name));
+}
+
+void LLVMBuilderAssociatePosition(LLVMBuilderRef builder, int Row, int Col,
+                                  LLVMValueRef Scope) {
+  Value *node = unwrap(Scope);
+  unwrap(builder)->SetCurrentDebugLocation(
+      DebugLoc::get(Row, Col, cast_or_null<MDNode>(node)));
+}
+
+void LLVMBuilderDeassociatePosition(LLVMBuilderRef builder) {
+  unwrap(builder)->SetCurrentDebugLocation(DebugLoc());
+}
+
+LLVMValueRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef builder, char *Name,
+                                          uint64_t sizeInBits,
+                                          uint64_t alignInBits,
+                                          unsigned Encoding) {
+  StringRef name(Name);
+  return wrap(unwrap(builder)
+                  ->createBasicType(name, sizeInBits, alignInBits, Encoding));
+}
+
+LLVMValueRef LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef builder,
+                                              unsigned Tag,
+                                              LLVMValueRef FromTy) {
+  MDNode *ft = cast_or_null<MDNode>(unwrap(FromTy));
+  return wrap(unwrap(builder)->createQualifiedType(Tag, (DIType) ft));
+}
+
+LLVMValueRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef builder,
+                                            LLVMValueRef pointeeTy,
+                                            uint64_t SizeInBits,
+                                            uint64_t AlignInBits, char *name) {
+  return wrap(unwrap(builder)->createPointerType(
+      (DIType) cast_or_null<MDNode>(unwrap(pointeeTy)), SizeInBits, AlignInBits,
+      name));
+}
+
+LLVMValueRef LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef builder,
+                                              unsigned Tag, LLVMValueRef RTy) {
+  return wrap(unwrap(builder)->createReferenceType(
+      Tag, (DIType) cast_or_null<MDNode>(unwrap(RTy))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateTypeDef(LLVMDIBuilderRef builder,
+                                        LLVMValueRef Ty, char *Name,
+                                        LLVMValueRef File, unsigned LineNo,
+                                        LLVMValueRef Context) {
+
+  StringRef name(Name);
+  return wrap(unwrap(builder)->createTypedef(
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)), Name,
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Context))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateFriend(LLVMDIBuilderRef builder,
+                                       LLVMValueRef Ty, LLVMValueRef FriendTy) {
+  return wrap(unwrap(builder)->createFriend(
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      (DIType) cast_or_null<MDNode>(unwrap(FriendTy))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateInheritence(LLVMDIBuilderRef builder,
+                                            LLVMValueRef Ty,
+                                            LLVMValueRef BaseTy,
+                                            uint64_t BaseOffset,
+                                            unsigned flags) {
+  return wrap(unwrap(builder)->createInheritance(
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      (DIType) cast_or_null<MDNode>(unwrap(BaseTy)), BaseOffset, flags));
+}
+
+LLVMValueRef LLVMDIBuilderCreateMemberType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
+    uint64_t OffsetInBits, unsigned Flags, LLVMValueRef Ty) {
+  return wrap(unwrap(builder)->createMemberType(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo, SizeInBits,
+      AlignInBits, OffsetInBits, Flags,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateObjCIVar(
+    LLVMDIBuilderRef builder, char *Name, LLVMValueRef File, unsigned LineNo,
+    uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
+    unsigned Flags, LLVMValueRef Ty, char *PropertyName,
+    char *PropertyGetterName, char *PropertySetterName,
+    unsigned PropertyAttributes) {
+  return wrap(unwrap(builder)->createObjCIVar(
+      StringRef(Name), (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      SizeInBits, AlignInBits, OffsetInBits, Flags,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)), StringRef(PropertyName),
+      StringRef(PropertyGetterName), StringRef(PropertySetterName),
+      PropertyAttributes));
+}
+
+LLVMValueRef LLVMDIBuilderCreateObjCPropertyIVar(
+    LLVMDIBuilderRef builder, char *Name, LLVMValueRef File, unsigned LineNo,
+    uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
+    unsigned Flags, LLVMValueRef Ty, LLVMValueRef Property) {
+  return wrap(unwrap(builder)->createObjCIVar(
+      StringRef(Name), (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      SizeInBits, AlignInBits, OffsetInBits, Flags,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      cast_or_null<MDNode>(unwrap(Property))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateProperty(LLVMDIBuilderRef builder, char *Name,
+                                         LLVMValueRef File, unsigned LineNumber,
+                                         char *GetterName, char *SetterName,
+                                         unsigned PropertyAttributes,
+                                         LLVMValueRef Ty) {
+  return wrap(unwrap(builder)->createObjCProperty(
+      StringRef(Name), (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNumber,
+      StringRef(GetterName), StringRef(SetterName), PropertyAttributes,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateClassType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
+    uint64_t OffsetInBits, unsigned Flags, LLVMValueRef DerivedFrom,
+    LLVMValueRef Elements, LLVMValueRef VTableHolder,
+    LLVMValueRef TemplateParms) {
+  return wrap(unwrap(builder)->createClassType(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNumber, SizeInBits,
+      AlignInBits, OffsetInBits, Flags,
+      (DIType) cast_or_null<MDNode>(unwrap(DerivedFrom)),
+      (DIArray) cast_or_null<MDNode>(unwrap(Elements)),
+      cast_or_null<MDNode>(unwrap(VTableHolder)),
+      cast_or_null<MDNode>(unwrap(TemplateParms))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateStructType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNum, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
+    LLVMValueRef Elements, unsigned RunTimeLang) {
+  //return
+  //wrap(unwrap(builder)->createStructType((DIFile)cast_or_null<MDNode>(unwrap(Scope)),
+  //StringRef(Name), (DIFile)cast_or_null<MDNode>(unwrap(File)), LineNum,
+  //SizeInBits, AlignInBits, Flags,
+  //(DIArray)cast_or_null<MDNode>(unwrap(Elements)), RunTimeLang));
+  return NULL;
+}
+
+LLVMValueRef LLVMDIBuilderCreateUnionType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNum, uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
+    LLVMValueRef Elements, unsigned RunTimeLang) {
+  return wrap(unwrap(builder)->createUnionType(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNum, SizeInBits,
+      AlignInBits, Flags, (DIArray) cast_or_null<MDNode>(unwrap(Elements)),
+      RunTimeLang));
+}
+
+LLVMValueRef LLVMDIBuilderCreateTemplateValueParameter(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef Ty,
+    uint64_t Value, LLVMValueRef File, unsigned LineNo, unsigned ColumnNo) {
+  return wrap(unwrap(builder)->createTemplateValueParameter(
+      (DIDerivedType) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)), Value,
+      cast_or_null<MDNode>(unwrap(File)), LineNo, ColumnNo));
+}
+
+LLVMValueRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef builder,
+                                          uint64_t Size, uint64_t AlignInBits,
+                                          LLVMValueRef Ty,
+                                          LLVMValueRef Subscripts) {
+  return wrap(unwrap(builder)->createArrayType(
+      Size, AlignInBits, (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      (DIArray) cast_or_null<MDNode>(unwrap(Subscripts))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateVector(LLVMDIBuilderRef builder, uint64_t Size,
+                                       uint64_t AlignInBits, LLVMValueRef Ty,
+                                       LLVMValueRef Subscripts) {
+  return wrap(unwrap(builder)->createVectorType(
+      Size, AlignInBits, (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      (DIArray) cast_or_null<MDNode>(unwrap(Subscripts))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateEnumerationType(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, LLVMValueRef File,
+    unsigned LineNumber, uint64_t SizeInBits, uint64_t AlignInBits,
+    LLVMValueRef Elements, LLVMValueRef ClassType) {
+  return wrap(unwrap(builder)->createEnumerationType(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNumber, SizeInBits,
+      AlignInBits, (DIArray) cast_or_null<MDNode>(unwrap(Elements)),
+      (DIType) cast_or_null<MDNode>(unwrap(ClassType))));
+
+}
+
+LLVMValueRef LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef builder,
+                                               LLVMValueRef File,
+                                               LLVMValueRef ParameterTypes) {
+  Value *file = unwrap(File);
+  Value *params = unwrap(ParameterTypes);
+  MDNode *filemd = cast_or_null<MDNode>(file);
+  MDNode *paramsmd = cast_or_null<MDNode>(params);
+
+  return wrap(unwrap(builder)
+                  ->createSubroutineType((DIFile) filemd, (DIArray) paramsmd));
+}
+
+LLVMValueRef LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef builder,
+                                               LLVMValueRef Ty) {
+  return wrap(unwrap(builder)->createArtificialType(
+      (DIType) cast_or_null<MDNode>(unwrap(Ty))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateForwardDecl(LLVMDIBuilderRef builder,
+                                            unsigned Tag, char *Name,
+                                            LLVMValueRef Scope,
+                                            LLVMValueRef File, unsigned Line,
+                                            unsigned RuntimeLang) {
+  return wrap(unwrap(builder)->createForwardDecl(
+      Tag, StringRef(Name), (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), Line, RuntimeLang));
+}
+
+void LLVMDIBuilderRetainType(LLVMDIBuilderRef builder, LLVMValueRef Ty) {
+  unwrap(builder)->retainType((DIType) cast_or_null<MDNode>(unwrap(Ty)));
+}
+
+LLVMValueRef LLVMDIBuilderCreateUnspecifiedParameter(LLVMDIBuilderRef builder) {
+  return wrap(unwrap(builder)->createUnspecifiedParameter());
+}
+
+LLVMValueRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef builder,
+                                           LLVMValueRef *Elements,
+                                           int ElementCount) {
+  ArrayRef<Value *> arr(unwrap(Elements), ElementCount);
+
+  return wrap(unwrap(builder)->getOrCreateArray(arr));
+}
+
+LLVMValueRef LLVMDIBuilderGetOrCreateRange(LLVMDIBuilderRef builder, int64_t Lo,
+                                           int64_t Hi) {
+  return wrap(unwrap(builder)->getOrCreateSubrange(Lo, Hi));
+}
+
+LLVMValueRef LLVMDIBuilderCreateGlobalVariable(LLVMDIBuilderRef builder,
+                                               char *Name, LLVMValueRef File,
+                                               unsigned LineNo, LLVMValueRef Ty,
+                                               bool IsLocalToUnit,
+                                               LLVMValueRef Val) {
+  return wrap(unwrap(builder)->createGlobalVariable(
+      StringRef(Name), (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)), IsLocalToUnit, unwrap(Val)));
+}
+
+LLVMValueRef LLVMDIBuilderCreateStaticVariable(
+    LLVMDIBuilderRef builder, LLVMValueRef Context, char *Name,
+    char *LinkageName, LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty,
+    bool IsLocalToUnit, LLVMValueRef Val) {
+  return wrap(unwrap(builder)->createStaticVariable(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Context)), StringRef(Name),
+      StringRef(LinkageName), (DIFile) cast_or_null<MDNode>(unwrap(File)),
+      LineNo, (DIType) cast_or_null<MDNode>(unwrap(Ty)), IsLocalToUnit,
+      unwrap(Val)));
+}
+
+LLVMValueRef LLVMDIBuilderCreateLocalVariable(LLVMDIBuilderRef builder,
+                                              unsigned Tag, LLVMValueRef Scope,
+                                              char *Name, LLVMValueRef File,
+                                              unsigned LineNo, LLVMValueRef Ty,
+                                              bool AlwaysPreserve,
+                                              unsigned Flags, unsigned ArgNo) {
+  return wrap(unwrap(builder)->createLocalVariable(
+      Tag, (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)), AlwaysPreserve, Flags, ArgNo));
+}
+
+LLVMValueRef LLVMDIBuilderCreateComplexVariable(
+    LLVMDIBuilderRef builder, unsigned Tag, LLVMValueRef Scope, char *Name,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, LLVMValueRef *Addrs,
+    int AddrCount, unsigned ArgNo) {
+  return wrap(unwrap(builder)->createComplexVariable(
+      Tag, (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo,
+      (DIType) cast_or_null<MDNode>(unwrap(Ty)),
+      ArrayRef<Value *>(unwrap(Addrs), AddrCount), ArgNo));
+}
+
+LLVMValueRef LLVMDIBuilderCreateFunction(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, char *LinkageName,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, bool IsLocalToUnit,
+    bool IsDefinition, unsigned ScopeLine, unsigned Flags, bool IsOptimized,
+    LLVMValueRef function, LLVMValueRef TParam, LLVMValueRef Decl) {
+  return wrap(unwrap(builder)->createFunction(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      StringRef(LinkageName), (DIFile) cast_or_null<MDNode>(unwrap(File)),
+      LineNo, (DIType) cast_or_null<MDNode>(unwrap(Ty)), IsLocalToUnit,
+      IsDefinition, ScopeLine, Flags, IsOptimized,
+      cast_or_null<Function>(unwrap(function)),
+      cast_or_null<MDNode>(unwrap(TParam)),
+      cast_or_null<MDNode>(unwrap(Decl))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateMethod(
+    LLVMDIBuilderRef builder, LLVMValueRef Scope, char *Name, char *LinkageName,
+    LLVMValueRef File, unsigned LineNo, LLVMValueRef Ty, bool lIsLocalToUnit,
+    bool IsDefintiion, unsigned Virtuality, unsigned VTableIndex,
+    LLVMValueRef VTableHolder, unsigned Flags, bool IsOptimized,
+    LLVMValueRef Fn, LLVMValueRef TParam) {
+  return wrap(unwrap(builder)->createMethod(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      StringRef(LinkageName), (DIFile) cast_or_null<MDNode>(unwrap(File)),
+      LineNo, (DIType) cast_or_null<MDNode>(unwrap(Ty)), lIsLocalToUnit,
+      IsDefintiion, Virtuality, VTableIndex,
+      cast_or_null<MDNode>(unwrap(VTableHolder)), Flags, IsOptimized,
+      (Function *)cast_or_null<MDNode>(unwrap(Fn)),
+      cast_or_null<MDNode>(unwrap(TParam))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateNamespace(LLVMDIBuilderRef builder,
+                                          LLVMValueRef Scope, char *Name,
+                                          LLVMValueRef File, unsigned LineNo) {
+  return wrap(unwrap(builder)->createNameSpace(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)), StringRef(Name),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), LineNo));
+}
+
+LLVMValueRef LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef builder,
+                                                 LLVMValueRef Scope,
+                                                 LLVMValueRef File) {
+  return wrap(unwrap(builder)->createLexicalBlockFile(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)),
+      (DIFile) cast_or_null<MDNode>(unwrap(File))));
+}
+
+LLVMValueRef LLVMDIBuilderCreateLexicalBlock(LLVMDIBuilderRef builder,
+                                             LLVMValueRef Scope,
+                                             LLVMValueRef File, unsigned Line,
+                                             unsigned Col) {
+  return wrap(unwrap(builder)->createLexicalBlock(
+      (DIDescriptor) cast_or_null<MDNode>(unwrap(Scope)),
+      (DIFile) cast_or_null<MDNode>(unwrap(File)), Line, Col));
+}
+LLVMValueRef LLVMDIBuilderInsertDeclare(LLVMDIBuilderRef builder,
+                                        LLVMValueRef Storage,
+                                        LLVMValueRef VarInfo,
+                                        LLVMBasicBlockRef InsertAtEnd) {
+  return wrap(unwrap(builder)->insertDeclare(
+      unwrap(Storage), (DIVariable) cast_or_null<MDNode>(unwrap(VarInfo)),
+      unwrap(InsertAtEnd)));
+}
+
+LLVMValueRef LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef builder,
+                                              LLVMValueRef Storage,
+                                              LLVMValueRef VarInfo,
+                                              LLVMValueRef InsertBefore) {
+  return wrap(unwrap(builder)->insertDeclare(
+      unwrap(Storage), (DIVariable) cast_or_null<MDNode>(unwrap(VarInfo)),
+      cast_or_null<Instruction>(unwrap(InsertBefore))));
+}
+
+LLVMValueRef LLVMDIBuilderInsertDgbValueInstrinsic(
+    LLVMDIBuilderRef builder, LLVMValueRef Val, uint64_t Offset,
+    LLVMValueRef VarInfo, LLVMBasicBlockRef InsertAtEnd) {
+  return wrap(unwrap(builder)->insertDbgValueIntrinsic(
+      unwrap(Val), Offset, (DIVariable) cast_or_null<MDNode>(unwrap(VarInfo)),
+      unwrap(InsertAtEnd)));
+}
+
+LLVMValueRef LLVMDIBuilderInsertDbgValueIntrinsicBefore(
+    LLVMDIBuilderRef builder, LLVMValueRef Val, uint64_t Offset,
+    LLVMValueRef VarInfo, LLVMValueRef InsertBefore) {
+  return wrap(unwrap(builder)->insertDbgValueIntrinsic(
+      unwrap(Val), Offset, (DIVariable) cast_or_null<MDNode>(unwrap(VarInfo)),
+      cast_or_null<Instruction>(unwrap(InsertBefore))));
+}
+
+void LLVMDIBuilderReplaceStructBody(LLVMDIBuilderRef builder,
+                                    LLVMValueRef Struct, LLVMValueRef NewBody) {
+  MDNode *fwd = cast_or_null<MDNode>(unwrap(Struct));
+  DIArray arr = (DIArray) cast_or_null<MDNode>(unwrap(NewBody));
+  fwd->replaceOperandWith(10, arr);
+}


More information about the llvm-commits mailing list