Add difference_type to ImmutableMap/Set iterators so they have a complete set of...
[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 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     DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
423                                       DIDescriptor Scope, DIFile F,
424                                       unsigned Line, unsigned RuntimeLang = 0,
425                                       uint64_t SizeInBits = 0,
426                                       uint64_t AlignInBits = 0);
427
428     /// retainType - Retain DIType in a module even if it is not referenced
429     /// through debug info anchors.
430     void retainType(DIType T);
431
432     /// createUnspecifiedParameter - Create unspeicified type descriptor
433     /// for a subroutine type.
434     DIDescriptor createUnspecifiedParameter();
435
436     /// getOrCreateArray - Get a DIArray, create one if required.
437     DIArray getOrCreateArray(ArrayRef<Value *> Elements);
438
439     /// getOrCreateSubrange - Create a descriptor for a value range.  This
440     /// implicitly uniques the values returned.
441     DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
442
443     /// createGlobalVariable - Create a new descriptor for the specified global.
444     /// @param Name        Name of the variable.
445     /// @param File        File where this variable is defined.
446     /// @param LineNo      Line number.
447     /// @param Ty          Variable Type.
448     /// @param isLocalToUnit Boolean flag indicate whether this variable is
449     ///                      externally visible or not.
450     /// @param Val         llvm::Value of the variable.
451     DIGlobalVariable
452     createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
453                          DIType Ty, bool isLocalToUnit, llvm::Value *Val);
454
455     /// \brief Create a new descriptor for the specified global.
456     /// @param Name        Name of the variable.
457     /// @param LinkageName Mangled variable name.
458     /// @param File        File where this variable is defined.
459     /// @param LineNo      Line number.
460     /// @param Ty          Variable Type.
461     /// @param isLocalToUnit Boolean flag indicate whether this variable is
462     ///                      externally visible or not.
463     /// @param Val         llvm::Value of the variable.
464     DIGlobalVariable
465     createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
466                          unsigned LineNo, DIType Ty, bool isLocalToUnit,
467                          llvm::Value *Val);
468
469     /// createStaticVariable - Create a new descriptor for the specified
470     /// variable.
471     /// @param Context     Variable scope.
472     /// @param Name        Name of the variable.
473     /// @param LinkageName Mangled  name of the variable.
474     /// @param File        File where this variable is defined.
475     /// @param LineNo      Line number.
476     /// @param Ty          Variable Type.
477     /// @param isLocalToUnit Boolean flag indicate whether this variable is
478     ///                      externally visible or not.
479     /// @param Val         llvm::Value of the variable.
480     /// @param Decl        Reference to the corresponding declaration.
481     DIGlobalVariable
482     createStaticVariable(DIDescriptor Context, StringRef Name,
483                          StringRef LinkageName, DIFile File, unsigned LineNo,
484                          DIType Ty, bool isLocalToUnit, llvm::Value *Val,
485                          MDNode *Decl = NULL);
486
487
488     /// createLocalVariable - Create a new descriptor for the specified
489     /// local variable.
490     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
491     ///                    DW_TAG_arg_variable.
492     /// @param Scope       Variable scope.
493     /// @param Name        Variable name.
494     /// @param File        File where this variable is defined.
495     /// @param LineNo      Line number.
496     /// @param Ty          Variable Type
497     /// @param AlwaysPreserve Boolean. Set to true if debug info for this
498     ///                       variable should be preserved in optimized build.
499     /// @param Flags          Flags, e.g. artificial variable.
500     /// @param ArgNo       If this variable is an arugment then this argument's
501     ///                    number. 1 indicates 1st argument.
502     DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
503                                    StringRef Name,
504                                    DIFile File, unsigned LineNo,
505                                    DIType Ty, bool AlwaysPreserve = false,
506                                    unsigned Flags = 0,
507                                    unsigned ArgNo = 0);
508
509
510     /// createComplexVariable - Create a new descriptor for the specified
511     /// variable which has a complex address expression for its address.
512     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
513     ///                    DW_TAG_arg_variable.
514     /// @param Scope       Variable scope.
515     /// @param Name        Variable name.
516     /// @param F           File where this variable is defined.
517     /// @param LineNo      Line number.
518     /// @param Ty          Variable Type
519     /// @param Addr        An array of complex address operations.
520     /// @param ArgNo       If this variable is an arugment then this argument's
521     ///                    number. 1 indicates 1st argument.
522     DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
523                                      StringRef Name, DIFile F, unsigned LineNo,
524                                      DIType Ty, ArrayRef<Value *> Addr,
525                                      unsigned ArgNo = 0);
526
527     /// createFunction - Create a new descriptor for the specified subprogram.
528     /// See comments in DISubprogram for descriptions of these fields.
529     /// @param Scope         Function scope.
530     /// @param Name          Function name.
531     /// @param LinkageName   Mangled function name.
532     /// @param File          File where this variable is defined.
533     /// @param LineNo        Line number.
534     /// @param Ty            Function type.
535     /// @param isLocalToUnit True if this function is not externally visible..
536     /// @param isDefinition  True if this is a function definition.
537     /// @param ScopeLine     Set to the beginning of the scope this starts
538     /// @param Flags         e.g. is this function prototyped or not.
539     ///                      This flags are used to emit dwarf attributes.
540     /// @param isOptimized   True if optimization is ON.
541     /// @param Fn            llvm::Function pointer.
542     /// @param TParam        Function template parameters.
543     DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
544                                 StringRef LinkageName,
545                                 DIFile File, unsigned LineNo,
546                                 DICompositeType Ty, bool isLocalToUnit,
547                                 bool isDefinition,
548                                 unsigned ScopeLine,
549                                 unsigned Flags = 0,
550                                 bool isOptimized = false,
551                                 Function *Fn = 0,
552                                 MDNode *TParam = 0,
553                                 MDNode *Decl = 0);
554
555     /// createMethod - Create a new descriptor for the specified C++ method.
556     /// See comments in DISubprogram for descriptions of these fields.
557     /// @param Scope         Function scope.
558     /// @param Name          Function name.
559     /// @param LinkageName   Mangled function name.
560     /// @param File          File where this variable is defined.
561     /// @param LineNo        Line number.
562     /// @param Ty            Function type.
563     /// @param isLocalToUnit True if this function is not externally visible..
564     /// @param isDefinition  True if this is a function definition.
565     /// @param Virtuality    Attributes describing virtualness. e.g. pure
566     ///                      virtual function.
567     /// @param VTableIndex   Index no of this method in virtual table.
568     /// @param VTableHolder  Type that holds vtable.
569     /// @param Flags         e.g. is this function prototyped or not.
570     ///                      This flags are used to emit dwarf attributes.
571     /// @param isOptimized   True if optimization is ON.
572     /// @param Fn            llvm::Function pointer.
573     /// @param TParam        Function template parameters.
574     DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
575                               StringRef LinkageName,
576                               DIFile File, unsigned LineNo,
577                               DICompositeType Ty, bool isLocalToUnit,
578                               bool isDefinition,
579                               unsigned Virtuality = 0, unsigned VTableIndex = 0,
580                               MDNode *VTableHolder = 0,
581                               unsigned Flags = 0,
582                               bool isOptimized = false,
583                               Function *Fn = 0,
584                               MDNode *TParam = 0);
585
586     /// createNameSpace - This creates new descriptor for a namespace
587     /// with the specified parent scope.
588     /// @param Scope       Namespace scope
589     /// @param Name        Name of this namespace
590     /// @param File        Source file
591     /// @param LineNo      Line number
592     DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
593                                 DIFile File, unsigned LineNo);
594
595
596     /// createLexicalBlockFile - This creates a descriptor for a lexical
597     /// block with a new file attached. This merely extends the existing
598     /// lexical block as it crosses a file.
599     /// @param Scope       Lexical block.
600     /// @param File        Source file.
601     DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
602                                               DIFile File);
603
604     /// createLexicalBlock - This creates a descriptor for a lexical block
605     /// with the specified parent context.
606     /// @param Scope       Parent lexical scope.
607     /// @param File        Source file
608     /// @param Line        Line number
609     /// @param Col         Column number
610     DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
611                                       unsigned Line, unsigned Col);
612
613     /// \brief Create a descriptor for an imported module.
614     /// @param Context The scope this module is imported into
615     /// @param NS The namespace being imported here
616     /// @param Line Line number
617     DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
618                                           unsigned Line,
619                                           StringRef Name = StringRef());
620
621     /// \brief Create a descriptor for an imported module.
622     /// @param Context The scope this module is imported into
623     /// @param NS An aliased namespace
624     /// @param Line Line number
625     DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
626                                           unsigned Line, StringRef Name);
627
628     /// \brief Create a descriptor for an imported function.
629     /// @param Context The scope this module is imported into
630     /// @param Decl The declaration (or definition) of a function, type, or
631     ///             variable
632     /// @param Line Line number
633     DIImportedEntity createImportedDeclaration(DIScope Context,
634                                                DIDescriptor Decl,
635                                                unsigned Line);
636
637     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
638     /// @param Storage     llvm::Value of the variable
639     /// @param VarInfo     Variable's debug info descriptor.
640     /// @param InsertAtEnd Location for the new intrinsic.
641     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
642                                BasicBlock *InsertAtEnd);
643
644     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
645     /// @param Storage      llvm::Value of the variable
646     /// @param VarInfo      Variable's debug info descriptor.
647     /// @param InsertBefore Location for the new intrinsic.
648     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
649                                Instruction *InsertBefore);
650
651
652     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
653     /// @param Val          llvm::Value of the variable
654     /// @param Offset       Offset
655     /// @param VarInfo      Variable's debug info descriptor.
656     /// @param InsertAtEnd Location for the new intrinsic.
657     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
658                                          DIVariable VarInfo,
659                                          BasicBlock *InsertAtEnd);
660
661     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
662     /// @param Val          llvm::Value of the variable
663     /// @param Offset       Offset
664     /// @param VarInfo      Variable's debug info descriptor.
665     /// @param InsertBefore Location for the new intrinsic.
666     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
667                                          DIVariable VarInfo,
668                                          Instruction *InsertBefore);
669
670   };
671 } // end namespace llvm
672
673 #endif