1 //===- DIBuilder.h - Debug Information Builder ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a DIBuilder that is useful for creating debugging
11 // information entries in LLVM IR form.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IR_DIBUILDER_H
16 #define LLVM_IR_DIBUILDER_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/IR/DebugInfo.h"
21 #include "llvm/IR/ValueHandle.h"
22 #include "llvm/Support/DataTypes.h"
35 class DICompositeType;
42 class DIGlobalVariable;
43 class DIImportedEntity;
47 class DILexicalBlockFile;
51 class DITemplateTypeParameter;
52 class DITemplateValueParameter;
58 LLVMContext &VMContext;
60 MDNode *TempEnumTypes;
61 MDNode *TempRetainTypes;
62 MDNode *TempSubprograms;
64 MDNode *TempImportedModules;
66 Function *DeclareFn; // llvm.dbg.declare
67 Function *ValueFn; // llvm.dbg.value
69 SmallVector<Value *, 4> AllEnumTypes;
70 /// Use TrackingVH to collect RetainTypes, since they can be updated
72 SmallVector<TrackingVH<MDNode>, 4> AllRetainTypes;
73 SmallVector<Value *, 4> AllSubprograms;
74 SmallVector<Value *, 4> AllGVs;
75 SmallVector<TrackingVH<MDNode>, 4> AllImportedModules;
77 // Private use for multiple types of template parameters.
78 DITemplateValueParameter
79 createTemplateValueParameter(unsigned Tag, DIDescriptor Scope,
80 StringRef Name, DIType Ty, Value *Val,
81 MDNode *File = nullptr, unsigned LineNo = 0,
82 unsigned ColumnNo = 0);
84 DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
85 void operator=(const DIBuilder &) LLVM_DELETED_FUNCTION;
88 explicit DIBuilder(Module &M);
89 enum ComplexAddrKind { OpPlus=1, OpDeref };
90 enum DebugEmissionKind { FullDebug=1, LineTablesOnly };
92 /// finalize - Construct any deferred debug info descriptors.
95 /// createCompileUnit - A CompileUnit provides an anchor for all debugging
96 /// information generated during this instance of compilation.
97 /// @param Lang Source programming language, eg. dwarf::DW_LANG_C99
98 /// @param File File name
99 /// @param Dir Directory
100 /// @param Producer Identify the producer of debugging information and code.
101 /// Usually this is a compiler version string.
102 /// @param isOptimized A boolean flag which indicates whether optimization
104 /// @param Flags This string lists command line options. This string is
105 /// directly embedded in debug info output which may be used
106 /// by a tool analyzing generated debugging information.
107 /// @param RV This indicates runtime version for languages like
109 /// @param SplitName The name of the file that we'll split debug info out
111 DICompileUnit createCompileUnit(unsigned Lang, StringRef File,
112 StringRef Dir, StringRef Producer,
113 bool isOptimized, StringRef Flags,
115 StringRef SplitName = StringRef(),
116 DebugEmissionKind Kind = FullDebug);
118 /// createFile - Create a file descriptor to hold debugging information
120 DIFile createFile(StringRef Filename, StringRef Directory);
122 /// createEnumerator - Create a single enumerator value.
123 DIEnumerator createEnumerator(StringRef Name, int64_t Val);
125 /// \brief Create a DWARF unspecified type.
126 DIBasicType createUnspecifiedType(StringRef Name);
128 /// \brief Create C++11 nullptr type.
129 DIBasicType createNullPtrType();
131 /// createBasicType - Create debugging information entry for a basic
133 /// @param Name Type name.
134 /// @param SizeInBits Size of the type.
135 /// @param AlignInBits Type alignment.
136 /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
137 DIBasicType createBasicType(StringRef Name, uint64_t SizeInBits,
138 uint64_t AlignInBits, unsigned Encoding);
140 /// createQualifiedType - Create debugging information entry for a qualified
141 /// type, e.g. 'const int'.
142 /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
143 /// @param FromTy Base Type.
144 DIDerivedType createQualifiedType(unsigned Tag, DIType FromTy);
146 /// createPointerType - Create debugging information entry for a pointer.
147 /// @param PointeeTy Type pointed by this pointer.
148 /// @param SizeInBits Size.
149 /// @param AlignInBits Alignment. (optional)
150 /// @param Name Pointer type name. (optional)
152 createPointerType(DIType PointeeTy, uint64_t SizeInBits,
153 uint64_t AlignInBits = 0, StringRef Name = StringRef());
155 /// \brief Create debugging information entry for a pointer to member.
156 /// @param PointeeTy Type pointed to by this pointer.
157 /// @param Class Type for which this pointer points to members of.
158 DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
160 /// createReferenceType - Create debugging information entry for a c++
161 /// style reference or rvalue reference type.
162 DIDerivedType createReferenceType(unsigned Tag, DIType RTy);
164 /// createTypedef - Create debugging information entry for a typedef.
165 /// @param Ty Original type.
166 /// @param Name Typedef name.
167 /// @param File File where this type is defined.
168 /// @param LineNo Line number.
169 /// @param Context The surrounding context for the typedef.
170 DIDerivedType createTypedef(DIType Ty, StringRef Name, DIFile File,
171 unsigned LineNo, DIDescriptor Context);
173 /// createFriend - Create debugging information entry for a 'friend'.
174 DIDerivedType createFriend(DIType Ty, DIType FriendTy);
176 /// createInheritance - Create debugging information entry to establish
177 /// inheritance relationship between two types.
178 /// @param Ty Original type.
179 /// @param BaseTy Base type. Ty is inherits from base.
180 /// @param BaseOffset Base offset.
181 /// @param Flags Flags to describe inheritance attribute,
183 DIDerivedType createInheritance(DIType Ty, DIType BaseTy,
184 uint64_t BaseOffset, unsigned Flags);
186 /// createMemberType - Create debugging information entry for a member.
187 /// @param Scope Member scope.
188 /// @param Name Member name.
189 /// @param File File where this member is defined.
190 /// @param LineNo Line number.
191 /// @param SizeInBits Member size.
192 /// @param AlignInBits Member alignment.
193 /// @param OffsetInBits Member offset.
194 /// @param Flags Flags to encode member attribute, e.g. private
195 /// @param Ty Parent type.
197 createMemberType(DIDescriptor Scope, StringRef Name, DIFile File,
198 unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
199 uint64_t OffsetInBits, unsigned Flags, DIType Ty);
201 /// createStaticMemberType - Create debugging information entry for a
202 /// C++ static data member.
203 /// @param Scope Member scope.
204 /// @param Name Member name.
205 /// @param File File where this member is declared.
206 /// @param LineNo Line number.
207 /// @param Ty Type of the static member.
208 /// @param Flags Flags to encode member attribute, e.g. private.
209 /// @param Val Const initializer of the member.
211 createStaticMemberType(DIDescriptor Scope, StringRef Name,
212 DIFile File, unsigned LineNo, DIType Ty,
213 unsigned Flags, llvm::Value *Val);
215 /// createObjCIVar - Create debugging information entry for Objective-C
216 /// instance variable.
217 /// @param Name Member name.
218 /// @param File File where this member is defined.
219 /// @param LineNo Line number.
220 /// @param SizeInBits Member size.
221 /// @param AlignInBits Member alignment.
222 /// @param OffsetInBits Member offset.
223 /// @param Flags Flags to encode member attribute, e.g. private
224 /// @param Ty Parent type.
225 /// @param PropertyName Name of the Objective C property associated with
227 /// @param PropertyGetterName Name of the Objective C property getter
229 /// @param PropertySetterName Name of the Objective C property setter
231 /// @param PropertyAttributes Objective C property attributes.
232 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
233 unsigned LineNo, uint64_t SizeInBits,
234 uint64_t AlignInBits, uint64_t OffsetInBits,
235 unsigned Flags, DIType Ty,
236 StringRef PropertyName = StringRef(),
237 StringRef PropertyGetterName = StringRef(),
238 StringRef PropertySetterName = StringRef(),
239 unsigned PropertyAttributes = 0);
241 /// createObjCIVar - Create debugging information entry for Objective-C
242 /// instance variable.
243 /// @param Name Member name.
244 /// @param File File where this member is defined.
245 /// @param LineNo Line number.
246 /// @param SizeInBits Member size.
247 /// @param AlignInBits Member alignment.
248 /// @param OffsetInBits Member offset.
249 /// @param Flags Flags to encode member attribute, e.g. private
250 /// @param Ty Parent type.
251 /// @param PropertyNode Property associated with this ivar.
252 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
253 unsigned LineNo, uint64_t SizeInBits,
254 uint64_t AlignInBits, uint64_t OffsetInBits,
255 unsigned Flags, DIType Ty,
256 MDNode *PropertyNode);
258 /// createObjCProperty - Create debugging information entry for Objective-C
260 /// @param Name Property name.
261 /// @param File File where this property is defined.
262 /// @param LineNumber Line number.
263 /// @param GetterName Name of the Objective C property getter selector.
264 /// @param SetterName Name of the Objective C property setter selector.
265 /// @param PropertyAttributes Objective C property attributes.
267 DIObjCProperty createObjCProperty(StringRef Name,
268 DIFile File, unsigned LineNumber,
269 StringRef GetterName,
270 StringRef SetterName,
271 unsigned PropertyAttributes,
274 /// createClassType - Create debugging information entry for a class.
275 /// @param Scope Scope in which this class is defined.
276 /// @param Name class name.
277 /// @param File File where this member is defined.
278 /// @param LineNumber Line number.
279 /// @param SizeInBits Member size.
280 /// @param AlignInBits Member alignment.
281 /// @param OffsetInBits Member offset.
282 /// @param Flags Flags to encode member attribute, e.g. private
283 /// @param Elements class members.
284 /// @param VTableHolder Debug info of the base class that contains vtable
285 /// for this type. This is used in
286 /// DW_AT_containing_type. See DWARF documentation
288 /// @param TemplateParms Template type parameters.
289 /// @param UniqueIdentifier A unique identifier for the class.
290 DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
291 DIFile File, unsigned LineNumber,
292 uint64_t SizeInBits, uint64_t AlignInBits,
293 uint64_t OffsetInBits, unsigned Flags,
294 DIType DerivedFrom, DIArray Elements,
295 DIType VTableHolder = DIType(),
296 MDNode *TemplateParms = nullptr,
297 StringRef UniqueIdentifier = StringRef());
299 /// createStructType - Create debugging information entry for a struct.
300 /// @param Scope Scope in which this struct is defined.
301 /// @param Name Struct name.
302 /// @param File File where this member is defined.
303 /// @param LineNumber Line number.
304 /// @param SizeInBits Member size.
305 /// @param AlignInBits Member alignment.
306 /// @param Flags Flags to encode member attribute, e.g. private
307 /// @param Elements Struct elements.
308 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
309 /// @param UniqueIdentifier A unique identifier for the struct.
310 DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
311 DIFile File, unsigned LineNumber,
312 uint64_t SizeInBits, uint64_t AlignInBits,
313 unsigned Flags, DIType DerivedFrom,
314 DIArray Elements, unsigned RunTimeLang = 0,
315 DIType VTableHolder = DIType(),
316 StringRef UniqueIdentifier = StringRef());
318 /// createUnionType - Create debugging information entry for an union.
319 /// @param Scope Scope in which this union is defined.
320 /// @param Name Union name.
321 /// @param File File where this member is defined.
322 /// @param LineNumber Line number.
323 /// @param SizeInBits Member size.
324 /// @param AlignInBits Member alignment.
325 /// @param Flags Flags to encode member attribute, e.g. private
326 /// @param Elements Union elements.
327 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
328 /// @param UniqueIdentifier A unique identifier for the union.
329 DICompositeType createUnionType(
330 DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
331 uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
332 DIArray Elements, unsigned RunTimeLang = 0,
333 StringRef UniqueIdentifier = StringRef());
335 /// createTemplateTypeParameter - Create debugging information for template
337 /// @param Scope Scope in which this type is defined.
338 /// @param Name Type parameter name.
339 /// @param Ty Parameter type.
340 /// @param File File where this type parameter is defined.
341 /// @param LineNo Line number.
342 /// @param ColumnNo Column Number.
343 DITemplateTypeParameter
344 createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
345 MDNode *File = nullptr, unsigned LineNo = 0,
346 unsigned ColumnNo = 0);
348 /// createTemplateValueParameter - Create debugging information for template
350 /// @param Scope Scope in which this type is defined.
351 /// @param Name Value parameter name.
352 /// @param Ty Parameter type.
353 /// @param Val Constant parameter value.
354 /// @param File File where this type parameter is defined.
355 /// @param LineNo Line number.
356 /// @param ColumnNo Column Number.
357 DITemplateValueParameter
358 createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
359 DIType Ty, Value *Val, MDNode *File = nullptr,
360 unsigned LineNo = 0, unsigned ColumnNo = 0);
362 /// \brief Create debugging information for a template template parameter.
363 /// @param Scope Scope in which this type is defined.
364 /// @param Name Value parameter name.
365 /// @param Ty Parameter type.
366 /// @param Val The fully qualified name of the template.
367 /// @param File File where this type parameter is defined.
368 /// @param LineNo Line number.
369 /// @param ColumnNo Column Number.
370 DITemplateValueParameter
371 createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
372 DIType Ty, StringRef Val,
373 MDNode *File = nullptr, unsigned LineNo = 0,
374 unsigned ColumnNo = 0);
376 /// \brief Create debugging information for a template parameter pack.
377 /// @param Scope Scope in which this type is defined.
378 /// @param Name Value parameter name.
379 /// @param Ty Parameter type.
380 /// @param Val An array of types in the pack.
381 /// @param File File where this type parameter is defined.
382 /// @param LineNo Line number.
383 /// @param ColumnNo Column Number.
384 DITemplateValueParameter
385 createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
386 DIType Ty, DIArray Val, MDNode *File = nullptr,
387 unsigned LineNo = 0, unsigned ColumnNo = 0);
389 /// createArrayType - Create debugging information entry for an array.
390 /// @param Size Array size.
391 /// @param AlignInBits Alignment.
392 /// @param Ty Element type.
393 /// @param Subscripts Subscripts.
394 DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
395 DIType Ty, DIArray Subscripts);
397 /// createVectorType - Create debugging information entry for a vector type.
398 /// @param Size Array size.
399 /// @param AlignInBits Alignment.
400 /// @param Ty Element type.
401 /// @param Subscripts Subscripts.
402 DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
403 DIType Ty, DIArray Subscripts);
405 /// createEnumerationType - Create debugging information entry for an
407 /// @param Scope Scope in which this enumeration is defined.
408 /// @param Name Union name.
409 /// @param File File where this member is defined.
410 /// @param LineNumber Line number.
411 /// @param SizeInBits Member size.
412 /// @param AlignInBits Member alignment.
413 /// @param Elements Enumeration elements.
414 /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
415 /// @param UniqueIdentifier A unique identifier for the enum.
416 DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
417 DIFile File, unsigned LineNumber, uint64_t SizeInBits,
418 uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
419 StringRef UniqueIdentifier = StringRef());
421 /// createSubroutineType - Create subroutine type.
422 /// @param File File in which this subroutine is defined.
423 /// @param ParameterTypes An array of subroutine parameter types. This
424 /// includes return type at 0th index.
425 /// @param Flags E.g.: LValueReference.
426 /// These flags are used to emit dwarf attributes.
427 DICompositeType createSubroutineType(DIFile File, DIArray ParameterTypes,
430 /// createArtificialType - Create a new DIType with "artificial" flag set.
431 DIType createArtificialType(DIType Ty);
433 /// createObjectPointerType - Create a new DIType with the "object pointer"
435 DIType createObjectPointerType(DIType Ty);
437 /// createForwardDecl - Create a temporary forward-declared type.
438 DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
439 DIDescriptor Scope, DIFile F,
440 unsigned Line, unsigned RuntimeLang = 0,
441 uint64_t SizeInBits = 0,
442 uint64_t AlignInBits = 0,
443 StringRef UniqueIdentifier = StringRef());
445 /// retainType - Retain DIType in a module even if it is not referenced
446 /// through debug info anchors.
447 void retainType(DIType T);
449 /// createUnspecifiedParameter - Create unspecified type descriptor
450 /// for a subroutine type.
451 DIDescriptor createUnspecifiedParameter();
453 /// getOrCreateArray - Get a DIArray, create one if required.
454 DIArray getOrCreateArray(ArrayRef<Value *> Elements);
456 /// getOrCreateSubrange - Create a descriptor for a value range. This
457 /// implicitly uniques the values returned.
458 DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
460 /// createGlobalVariable - Create a new descriptor for the specified global.
461 /// @param Name Name of the variable.
462 /// @param File File where this variable is defined.
463 /// @param LineNo Line number.
464 /// @param Ty Variable Type.
465 /// @param isLocalToUnit Boolean flag indicate whether this variable is
466 /// externally visible or not.
467 /// @param Val llvm::Value of the variable.
469 createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
470 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val);
472 /// \brief Create a new descriptor for the specified global.
473 /// @param Name Name of the variable.
474 /// @param LinkageName Mangled variable name.
475 /// @param File File where this variable is defined.
476 /// @param LineNo Line number.
477 /// @param Ty Variable Type.
478 /// @param isLocalToUnit Boolean flag indicate whether this variable is
479 /// externally visible or not.
480 /// @param Val llvm::Value of the variable.
482 createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
483 unsigned LineNo, DITypeRef Ty, bool isLocalToUnit,
486 /// createStaticVariable - Create a new descriptor for the specified
488 /// @param Context Variable scope.
489 /// @param Name Name of the variable.
490 /// @param LinkageName Mangled name of the variable.
491 /// @param File File where this variable is defined.
492 /// @param LineNo Line number.
493 /// @param Ty Variable Type.
494 /// @param isLocalToUnit Boolean flag indicate whether this variable is
495 /// externally visible or not.
496 /// @param Val llvm::Value of the variable.
497 /// @param Decl Reference to the corresponding declaration.
499 createStaticVariable(DIDescriptor Context, StringRef Name,
500 StringRef LinkageName, DIFile File, unsigned LineNo,
501 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
502 MDNode *Decl = nullptr);
505 /// createLocalVariable - Create a new descriptor for the specified
507 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
508 /// DW_TAG_arg_variable.
509 /// @param Scope Variable scope.
510 /// @param Name Variable name.
511 /// @param File File where this variable is defined.
512 /// @param LineNo Line number.
513 /// @param Ty Variable Type
514 /// @param AlwaysPreserve Boolean. Set to true if debug info for this
515 /// variable should be preserved in optimized build.
516 /// @param Flags Flags, e.g. artificial variable.
517 /// @param ArgNo If this variable is an argument then this argument's
518 /// number. 1 indicates 1st argument.
519 DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
521 DIFile File, unsigned LineNo,
522 DITypeRef Ty, bool AlwaysPreserve = false,
527 /// createComplexVariable - Create a new descriptor for the specified
528 /// variable which has a complex address expression for its address.
529 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
530 /// DW_TAG_arg_variable.
531 /// @param Scope Variable scope.
532 /// @param Name Variable name.
533 /// @param F File where this variable is defined.
534 /// @param LineNo Line number.
535 /// @param Ty Variable Type
536 /// @param Addr An array of complex address operations.
537 /// @param ArgNo If this variable is an argument then this argument's
538 /// number. 1 indicates 1st argument.
539 DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
540 StringRef Name, DIFile F, unsigned LineNo,
541 DITypeRef Ty, ArrayRef<Value *> Addr,
544 /// createFunction - Create a new descriptor for the specified subprogram.
545 /// See comments in DISubprogram for descriptions of these fields.
546 /// @param Scope Function scope.
547 /// @param Name Function name.
548 /// @param LinkageName Mangled function name.
549 /// @param File File where this variable is defined.
550 /// @param LineNo Line number.
551 /// @param Ty Function type.
552 /// @param isLocalToUnit True if this function is not externally visible.
553 /// @param isDefinition True if this is a function definition.
554 /// @param ScopeLine Set to the beginning of the scope this starts
555 /// @param Flags e.g. is this function prototyped or not.
556 /// These flags are used to emit dwarf attributes.
557 /// @param isOptimized True if optimization is ON.
558 /// @param Fn llvm::Function pointer.
559 /// @param TParam Function template parameters.
560 DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
561 StringRef LinkageName,
562 DIFile File, unsigned LineNo,
563 DICompositeType Ty, bool isLocalToUnit,
567 bool isOptimized = false,
568 Function *Fn = nullptr,
569 MDNode *TParam = nullptr,
570 MDNode *Decl = nullptr);
572 /// FIXME: this is added for dragonegg. Once we update dragonegg
573 /// to call resolve function, this will be removed.
574 DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
575 StringRef LinkageName,
576 DIFile File, unsigned LineNo,
577 DICompositeType Ty, bool isLocalToUnit,
581 bool isOptimized = false,
582 Function *Fn = nullptr,
583 MDNode *TParam = nullptr,
584 MDNode *Decl = nullptr);
586 /// createMethod - Create a new descriptor for the specified C++ method.
587 /// See comments in DISubprogram for descriptions of these fields.
588 /// @param Scope Function scope.
589 /// @param Name Function name.
590 /// @param LinkageName Mangled function name.
591 /// @param File File where this variable is defined.
592 /// @param LineNo Line number.
593 /// @param Ty Function type.
594 /// @param isLocalToUnit True if this function is not externally visible..
595 /// @param isDefinition True if this is a function definition.
596 /// @param Virtuality Attributes describing virtualness. e.g. pure
597 /// virtual function.
598 /// @param VTableIndex Index no of this method in virtual table.
599 /// @param VTableHolder Type that holds vtable.
600 /// @param Flags e.g. is this function prototyped or not.
601 /// This flags are used to emit dwarf attributes.
602 /// @param isOptimized True if optimization is ON.
603 /// @param Fn llvm::Function pointer.
604 /// @param TParam Function template parameters.
605 DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
606 StringRef LinkageName,
607 DIFile File, unsigned LineNo,
608 DICompositeType Ty, bool isLocalToUnit,
610 unsigned Virtuality = 0, unsigned VTableIndex = 0,
611 DIType VTableHolder = DIType(),
613 bool isOptimized = false,
614 Function *Fn = nullptr,
615 MDNode *TParam = nullptr);
617 /// createNameSpace - This creates new descriptor for a namespace
618 /// with the specified parent scope.
619 /// @param Scope Namespace scope
620 /// @param Name Name of this namespace
621 /// @param File Source file
622 /// @param LineNo Line number
623 DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
624 DIFile File, unsigned LineNo);
627 /// createLexicalBlockFile - This creates a descriptor for a lexical
628 /// block with a new file attached. This merely extends the existing
629 /// lexical block as it crosses a file.
630 /// @param Scope Lexical block.
631 /// @param File Source file.
632 DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
635 /// createLexicalBlock - This creates a descriptor for a lexical block
636 /// with the specified parent context.
637 /// @param Scope Parent lexical scope.
638 /// @param File Source file.
639 /// @param Line Line number.
640 /// @param Col Column number.
641 /// @param Discriminator DWARF path discriminator value.
642 DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
643 unsigned Line, unsigned Col,
644 unsigned Discriminator);
646 /// \brief Create a descriptor for an imported module.
647 /// @param Context The scope this module is imported into
648 /// @param NS The namespace being imported here
649 /// @param Line Line number
650 DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
653 /// \brief Create a descriptor for an imported module.
654 /// @param Context The scope this module is imported into
655 /// @param NS An aliased namespace
656 /// @param Line Line number
657 DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
660 /// \brief Create a descriptor for an imported function.
661 /// @param Context The scope this module is imported into
662 /// @param Decl The declaration (or definition) of a function, type, or
664 /// @param Line Line number
665 DIImportedEntity createImportedDeclaration(DIScope Context, DIScope Decl,
667 StringRef Name = StringRef());
668 DIImportedEntity createImportedDeclaration(DIScope Context,
671 StringRef Name = StringRef());
673 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
674 /// @param Storage llvm::Value of the variable
675 /// @param VarInfo Variable's debug info descriptor.
676 /// @param InsertAtEnd Location for the new intrinsic.
677 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
678 BasicBlock *InsertAtEnd);
680 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
681 /// @param Storage llvm::Value of the variable
682 /// @param VarInfo Variable's debug info descriptor.
683 /// @param InsertBefore Location for the new intrinsic.
684 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
685 Instruction *InsertBefore);
688 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
689 /// @param Val llvm::Value of the variable
690 /// @param Offset Offset
691 /// @param VarInfo Variable's debug info descriptor.
692 /// @param InsertAtEnd Location for the new intrinsic.
693 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
695 BasicBlock *InsertAtEnd);
697 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
698 /// @param Val llvm::Value of the variable
699 /// @param Offset Offset
700 /// @param VarInfo Variable's debug info descriptor.
701 /// @param InsertBefore Location for the new intrinsic.
702 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
704 Instruction *InsertBefore);
707 } // end namespace llvm