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