[lit] Change lit.Test.ResultCode to be unique across pickling.
[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     /// @param UniqueIdentifier A unique identifier for the class.
283     DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
284                                     DIFile File, unsigned LineNumber,
285                                     uint64_t SizeInBits, uint64_t AlignInBits,
286                                     uint64_t OffsetInBits, unsigned Flags,
287                                     DIType DerivedFrom, DIArray Elements,
288                                     MDNode *VTableHolder = 0,
289                                     MDNode *TemplateParms = 0,
290                                     StringRef UniqueIdentifier = StringRef());
291
292     /// createStructType - Create debugging information entry for a struct.
293     /// @param Scope        Scope in which this struct is defined.
294     /// @param Name         Struct name.
295     /// @param File         File where this member is defined.
296     /// @param LineNumber   Line number.
297     /// @param SizeInBits   Member size.
298     /// @param AlignInBits  Member alignment.
299     /// @param Flags        Flags to encode member attribute, e.g. private
300     /// @param Elements     Struct elements.
301     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
302     /// @param UniqueIdentifier A unique identifier for the struct.
303     DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
304                                      DIFile File, unsigned LineNumber,
305                                      uint64_t SizeInBits, uint64_t AlignInBits,
306                                      unsigned Flags, DIType DerivedFrom,
307                                      DIArray Elements, unsigned RunTimeLang = 0,
308                                      MDNode *VTableHolder = 0,
309                                      StringRef UniqueIdentifier = StringRef());
310
311     /// createUnionType - Create debugging information entry for an union.
312     /// @param Scope        Scope in which this union is defined.
313     /// @param Name         Union name.
314     /// @param File         File where this member is defined.
315     /// @param LineNumber   Line number.
316     /// @param SizeInBits   Member size.
317     /// @param AlignInBits  Member alignment.
318     /// @param Flags        Flags to encode member attribute, e.g. private
319     /// @param Elements     Union elements.
320     /// @param RunTimeLang  Optional parameter, Objective-C runtime version.
321     /// @param UniqueIdentifier A unique identifier for the union.
322     DICompositeType createUnionType(
323         DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
324         uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
325         DIArray Elements, unsigned RunTimeLang = 0,
326         StringRef UniqueIdentifier = StringRef());
327
328     /// createTemplateTypeParameter - Create debugging information for template
329     /// type parameter.
330     /// @param Scope        Scope in which this type is defined.
331     /// @param Name         Type parameter name.
332     /// @param Ty           Parameter type.
333     /// @param File         File where this type parameter is defined.
334     /// @param LineNo       Line number.
335     /// @param ColumnNo     Column Number.
336     DITemplateTypeParameter
337     createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
338                                 MDNode *File = 0, unsigned LineNo = 0,
339                                 unsigned ColumnNo = 0);
340
341     /// createTemplateValueParameter - Create debugging information for template
342     /// value parameter.
343     /// @param Scope        Scope in which this type is defined.
344     /// @param Name         Value parameter name.
345     /// @param Ty           Parameter type.
346     /// @param Val          Constant parameter value.
347     /// @param File         File where this type parameter is defined.
348     /// @param LineNo       Line number.
349     /// @param ColumnNo     Column Number.
350     DITemplateValueParameter
351     createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
352                                  DIType Ty, Value *Val, MDNode *File = 0,
353                                  unsigned LineNo = 0, unsigned ColumnNo = 0);
354
355     /// \brief Create debugging information for a template template parameter.
356     /// @param Scope        Scope in which this type is defined.
357     /// @param Name         Value parameter name.
358     /// @param Ty           Parameter type.
359     /// @param Val          The fully qualified name of the template.
360     /// @param File         File where this type parameter is defined.
361     /// @param LineNo       Line number.
362     /// @param ColumnNo     Column Number.
363     DITemplateValueParameter
364     createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
365                                     DIType Ty, StringRef Val, MDNode *File = 0,
366                                     unsigned LineNo = 0, unsigned ColumnNo = 0);
367
368     /// \brief Create debugging information for a template parameter pack.
369     /// @param Scope        Scope in which this type is defined.
370     /// @param Name         Value parameter name.
371     /// @param Ty           Parameter type.
372     /// @param Val          An array of types in the pack.
373     /// @param File         File where this type parameter is defined.
374     /// @param LineNo       Line number.
375     /// @param ColumnNo     Column Number.
376     DITemplateValueParameter
377     createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
378                                 DIType Ty, DIArray Val, MDNode *File = 0,
379                                 unsigned LineNo = 0, unsigned ColumnNo = 0);
380
381     /// createArrayType - Create debugging information entry for an array.
382     /// @param Size         Array size.
383     /// @param AlignInBits  Alignment.
384     /// @param Ty           Element type.
385     /// @param Subscripts   Subscripts.
386     DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
387                                     DIType Ty, DIArray Subscripts);
388
389     /// createVectorType - Create debugging information entry for a vector type.
390     /// @param Size         Array size.
391     /// @param AlignInBits  Alignment.
392     /// @param Ty           Element type.
393     /// @param Subscripts   Subscripts.
394     DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
395                                      DIType Ty, DIArray Subscripts);
396
397     /// createEnumerationType - Create debugging information entry for an
398     /// enumeration.
399     /// @param Scope          Scope in which this enumeration is defined.
400     /// @param Name           Union name.
401     /// @param File           File where this member is defined.
402     /// @param LineNumber     Line number.
403     /// @param SizeInBits     Member size.
404     /// @param AlignInBits    Member alignment.
405     /// @param Elements       Enumeration elements.
406     /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
407     /// @param UniqueIdentifier A unique identifier for the enum.
408     DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
409         DIFile File, unsigned LineNumber, uint64_t SizeInBits,
410         uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
411         StringRef UniqueIdentifier = StringRef());
412
413     /// createSubroutineType - Create subroutine type.
414     /// @param File           File in which this subroutine is defined.
415     /// @param ParameterTypes An array of subroutine parameter types. This
416     ///                       includes return type at 0th index.
417     DICompositeType createSubroutineType(DIFile File, DIArray ParameterTypes);
418
419     /// createArtificialType - Create a new DIType with "artificial" flag set.
420     DIType createArtificialType(DIType Ty);
421
422     /// createObjectPointerType - Create a new DIType with the "object pointer"
423     /// flag set.
424     DIType createObjectPointerType(DIType Ty);
425
426     /// createForwardDecl - Create a temporary forward-declared type.
427     DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
428                                       DIDescriptor Scope, DIFile F,
429                                       unsigned Line, unsigned RuntimeLang = 0,
430                                       uint64_t SizeInBits = 0,
431                                       uint64_t AlignInBits = 0,
432                                       StringRef UniqueIdentifier = StringRef());
433
434     /// retainType - Retain DIType in a module even if it is not referenced
435     /// through debug info anchors.
436     void retainType(DIType T);
437
438     /// createUnspecifiedParameter - Create unspeicified type descriptor
439     /// for a subroutine type.
440     DIDescriptor createUnspecifiedParameter();
441
442     /// getOrCreateArray - Get a DIArray, create one if required.
443     DIArray getOrCreateArray(ArrayRef<Value *> Elements);
444
445     /// getOrCreateSubrange - Create a descriptor for a value range.  This
446     /// implicitly uniques the values returned.
447     DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
448
449     /// createGlobalVariable - Create a new descriptor for the specified global.
450     /// @param Name        Name of the variable.
451     /// @param File        File where this variable is defined.
452     /// @param LineNo      Line number.
453     /// @param Ty          Variable Type.
454     /// @param isLocalToUnit Boolean flag indicate whether this variable is
455     ///                      externally visible or not.
456     /// @param Val         llvm::Value of the variable.
457     DIGlobalVariable
458     createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
459                          DIType Ty, bool isLocalToUnit, llvm::Value *Val);
460
461     /// \brief Create a new descriptor for the specified global.
462     /// @param Name        Name of the variable.
463     /// @param LinkageName Mangled variable name.
464     /// @param File        File where this variable is defined.
465     /// @param LineNo      Line number.
466     /// @param Ty          Variable Type.
467     /// @param isLocalToUnit Boolean flag indicate whether this variable is
468     ///                      externally visible or not.
469     /// @param Val         llvm::Value of the variable.
470     DIGlobalVariable
471     createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
472                          unsigned LineNo, DIType Ty, bool isLocalToUnit,
473                          llvm::Value *Val);
474
475     /// createStaticVariable - Create a new descriptor for the specified
476     /// variable.
477     /// @param Context     Variable scope.
478     /// @param Name        Name of the variable.
479     /// @param LinkageName Mangled  name of the variable.
480     /// @param File        File where this variable is defined.
481     /// @param LineNo      Line number.
482     /// @param Ty          Variable Type.
483     /// @param isLocalToUnit Boolean flag indicate whether this variable is
484     ///                      externally visible or not.
485     /// @param Val         llvm::Value of the variable.
486     /// @param Decl        Reference to the corresponding declaration.
487     DIGlobalVariable
488     createStaticVariable(DIDescriptor Context, StringRef Name,
489                          StringRef LinkageName, DIFile File, unsigned LineNo,
490                          DIType Ty, bool isLocalToUnit, llvm::Value *Val,
491                          MDNode *Decl = NULL);
492
493
494     /// createLocalVariable - Create a new descriptor for the specified
495     /// local variable.
496     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
497     ///                    DW_TAG_arg_variable.
498     /// @param Scope       Variable scope.
499     /// @param Name        Variable name.
500     /// @param File        File where this variable is defined.
501     /// @param LineNo      Line number.
502     /// @param Ty          Variable Type
503     /// @param AlwaysPreserve Boolean. Set to true if debug info for this
504     ///                       variable should be preserved in optimized build.
505     /// @param Flags          Flags, e.g. artificial variable.
506     /// @param ArgNo       If this variable is an arugment then this argument's
507     ///                    number. 1 indicates 1st argument.
508     DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
509                                    StringRef Name,
510                                    DIFile File, unsigned LineNo,
511                                    DIType Ty, bool AlwaysPreserve = false,
512                                    unsigned Flags = 0,
513                                    unsigned ArgNo = 0);
514
515
516     /// createComplexVariable - Create a new descriptor for the specified
517     /// variable which has a complex address expression for its address.
518     /// @param Tag         Dwarf TAG. Usually DW_TAG_auto_variable or
519     ///                    DW_TAG_arg_variable.
520     /// @param Scope       Variable scope.
521     /// @param Name        Variable name.
522     /// @param F           File where this variable is defined.
523     /// @param LineNo      Line number.
524     /// @param Ty          Variable Type
525     /// @param Addr        An array of complex address operations.
526     /// @param ArgNo       If this variable is an arugment then this argument's
527     ///                    number. 1 indicates 1st argument.
528     DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
529                                      StringRef Name, DIFile F, unsigned LineNo,
530                                      DIType Ty, ArrayRef<Value *> Addr,
531                                      unsigned ArgNo = 0);
532
533     /// createFunction - Create a new descriptor for the specified subprogram.
534     /// See comments in DISubprogram for descriptions of these fields.
535     /// @param Scope         Function scope.
536     /// @param Name          Function name.
537     /// @param LinkageName   Mangled function name.
538     /// @param File          File where this variable is defined.
539     /// @param LineNo        Line number.
540     /// @param Ty            Function type.
541     /// @param isLocalToUnit True if this function is not externally visible..
542     /// @param isDefinition  True if this is a function definition.
543     /// @param ScopeLine     Set to the beginning of the scope this starts
544     /// @param Flags         e.g. is this function prototyped or not.
545     ///                      This flags are used to emit dwarf attributes.
546     /// @param isOptimized   True if optimization is ON.
547     /// @param Fn            llvm::Function pointer.
548     /// @param TParam        Function template parameters.
549     DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
550                                 StringRef LinkageName,
551                                 DIFile File, unsigned LineNo,
552                                 DICompositeType Ty, bool isLocalToUnit,
553                                 bool isDefinition,
554                                 unsigned ScopeLine,
555                                 unsigned Flags = 0,
556                                 bool isOptimized = false,
557                                 Function *Fn = 0,
558                                 MDNode *TParam = 0,
559                                 MDNode *Decl = 0);
560
561     /// createMethod - Create a new descriptor for the specified C++ method.
562     /// See comments in DISubprogram for descriptions of these fields.
563     /// @param Scope         Function scope.
564     /// @param Name          Function name.
565     /// @param LinkageName   Mangled function name.
566     /// @param File          File where this variable is defined.
567     /// @param LineNo        Line number.
568     /// @param Ty            Function type.
569     /// @param isLocalToUnit True if this function is not externally visible..
570     /// @param isDefinition  True if this is a function definition.
571     /// @param Virtuality    Attributes describing virtualness. e.g. pure
572     ///                      virtual function.
573     /// @param VTableIndex   Index no of this method in virtual table.
574     /// @param VTableHolder  Type that holds vtable.
575     /// @param Flags         e.g. is this function prototyped or not.
576     ///                      This flags are used to emit dwarf attributes.
577     /// @param isOptimized   True if optimization is ON.
578     /// @param Fn            llvm::Function pointer.
579     /// @param TParam        Function template parameters.
580     DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
581                               StringRef LinkageName,
582                               DIFile File, unsigned LineNo,
583                               DICompositeType Ty, bool isLocalToUnit,
584                               bool isDefinition,
585                               unsigned Virtuality = 0, unsigned VTableIndex = 0,
586                               MDNode *VTableHolder = 0,
587                               unsigned Flags = 0,
588                               bool isOptimized = false,
589                               Function *Fn = 0,
590                               MDNode *TParam = 0);
591
592     /// createNameSpace - This creates new descriptor for a namespace
593     /// with the specified parent scope.
594     /// @param Scope       Namespace scope
595     /// @param Name        Name of this namespace
596     /// @param File        Source file
597     /// @param LineNo      Line number
598     DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
599                                 DIFile File, unsigned LineNo);
600
601
602     /// createLexicalBlockFile - This creates a descriptor for a lexical
603     /// block with a new file attached. This merely extends the existing
604     /// lexical block as it crosses a file.
605     /// @param Scope       Lexical block.
606     /// @param File        Source file.
607     DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
608                                               DIFile File);
609
610     /// createLexicalBlock - This creates a descriptor for a lexical block
611     /// with the specified parent context.
612     /// @param Scope       Parent lexical scope.
613     /// @param File        Source file
614     /// @param Line        Line number
615     /// @param Col         Column number
616     DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
617                                       unsigned Line, unsigned Col);
618
619     /// \brief Create a descriptor for an imported module.
620     /// @param Context The scope this module is imported into
621     /// @param NS The namespace being imported here
622     /// @param Line Line number
623     DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
624                                           unsigned Line,
625                                           StringRef Name = StringRef());
626
627     /// \brief Create a descriptor for an imported module.
628     /// @param Context The scope this module is imported into
629     /// @param NS An aliased namespace
630     /// @param Line Line number
631     DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
632                                           unsigned Line, StringRef Name);
633
634     /// \brief Create a descriptor for an imported function.
635     /// @param Context The scope this module is imported into
636     /// @param Decl The declaration (or definition) of a function, type, or
637     ///             variable
638     /// @param Line Line number
639     DIImportedEntity createImportedDeclaration(DIScope Context,
640                                                DIDescriptor Decl,
641                                                unsigned Line);
642
643     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
644     /// @param Storage     llvm::Value of the variable
645     /// @param VarInfo     Variable's debug info descriptor.
646     /// @param InsertAtEnd Location for the new intrinsic.
647     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
648                                BasicBlock *InsertAtEnd);
649
650     /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
651     /// @param Storage      llvm::Value of the variable
652     /// @param VarInfo      Variable's debug info descriptor.
653     /// @param InsertBefore Location for the new intrinsic.
654     Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
655                                Instruction *InsertBefore);
656
657
658     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
659     /// @param Val          llvm::Value of the variable
660     /// @param Offset       Offset
661     /// @param VarInfo      Variable's debug info descriptor.
662     /// @param InsertAtEnd Location for the new intrinsic.
663     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
664                                          DIVariable VarInfo,
665                                          BasicBlock *InsertAtEnd);
666
667     /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
668     /// @param Val          llvm::Value of the variable
669     /// @param Offset       Offset
670     /// @param VarInfo      Variable's debug info descriptor.
671     /// @param InsertBefore Location for the new intrinsic.
672     Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
673                                          DIVariable VarInfo,
674                                          Instruction *InsertBefore);
675
676   };
677 } // end namespace llvm
678
679 #endif