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