LLVM API Documentation

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