Home | History | Annotate | Download | only in llvm
      1 //===--- llvm/DIBuilder.h - Debug Information Builder -----------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines a DIBuilder that is useful for creating debugging
     11 // information entries in LLVM IR form.
     12 //
     13 //===----------------------------------------------------------------------===//
     14 
     15 #ifndef LLVM_DIBUILDER_H
     16 #define LLVM_DIBUILDER_H
     17 
     18 #include "llvm/ADT/ArrayRef.h"
     19 #include "llvm/ADT/StringRef.h"
     20 #include "llvm/Support/DataTypes.h"
     21 
     22 namespace llvm {
     23   class BasicBlock;
     24   class Instruction;
     25   class Function;
     26   class Module;
     27   class Value;
     28   class LLVMContext;
     29   class MDNode;
     30   class StringRef;
     31   class DIBasicType;
     32   class DICompileUnit;
     33   class DICompositeType;
     34   class DIDerivedType;
     35   class DIDescriptor;
     36   class DIFile;
     37   class DIEnumerator;
     38   class DIType;
     39   class DIArray;
     40   class DIGlobalVariable;
     41   class DIImportedEntity;
     42   class DINameSpace;
     43   class DIVariable;
     44   class DISubrange;
     45   class DILexicalBlockFile;
     46   class DILexicalBlock;
     47   class DIScope;
     48   class DISubprogram;
     49   class DITemplateTypeParameter;
     50   class DITemplateValueParameter;
     51   class DIObjCProperty;
     52 
     53   class DIBuilder {
     54     private:
     55     Module &M;
     56     LLVMContext & VMContext;
     57 
     58     MDNode *TempEnumTypes;
     59     MDNode *TempRetainTypes;
     60     MDNode *TempSubprograms;
     61     MDNode *TempGVs;
     62     MDNode *TempImportedModules;
     63 
     64     Function *DeclareFn;     // llvm.dbg.declare
     65     Function *ValueFn;       // llvm.dbg.value
     66 
     67     SmallVector<Value *, 4> AllEnumTypes;
     68     SmallVector<Value *, 4> AllRetainTypes;
     69     SmallVector<Value *, 4> AllSubprograms;
     70     SmallVector<Value *, 4> AllGVs;
     71     SmallVector<Value *, 4> AllImportedModules;
     72 
     73     DITemplateValueParameter
     74     createTemplateValueParameter(unsigned Tag, DIDescriptor Scope,
     75                                  StringRef Name, DIType Ty, Value *Val,
     76                                  MDNode *File = 0, unsigned LineNo = 0,
     77                                  unsigned ColumnNo = 0);
     78 
     79     DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
     80     void operator=(const DIBuilder &) LLVM_DELETED_FUNCTION;
     81 
     82     public:
     83     explicit DIBuilder(Module &M);
     84     enum ComplexAddrKind { OpPlus=1, OpDeref };
     85 
     86     /// finalize - Construct any deferred debug info descriptors.
     87     void finalize();
     88 
     89     /// createCompileUnit - A CompileUnit provides an anchor for all debugging
     90     /// information generated during this instance of compilation.
     91     /// @param Lang     Source programming language, eg. dwarf::DW_LANG_C99
     92     /// @param File     File name
     93     /// @param Dir      Directory
     94     /// @param Producer String identify producer of debugging information.
     95     ///                 Usuall this is a compiler version string.
     96     /// @param isOptimized A boolean flag which indicates whether optimization
     97     ///                    is ON or not.
     98     /// @param Flags    This string lists command line options. This string is
     99     ///                 directly embedded in debug info output which may be used
    100     ///                 by a tool analyzing generated debugging information.
    101     /// @param RV       This indicates runtime version for languages like
    102     ///                 Objective-C.
    103     /// @param SplitName The name of the file that we'll split debug info out
    104     ///                  into.
    105     DICompileUnit createCompileUnit(unsigned Lang, StringRef File,
    106                                     StringRef Dir, StringRef Producer,
    107                                     bool isOptimized, StringRef Flags,
    108                                     unsigned RV,
    109                                     StringRef SplitName = StringRef());
    110 
    111     /// createFile - Create a file descriptor to hold debugging information
    112     /// for a file.
    113     DIFile createFile(StringRef Filename, StringRef Directory);
    114 
    115     /// createEnumerator - Create a single enumerator value.
    116     DIEnumerator createEnumerator(StringRef Name, int64_t Val);
    117 
    118     /// \brief Create a DWARF unspecified type.
    119     DIBasicType createUnspecifiedType(StringRef Name);
    120 
    121     /// \brief Create C++11 nullptr type.
    122     DIBasicType createNullPtrType();
    123 
    124     /// createBasicType - Create debugging information entry for a basic
    125     /// type.
    126     /// @param Name        Type name.
    127     /// @param SizeInBits  Size of the type.
    128     /// @param AlignInBits Type alignment.
    129     /// @param Encoding    DWARF encoding code, e.g. dwarf::DW_ATE_float.
    130     DIBasicType createBasicType(StringRef Name, uint64_t SizeInBits,
    131                                 uint64_t AlignInBits, unsigned Encoding);
    132 
    133     /// createQualifiedType - Create debugging information entry for a qualified
    134     /// type, e.g. 'const int'.
    135     /// @param Tag         Tag identifing type, e.g. dwarf::TAG_volatile_type
    136     /// @param FromTy      Base Type.
    137     DIDerivedType createQualifiedType(unsigned Tag, DIType FromTy);
    138 
    139     /// createPointerType - Create debugging information entry for a pointer.
    140     /// @param PointeeTy   Type pointed by this pointer.
    141     /// @param SizeInBits  Size.
    142     /// @param AlignInBits Alignment. (optional)
    143     /// @param Name        Pointer type name. (optional)
    144     DIDerivedType
    145     createPointerType(DIType PointeeTy, uint64_t SizeInBits,
    146                       uint64_t AlignInBits = 0, StringRef Name = StringRef());
    147 
    148     /// \brief Create debugging information entry for a pointer to member.
    149     /// @param PointeeTy Type pointed to by this pointer.
    150     /// @param Class Type for which this pointer points to members of.
    151     DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
    152 
    153     /// createReferenceType - Create debugging information entry for a c++
    154     /// style reference or rvalue reference type.
    155     DIDerivedType createReferenceType(unsigned Tag, DIType RTy);
    156 
    157     /// createTypedef - Create debugging information entry for a typedef.
    158     /// @param Ty          Original type.
    159     /// @param Name        Typedef name.
    160     /// @param File        File where this type is defined.
    161     /// @param LineNo      Line number.
    162     /// @param Context     The surrounding context for the typedef.
    163     DIDerivedType createTypedef(DIType Ty, StringRef Name, DIFile File,
    164                                 unsigned LineNo, DIDescriptor Context);
    165 
    166     /// createFriend - Create debugging information entry for a 'friend'.
    167     DIDerivedType createFriend(DIType Ty, DIType FriendTy);
    168 
    169     /// createInheritance - Create debugging information entry to establish
    170     /// inheritance relationship between two types.
    171     /// @param Ty           Original type.
    172     /// @param BaseTy       Base type. Ty is inherits from base.
    173     /// @param BaseOffset   Base offset.
    174     /// @param Flags        Flags to describe inheritance attribute,
    175     ///                     e.g. private
    176     DIDerivedType createInheritance(DIType Ty, DIType BaseTy,
    177                                     uint64_t BaseOffset, unsigned Flags);
    178 
    179     /// createMemberType - Create debugging information entry for a member.
    180     /// @param Scope        Member scope.
    181     /// @param Name         Member name.
    182     /// @param File         File where this member is defined.
    183     /// @param LineNo       Line number.
    184     /// @param SizeInBits   Member size.
    185     /// @param AlignInBits  Member alignment.
    186     /// @param OffsetInBits Member offset.
    187     /// @param Flags        Flags to encode member attribute, e.g. private
    188     /// @param Ty           Parent type.
    189     DIDerivedType
    190     createMemberType(DIDescriptor Scope, StringRef Name, DIFile File,
    191                      unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
    192                      uint64_t OffsetInBits, unsigned Flags, DIType Ty);
    193 
    194     /// createStaticMemberType - Create debugging information entry for a
    195     /// C++ static data member.
    196     /// @param Scope      Member scope.
    197     /// @param Name       Member name.
    198     /// @param File       File where this member is declared.
    199     /// @param LineNo     Line number.
    200     /// @param Ty         Type of the static member.
    201     /// @param Flags      Flags to encode member attribute, e.g. private.
    202     /// @param Val        Const initializer of the member.
    203     DIDerivedType
    204     createStaticMemberType(DIDescriptor Scope, StringRef Name,
    205                            DIFile File, unsigned LineNo, DIType Ty,
    206                            unsigned Flags, llvm::Value *Val);
    207 
    208     /// createObjCIVar - Create debugging information entry for Objective-C
    209     /// instance variable.
    210     /// @param Name         Member name.
    211     /// @param File         File where this member is defined.
    212     /// @param LineNo       Line number.
    213     /// @param SizeInBits   Member size.
    214     /// @param AlignInBits  Member alignment.
    215     /// @param OffsetInBits Member offset.
    216     /// @param Flags        Flags to encode member attribute, e.g. private
    217     /// @param Ty           Parent type.
    218     /// @param PropertyName Name of the Objective C property associated with
    219     ///                     this ivar.
    220     /// @param PropertyGetterName Name of the Objective C property getter
    221     ///                           selector.
    222     /// @param PropertySetterName Name of the Objective C property setter
    223     ///                           selector.
    224     /// @param PropertyAttributes Objective C property attributes.
    225     DIDerivedType createObjCIVar(StringRef Name, DIFile File,
    226                                  unsigned LineNo, uint64_t SizeInBits,
    227                                  uint64_t AlignInBits, uint64_t OffsetInBits,
    228                                  unsigned Flags, DIType Ty,
    229                                  StringRef PropertyName = StringRef(),
    230                                  StringRef PropertyGetterName = StringRef(),
    231                                  StringRef PropertySetterName = StringRef(),
    232                                  unsigned PropertyAttributes = 0);
    233 
    234     /// createObjCIVar - Create debugging information entry for Objective-C
    235     /// instance variable.
    236     /// @param Name         Member name.
    237     /// @param File         File where this member is defined.
    238     /// @param LineNo       Line number.
    239     /// @param SizeInBits   Member size.
    240     /// @param AlignInBits  Member alignment.
    241     /// @param OffsetInBits Member offset.
    242     /// @param Flags        Flags to encode member attribute, e.g. private
    243     /// @param Ty           Parent type.
    244     /// @param PropertyNode Property associated with this ivar.
    245     DIDerivedType createObjCIVar(StringRef Name, DIFile File,
    246                                  unsigned LineNo, uint64_t SizeInBits,
    247                                  uint64_t AlignInBits, uint64_t OffsetInBits,
    248                                  unsigned Flags, DIType Ty,
    249                                  MDNode *PropertyNode);
    250 
    251     /// createObjCProperty - Create debugging information entry for Objective-C
    252     /// property.
    253     /// @param Name         Property name.
    254     /// @param File         File where this property is defined.
    255     /// @param LineNumber   Line number.
    256     /// @param GetterName   Name of the Objective C property getter selector.
    257     /// @param SetterName   Name of the Objective C property setter selector.
    258     /// @param PropertyAttributes Objective C property attributes.
    259     /// @param Ty           Type.
    260     DIObjCProperty createObjCProperty(StringRef Name,
    261                                       DIFile File, unsigned LineNumber,
    262                                       StringRef GetterName,
    263                                       StringRef SetterName,
    264                                       unsigned PropertyAttributes,
    265                                       DIType Ty);
    266 
    267     /// createClassType - Create debugging information entry for a class.
    268     /// @param Scope        Scope in which this class is defined.
    269     /// @param Name         class name.
    270     /// @param File         File where this member is defined.
    271     /// @param LineNumber   Line number.
    272     /// @param SizeInBits   Member size.
    273     /// @param AlignInBits  Member alignment.
    274     /// @param OffsetInBits Member offset.
    275     /// @param Flags        Flags to encode member attribute, e.g. private
    276     /// @param Elements     class members.
    277     /// @param VTableHolder Debug info of the base class that contains vtable
    278     ///                     for this type. This is used in
    279     ///                     DW_AT_containing_type. See DWARF documentation
    280     ///                     for more info.
    281     /// @param TemplateParms Template type parameters.
    282     DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
    283                                     DIFile File, unsigned LineNumber,
    284                                     uint64_t SizeInBits, uint64_t AlignInBits,
    285                                     uint64_t OffsetInBits, unsigned Flags,
    286                                     DIType DerivedFrom, DIArray Elements,
    287                                     MDNode *VTableHolder = 0,
    288                                     MDNode *TemplateParms = 0);
    289 
    290     /// createStructType - Create debugging information entry for a struct.
    291     /// @param Scope        Scope in which this struct is defined.
    292     /// @param Name         Struct name.
    293     /// @param File         File where this member is defined.
    294     /// @param LineNumber   Line number.
    295     /// @param SizeInBits   Member size.
    296     /// @param AlignInBits  Member alignment.
    297     /// @param Flags        Flags to encode member attribute, e.g. private
    298     /// @param Elements     Struct elements.
    299     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
    300     DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
    301                                      DIFile File, unsigned LineNumber,
    302                                      uint64_t SizeInBits, uint64_t AlignInBits,
    303                                      unsigned Flags, DIType DerivedFrom,
    304                                      DIArray Elements, unsigned RunTimeLang = 0,
    305                                      MDNode *VTableHolder = 0);
    306 
    307     /// createUnionType - Create debugging information entry for an union.
    308     /// @param Scope        Scope in which this union is defined.
    309     /// @param Name         Union name.
    310     /// @param File         File where this member is defined.
    311     /// @param LineNumber   Line number.
    312     /// @param SizeInBits   Member size.
    313     /// @param AlignInBits  Member alignment.
    314     /// @param Flags        Flags to encode member attribute, e.g. private
    315     /// @param Elements     Union elements.
    316     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
    317     DICompositeType createUnionType(
    318         DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
    319         uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
    320         DIArray Elements, unsigned RunTimeLang = 0);
    321 
    322     /// createTemplateTypeParameter - Create debugging information for template
    323     /// type parameter.
    324     /// @param Scope        Scope in which this type is defined.
    325     /// @param Name         Type parameter name.
    326     /// @param Ty           Parameter type.
    327     /// @param File         File where this type parameter is defined.
    328     /// @param LineNo       Line number.
    329     /// @param ColumnNo     Column Number.
    330     DITemplateTypeParameter
    331     createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
    332                                 MDNode *File = 0, unsigned LineNo = 0,
    333                                 unsigned ColumnNo = 0);
    334 
    335     /// createTemplateValueParameter - Create debugging information for template
    336     /// value parameter.
    337     /// @param Scope        Scope in which this type is defined.
    338     /// @param Name         Value parameter name.
    339     /// @param Ty           Parameter type.
    340     /// @param Val          Constant parameter value.
    341     /// @param File         File where this type parameter is defined.
    342     /// @param LineNo       Line number.
    343     /// @param ColumnNo     Column Number.
    344     DITemplateValueParameter
    345     createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
    346                                  DIType Ty, Value *Val, MDNode *File = 0,
    347                                  unsigned LineNo = 0, unsigned ColumnNo = 0);
    348 
    349     /// \brief Create debugging information for a template template parameter.
    350     /// @param Scope        Scope in which this type is defined.
    351     /// @param Name         Value parameter name.
    352     /// @param Ty           Parameter type.
    353     /// @param Val          The fully qualified name of the template.
    354     /// @param File         File where this type parameter is defined.
    355     /// @param LineNo       Line number.
    356     /// @param ColumnNo     Column Number.
    357     DITemplateValueParameter
    358     createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
    359                                     DIType Ty, StringRef Val, MDNode *File = 0,
    360                                     unsigned LineNo = 0, unsigned ColumnNo = 0);
    361 
    362     /// \brief Create debugging information for a template parameter pack.
    363     /// @param Scope        Scope in which this type is defined.
    364     /// @param Name         Value parameter name.
    365     /// @param Ty           Parameter type.
    366     /// @param Val          An array of types in the pack.
    367     /// @param File         File where this type parameter is defined.
    368     /// @param LineNo       Line number.
    369     /// @param ColumnNo     Column Number.
    370     DITemplateValueParameter
    371     createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
    372                                 DIType Ty, DIArray Val, MDNode *File = 0,
    373                                 unsigned LineNo = 0, unsigned ColumnNo = 0);
    374 
    375     /// createArrayType - Create debugging information entry for an array.
    376     /// @param Size         Array size.
    377     /// @param AlignInBits  Alignment.
    378     /// @param Ty           Element type.
    379     /// @param Subscripts   Subscripts.
    380     DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
    381                                     DIType Ty, DIArray Subscripts);
    382 
    383     /// createVectorType - Create debugging information entry for a vector type.
    384     /// @param Size         Array size.
    385     /// @param AlignInBits  Alignment.
    386     /// @param Ty           Element type.
    387     /// @param Subscripts   Subscripts.
    388     DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
    389                                      DIType Ty, DIArray Subscripts);
    390 
    391     /// createEnumerationType - Create debugging information entry for an
    392     /// enumeration.
    393     /// @param Scope          Scope in which this enumeration is defined.
    394     /// @param Name           Union name.
    395     /// @param File           File where this member is defined.
    396     /// @param LineNumber     Line number.
    397     /// @param SizeInBits     Member size.
    398     /// @param AlignInBits    Member alignment.
    399     /// @param Elements       Enumeration elements.
    400     /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
    401     DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
    402                                           DIFile File, unsigned LineNumber,
    403                                           uint64_t SizeInBits,
    404                                           uint64_t AlignInBits,
    405                                           DIArray Elements,
    406                                           DIType UnderlyingType);
    407 
    408     /// createSubroutineType - Create subroutine type.
    409     /// @param File           File in which this subroutine is defined.
    410     /// @param ParameterTypes An array of subroutine parameter types. This
    411     ///                       includes return type at 0th index.
    412     DICompositeType createSubroutineType(DIFile File, DIArray ParameterTypes);
    413 
    414     /// createArtificialType - Create a new DIType with "artificial" flag set.
    415     DIType createArtificialType(DIType Ty);
    416 
    417     /// createObjectPointerType - Create a new DIType with the "object pointer"
    418     /// flag set.
    419     DIType createObjectPointerType(DIType Ty);
    420 
    421     /// createForwardDecl - Create a temporary forward-declared type.
    422     DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
    423                              DIFile F, unsigned Line, unsigned RuntimeLang = 0,
    424                              uint64_t SizeInBits = 0, uint64_t AlignInBits = 0);
    425 
    426     /// retainType - Retain DIType in a module even if it is not referenced
    427     /// through debug info anchors.
    428     void retainType(DIType T);
    429 
    430     /// createUnspecifiedParameter - Create unspeicified type descriptor
    431     /// for a subroutine type.
    432     DIDescriptor createUnspecifiedParameter();
    433 
    434     /// getOrCreateArray - Get a DIArray, create one if required.
    435     DIArray getOrCreateArray(ArrayRef<Value *> Elements);
    436 
    437     /// getOrCreateSubrange - Create a descriptor for a value range.  This
    438     /// implicitly uniques the values returned.
    439     DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
    440 
    441     /// createGlobalVariable - Create a new descriptor for the specified global.
    442     /// @param Name        Name of the variable.
    443     /// @param File        File where this variable is defined.
    444     /// @param LineNo      Line number.
    445     /// @param Ty          Variable Type.
    446     /// @param isLocalToUnit Boolean flag indicate whether this variable is
    447     ///                      externally visible or not.
    448     /// @param Val         llvm::Value of the variable.
    449     DIGlobalVariable
    450     createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
    451                          DIType Ty, bool isLocalToUnit, llvm::Value *Val);
    452 
    453     /// \brief Create a new descriptor for the specified global.
    454     /// @param Name        Name of the variable.
    455     /// @param LinkageName Mangled variable name.
    456     /// @param File        File where this variable is defined.
    457     /// @param LineNo      Line number.
    458     /// @param Ty          Variable Type.
    459     /// @param isLocalToUnit Boolean flag indicate whether this variable is
    460     ///                      externally visible or not.
    461     /// @param Val         llvm::Value of the variable.
    462     DIGlobalVariable
    463     createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
    464                          unsigned LineNo, DIType Ty, bool isLocalToUnit,
    465                          llvm::Value *Val);
    466 
    467     /// createStaticVariable - Create a new descriptor for the specified
    468     /// variable.
    469     /// @param Context     Variable scope.
    470     /// @param Name        Name of the variable.
    471     /// @param LinkageName Mangled  name of the variable.
    472     /// @param File        File where this variable is defined.
    473     /// @param LineNo      Line number.
    474     /// @param Ty          Variable Type.
    475     /// @param isLocalToUnit Boolean flag indicate whether this variable is
    476     ///                      externally visible or not.
    477     /// @param Val         llvm::Value of the variable.
    478     /// @param Decl        Reference to the corresponding declaration.
    479     DIGlobalVariable
    480     createStaticVariable(DIDescriptor Context, StringRef Name,
    481                          StringRef LinkageName, DIFile File, unsigned LineNo,
    482                          DIType Ty, bool isLocalToUnit, llvm::Value *Val,
    483                          MDNode *Decl = NULL);
    484 
    485 
    486     /// createLocalVariable - Create a new descriptor for the specified
    487     /// local variable.
    488     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
    489     ///                    DW_TAG_arg_variable.
    490     /// @param Scope       Variable scope.
    491     /// @param Name        Variable name.
    492     /// @param File        File where this variable is defined.
    493     /// @param LineNo      Line number.
    494     /// @param Ty          Variable Type
    495     /// @param AlwaysPreserve Boolean. Set to true if debug info for this
    496     ///                       variable should be preserved in optimized build.
    497     /// @param Flags          Flags, e.g. artificial variable.
    498     /// @param ArgNo       If this variable is an arugment then this argument's
    499     ///                    number. 1 indicates 1st argument.
    500     DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
    501                                    StringRef Name,
    502                                    DIFile File, unsigned LineNo,
    503                                    DIType Ty, bool AlwaysPreserve = false,
    504                                    unsigned Flags = 0,
    505                                    unsigned ArgNo = 0);
    506 
    507 
    508     /// createComplexVariable - Create a new descriptor for the specified
    509     /// variable which has a complex address expression for its address.
    510     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
    511     ///                    DW_TAG_arg_variable.
    512     /// @param Scope       Variable scope.
    513     /// @param Name        Variable name.
    514     /// @param F           File where this variable is defined.
    515     /// @param LineNo      Line number.
    516     /// @param Ty          Variable Type
    517     /// @param Addr        An array of complex address operations.
    518     /// @param ArgNo       If this variable is an arugment then this argument's
    519     ///                    number. 1 indicates 1st argument.
    520     DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
    521                                      StringRef Name, DIFile F, unsigned LineNo,
    522                                      DIType Ty, ArrayRef<Value *> Addr,
    523                                      unsigned ArgNo = 0);
    524 
    525     /// createFunction - Create a new descriptor for the specified subprogram.
    526     /// See comments in DISubprogram for descriptions of these fields.
    527     /// @param Scope         Function scope.
    528     /// @param Name          Function name.
    529     /// @param LinkageName   Mangled function name.
    530     /// @param File          File where this variable is defined.
    531     /// @param LineNo        Line number.
    532     /// @param Ty            Function type.
    533     /// @param isLocalToUnit True if this function is not externally visible..
    534     /// @param isDefinition  True if this is a function definition.
    535     /// @param ScopeLine     Set to the beginning of the scope this starts
    536     /// @param Flags         e.g. is this function prototyped or not.
    537     ///                      This flags are used to emit dwarf attributes.
    538     /// @param isOptimized   True if optimization is ON.
    539     /// @param Fn            llvm::Function pointer.
    540     /// @param TParam        Function template parameters.
    541     DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
    542                                 StringRef LinkageName,
    543                                 DIFile File, unsigned LineNo,
    544                                 DICompositeType Ty, bool isLocalToUnit,
    545                                 bool isDefinition,
    546                                 unsigned ScopeLine,
    547                                 unsigned Flags = 0,
    548                                 bool isOptimized = false,
    549                                 Function *Fn = 0,
    550                                 MDNode *TParam = 0,
    551                                 MDNode *Decl = 0);
    552 
    553     /// createMethod - Create a new descriptor for the specified C++ method.
    554     /// See comments in DISubprogram for descriptions of these fields.
    555     /// @param Scope         Function scope.
    556     /// @param Name          Function name.
    557     /// @param LinkageName   Mangled function name.
    558     /// @param File          File where this variable is defined.
    559     /// @param LineNo        Line number.
    560     /// @param Ty            Function type.
    561     /// @param isLocalToUnit True if this function is not externally visible..
    562     /// @param isDefinition  True if this is a function definition.
    563     /// @param Virtuality    Attributes describing virtualness. e.g. pure
    564     ///                      virtual function.
    565     /// @param VTableIndex   Index no of this method in virtual table.
    566     /// @param VTableHolder  Type that holds vtable.
    567     /// @param Flags         e.g. is this function prototyped or not.
    568     ///                      This flags are used to emit dwarf attributes.
    569     /// @param isOptimized   True if optimization is ON.
    570     /// @param Fn            llvm::Function pointer.
    571     /// @param TParam        Function template parameters.
    572     DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
    573                               StringRef LinkageName,
    574                               DIFile File, unsigned LineNo,
    575                               DICompositeType Ty, bool isLocalToUnit,
    576                               bool isDefinition,
    577                               unsigned Virtuality = 0, unsigned VTableIndex = 0,
    578                               MDNode *VTableHolder = 0,
    579                               unsigned Flags = 0,
    580                               bool isOptimized = false,
    581                               Function *Fn = 0,
    582                               MDNode *TParam = 0);
    583 
    584     /// createNameSpace - This creates new descriptor for a namespace
    585     /// with the specified parent scope.
    586     /// @param Scope       Namespace scope
    587     /// @param Name        Name of this namespace
    588     /// @param File        Source file
    589     /// @param LineNo      Line number
    590     DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
    591                                 DIFile File, unsigned LineNo);
    592 
    593 
    594     /// createLexicalBlockFile - This creates a descriptor for a lexical
    595     /// block with a new file attached. This merely extends the existing
    596     /// lexical block as it crosses a file.
    597     /// @param Scope       Lexical block.
    598     /// @param File        Source file.
    599     DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
    600                                               DIFile File);
    601 
    602     /// createLexicalBlock - This creates a descriptor for a lexical block
    603     /// with the specified parent context.
    604     /// @param Scope       Parent lexical scope.
    605     /// @param File        Source file
    606     /// @param Line        Line number
    607     /// @param Col         Column number
    608     DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
    609                                       unsigned Line, unsigned Col);
    610 
    611     /// \brief Create a descriptor for an imported module.
    612     /// @param Context The scope this module is imported into
    613     /// @param NS The namespace being imported here
    614     /// @param Line Line number
    615     DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
    616                                           unsigned Line,
    617                                           StringRef Name = StringRef());
    618 
    619     /// \brief Create a descriptor for an imported module.
    620     /// @param Context The scope this module is imported into
    621     /// @param NS An aliased namespace
    622     /// @param Line Line number
    623     DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
    624                                           unsigned Line, StringRef Name);
    625 
    626     /// \brief Create a descriptor for an imported function.
    627     /// @param Context The scope this module is imported into
    628     /// @param Decl The declaration (or definition) of a function, type, or
    629     ///             variable
    630     /// @param Line Line number
    631     DIImportedEntity createImportedDeclaration(DIScope Context,
    632                                                DIDescriptor Decl,
    633                                                unsigned Line);
    634 
    635     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
    636     /// @param Storage     llvm::Value of the variable
    637     /// @param VarInfo     Variable's debug info descriptor.
    638     /// @param InsertAtEnd Location for the new intrinsic.
    639     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
    640                                BasicBlock *InsertAtEnd);
    641 
    642     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
    643     /// @param Storage      llvm::Value of the variable
    644     /// @param VarInfo      Variable's debug info descriptor.
    645     /// @param InsertBefore Location for the new intrinsic.
    646     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
    647                                Instruction *InsertBefore);
    648 
    649 
    650     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
    651     /// @param Val          llvm::Value of the variable
    652     /// @param Offset       Offset
    653     /// @param VarInfo      Variable's debug info descriptor.
    654     /// @param InsertAtEnd Location for the new intrinsic.
    655     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
    656                                          DIVariable VarInfo,
    657                                          BasicBlock *InsertAtEnd);
    658 
    659     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
    660     /// @param Val          llvm::Value of the variable
    661     /// @param Offset       Offset
    662     /// @param VarInfo      Variable's debug info descriptor.
    663     /// @param InsertBefore Location for the new intrinsic.
    664     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
    665                                          DIVariable VarInfo,
    666                                          Instruction *InsertBefore);
    667 
    668   };
    669 } // end namespace llvm
    670 
    671 #endif
    672