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;
41 class DIGlobalVariable;
42 class DIImportedEntity;
46 class DILexicalBlockFile;
50 class DITemplateTypeParameter;
51 class DITemplateValueParameter;
57 LLVMContext &VMContext;
59 MDNode *TempEnumTypes;
60 MDNode *TempRetainTypes;
61 MDNode *TempSubprograms;
63 MDNode *TempImportedModules;
65 Function *DeclareFn; // llvm.dbg.declare
66 Function *ValueFn; // llvm.dbg.value
68 SmallVector<Value *, 4> AllEnumTypes;
69 /// Use TrackingVH to collect RetainTypes, since they can be updated
71 SmallVector<TrackingVH<MDNode>, 4> AllRetainTypes;
72 SmallVector<Value *, 4> AllSubprograms;
73 SmallVector<Value *, 4> AllGVs;
74 SmallVector<TrackingVH<MDNode>, 4> AllImportedModules;
76 // Private use for multiple types of template parameters.
77 DITemplateValueParameter
78 createTemplateValueParameter(unsigned Tag, DIDescriptor Scope,
79 StringRef Name, DIType Ty, Value *Val,
80 MDNode *File = nullptr, unsigned LineNo = 0,
81 unsigned ColumnNo = 0);
83 DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
84 void operator=(const DIBuilder &) LLVM_DELETED_FUNCTION;
87 explicit DIBuilder(Module &M);
88 enum ComplexAddrKind { OpPlus=1, OpDeref, OpPiece };
89 enum DebugEmissionKind { FullDebug=1, LineTablesOnly };
91 /// finalize - Construct any deferred debug info descriptors.
94 /// createCompileUnit - A CompileUnit provides an anchor for all debugging
95 /// information generated during this instance of compilation.
96 /// @param Lang Source programming language, eg. dwarf::DW_LANG_C99
97 /// @param File File name
98 /// @param Dir Directory
99 /// @param Producer Identify the producer of debugging information and code.
100 /// Usually this is a compiler version string.
101 /// @param isOptimized A boolean flag which indicates whether optimization
103 /// @param Flags This string lists command line options. This string is
104 /// directly embedded in debug info output which may be used
105 /// by a tool analyzing generated debugging information.
106 /// @param RV This indicates runtime version for languages like
108 /// @param SplitName The name of the file that we'll split debug info out
110 /// @param Kind The kind of debug information to generate.
111 /// @param EmitDebugInfo A boolean flag which indicates whether debug
112 /// information should be written to the final
113 /// output or not. When this is false, debug
114 /// information annotations will be present in
115 /// the IL but they are not written to the final
116 /// assembly or object file. This supports tracking
117 /// source location information in the back end
118 /// without actually changing the output (e.g.,
119 /// when using optimization remarks).
120 DICompileUnit createCompileUnit(unsigned Lang, StringRef File,
121 StringRef Dir, StringRef Producer,
122 bool isOptimized, StringRef Flags,
124 StringRef SplitName = StringRef(),
125 DebugEmissionKind Kind = FullDebug,
126 bool EmitDebugInfo = true);
128 /// createFile - Create a file descriptor to hold debugging information
130 DIFile createFile(StringRef Filename, StringRef Directory);
132 /// createEnumerator - Create a single enumerator value.
133 DIEnumerator createEnumerator(StringRef Name, int64_t Val);
135 /// \brief Create a DWARF unspecified type.
136 DIBasicType createUnspecifiedType(StringRef Name);
138 /// \brief Create C++11 nullptr type.
139 DIBasicType createNullPtrType();
141 /// createBasicType - Create debugging information entry for a basic
143 /// @param Name Type name.
144 /// @param SizeInBits Size of the type.
145 /// @param AlignInBits Type alignment.
146 /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
147 DIBasicType createBasicType(StringRef Name, uint64_t SizeInBits,
148 uint64_t AlignInBits, unsigned Encoding);
150 /// createQualifiedType - Create debugging information entry for a qualified
151 /// type, e.g. 'const int'.
152 /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
153 /// @param FromTy Base Type.
154 DIDerivedType createQualifiedType(unsigned Tag, DIType FromTy);
156 /// createPointerType - Create debugging information entry for a pointer.
157 /// @param PointeeTy Type pointed by this pointer.
158 /// @param SizeInBits Size.
159 /// @param AlignInBits Alignment. (optional)
160 /// @param Name Pointer type name. (optional)
162 createPointerType(DIType PointeeTy, uint64_t SizeInBits,
163 uint64_t AlignInBits = 0, StringRef Name = StringRef());
165 /// \brief Create debugging information entry for a pointer to member.
166 /// @param PointeeTy Type pointed to by this pointer.
167 /// @param Class Type for which this pointer points to members of.
168 DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
170 /// createReferenceType - Create debugging information entry for a c++
171 /// style reference or rvalue reference type.
172 DIDerivedType createReferenceType(unsigned Tag, DIType RTy);
174 /// createTypedef - Create debugging information entry for a typedef.
175 /// @param Ty Original type.
176 /// @param Name Typedef name.
177 /// @param File File where this type is defined.
178 /// @param LineNo Line number.
179 /// @param Context The surrounding context for the typedef.
180 DIDerivedType createTypedef(DIType Ty, StringRef Name, DIFile File,
181 unsigned LineNo, DIDescriptor Context);
183 /// createFriend - Create debugging information entry for a 'friend'.
184 DIDerivedType createFriend(DIType Ty, DIType FriendTy);
186 /// createInheritance - Create debugging information entry to establish
187 /// inheritance relationship between two types.
188 /// @param Ty Original type.
189 /// @param BaseTy Base type. Ty is inherits from base.
190 /// @param BaseOffset Base offset.
191 /// @param Flags Flags to describe inheritance attribute,
193 DIDerivedType createInheritance(DIType Ty, DIType BaseTy,
194 uint64_t BaseOffset, unsigned Flags);
196 /// createMemberType - Create debugging information entry for a member.
197 /// @param Scope Member scope.
198 /// @param Name Member name.
199 /// @param File File where this member is defined.
200 /// @param LineNo Line number.
201 /// @param SizeInBits Member size.
202 /// @param AlignInBits Member alignment.
203 /// @param OffsetInBits Member offset.
204 /// @param Flags Flags to encode member attribute, e.g. private
205 /// @param Ty Parent type.
207 createMemberType(DIDescriptor Scope, StringRef Name, DIFile File,
208 unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
209 uint64_t OffsetInBits, unsigned Flags, DIType Ty);
211 /// createStaticMemberType - Create debugging information entry for a
212 /// C++ static data member.
213 /// @param Scope Member scope.
214 /// @param Name Member name.
215 /// @param File File where this member is declared.
216 /// @param LineNo Line number.
217 /// @param Ty Type of the static member.
218 /// @param Flags Flags to encode member attribute, e.g. private.
219 /// @param Val Const initializer of the member.
221 createStaticMemberType(DIDescriptor Scope, StringRef Name,
222 DIFile File, unsigned LineNo, DIType Ty,
223 unsigned Flags, llvm::Value *Val);
225 /// createObjCIVar - Create debugging information entry for Objective-C
226 /// instance variable.
227 /// @param Name Member name.
228 /// @param File File where this member is defined.
229 /// @param LineNo Line number.
230 /// @param SizeInBits Member size.
231 /// @param AlignInBits Member alignment.
232 /// @param OffsetInBits Member offset.
233 /// @param Flags Flags to encode member attribute, e.g. private
234 /// @param Ty Parent type.
235 /// @param PropertyNode Property associated with this ivar.
236 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
237 unsigned LineNo, uint64_t SizeInBits,
238 uint64_t AlignInBits, uint64_t OffsetInBits,
239 unsigned Flags, DIType Ty,
240 MDNode *PropertyNode);
242 /// createObjCProperty - Create debugging information entry for Objective-C
244 /// @param Name Property name.
245 /// @param File File where this property is defined.
246 /// @param LineNumber Line number.
247 /// @param GetterName Name of the Objective C property getter selector.
248 /// @param SetterName Name of the Objective C property setter selector.
249 /// @param PropertyAttributes Objective C property attributes.
251 DIObjCProperty createObjCProperty(StringRef Name,
252 DIFile File, unsigned LineNumber,
253 StringRef GetterName,
254 StringRef SetterName,
255 unsigned PropertyAttributes,
258 /// createClassType - Create debugging information entry for a class.
259 /// @param Scope Scope in which this class is defined.
260 /// @param Name class name.
261 /// @param File File where this member is defined.
262 /// @param LineNumber Line number.
263 /// @param SizeInBits Member size.
264 /// @param AlignInBits Member alignment.
265 /// @param OffsetInBits Member offset.
266 /// @param Flags Flags to encode member attribute, e.g. private
267 /// @param Elements class members.
268 /// @param VTableHolder Debug info of the base class that contains vtable
269 /// for this type. This is used in
270 /// DW_AT_containing_type. See DWARF documentation
272 /// @param TemplateParms Template type parameters.
273 /// @param UniqueIdentifier A unique identifier for the class.
274 DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
275 DIFile File, unsigned LineNumber,
276 uint64_t SizeInBits, uint64_t AlignInBits,
277 uint64_t OffsetInBits, unsigned Flags,
278 DIType DerivedFrom, DIArray Elements,
279 DIType VTableHolder = DIType(),
280 MDNode *TemplateParms = nullptr,
281 StringRef UniqueIdentifier = StringRef());
283 /// createStructType - Create debugging information entry for a struct.
284 /// @param Scope Scope in which this struct is defined.
285 /// @param Name Struct name.
286 /// @param File File where this member is defined.
287 /// @param LineNumber Line number.
288 /// @param SizeInBits Member size.
289 /// @param AlignInBits Member alignment.
290 /// @param Flags Flags to encode member attribute, e.g. private
291 /// @param Elements Struct elements.
292 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
293 /// @param UniqueIdentifier A unique identifier for the struct.
294 DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
295 DIFile File, unsigned LineNumber,
296 uint64_t SizeInBits, uint64_t AlignInBits,
297 unsigned Flags, DIType DerivedFrom,
298 DIArray Elements, unsigned RunTimeLang = 0,
299 DIType VTableHolder = DIType(),
300 StringRef UniqueIdentifier = StringRef());
302 /// createUnionType - Create debugging information entry for an union.
303 /// @param Scope Scope in which this union is defined.
304 /// @param Name Union name.
305 /// @param File File where this member is defined.
306 /// @param LineNumber Line number.
307 /// @param SizeInBits Member size.
308 /// @param AlignInBits Member alignment.
309 /// @param Flags Flags to encode member attribute, e.g. private
310 /// @param Elements Union elements.
311 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
312 /// @param UniqueIdentifier A unique identifier for the union.
313 DICompositeType createUnionType(
314 DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
315 uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
316 DIArray Elements, unsigned RunTimeLang = 0,
317 StringRef UniqueIdentifier = StringRef());
319 /// createTemplateTypeParameter - Create debugging information for template
321 /// @param Scope Scope in which this type is defined.
322 /// @param Name Type parameter name.
323 /// @param Ty Parameter type.
324 /// @param File File where this type parameter is defined.
325 /// @param LineNo Line number.
326 /// @param ColumnNo Column Number.
327 DITemplateTypeParameter
328 createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
329 MDNode *File = nullptr, unsigned LineNo = 0,
330 unsigned ColumnNo = 0);
332 /// createTemplateValueParameter - Create debugging information for template
334 /// @param Scope Scope in which this type is defined.
335 /// @param Name Value parameter name.
336 /// @param Ty Parameter type.
337 /// @param Val Constant parameter value.
338 /// @param File File where this type parameter is defined.
339 /// @param LineNo Line number.
340 /// @param ColumnNo Column Number.
341 DITemplateValueParameter
342 createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
343 DIType Ty, Value *Val, MDNode *File = nullptr,
344 unsigned LineNo = 0, unsigned ColumnNo = 0);
346 /// \brief Create debugging information for a template template parameter.
347 /// @param Scope Scope in which this type is defined.
348 /// @param Name Value parameter name.
349 /// @param Ty Parameter type.
350 /// @param Val The fully qualified name of the template.
351 /// @param File File where this type parameter is defined.
352 /// @param LineNo Line number.
353 /// @param ColumnNo Column Number.
354 DITemplateValueParameter
355 createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
356 DIType Ty, StringRef Val,
357 MDNode *File = nullptr, unsigned LineNo = 0,
358 unsigned ColumnNo = 0);
360 /// \brief Create debugging information for a template parameter pack.
361 /// @param Scope Scope in which this type is defined.
362 /// @param Name Value parameter name.
363 /// @param Ty Parameter type.
364 /// @param Val An array of types in the pack.
365 /// @param File File where this type parameter is defined.
366 /// @param LineNo Line number.
367 /// @param ColumnNo Column Number.
368 DITemplateValueParameter
369 createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
370 DIType Ty, DIArray Val, MDNode *File = nullptr,
371 unsigned LineNo = 0, unsigned ColumnNo = 0);
373 /// createArrayType - Create debugging information entry for an array.
374 /// @param Size Array size.
375 /// @param AlignInBits Alignment.
376 /// @param Ty Element type.
377 /// @param Subscripts Subscripts.
378 DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
379 DIType Ty, DIArray Subscripts);
381 /// createVectorType - Create debugging information entry for a vector type.
382 /// @param Size Array size.
383 /// @param AlignInBits Alignment.
384 /// @param Ty Element type.
385 /// @param Subscripts Subscripts.
386 DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
387 DIType Ty, DIArray Subscripts);
389 /// createEnumerationType - Create debugging information entry for an
391 /// @param Scope Scope in which this enumeration is defined.
392 /// @param Name Union name.
393 /// @param File File where this member is defined.
394 /// @param LineNumber Line number.
395 /// @param SizeInBits Member size.
396 /// @param AlignInBits Member alignment.
397 /// @param Elements Enumeration elements.
398 /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
399 /// @param UniqueIdentifier A unique identifier for the enum.
400 DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
401 DIFile File, unsigned LineNumber, uint64_t SizeInBits,
402 uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
403 StringRef UniqueIdentifier = StringRef());
405 /// createSubroutineType - Create subroutine type.
406 /// @param File File in which this subroutine is defined.
407 /// @param ParameterTypes An array of subroutine parameter types. This
408 /// includes return type at 0th index.
409 /// @param Flags E.g.: LValueReference.
410 /// These flags are used to emit dwarf attributes.
411 DISubroutineType createSubroutineType(DIFile File,
412 DITypeArray ParameterTypes,
415 /// createArtificialType - Create a new DIType with "artificial" flag set.
416 DIType createArtificialType(DIType Ty);
418 /// createObjectPointerType - Create a new DIType with the "object pointer"
420 DIType createObjectPointerType(DIType Ty);
422 /// \brief Create a permanent forward-declared type.
423 DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
424 DIDescriptor Scope, DIFile F,
425 unsigned Line, unsigned RuntimeLang = 0,
426 uint64_t SizeInBits = 0,
427 uint64_t AlignInBits = 0,
428 StringRef UniqueIdentifier = StringRef());
430 /// \brief Create a temporary forward-declared type.
431 DICompositeType createReplaceableForwardDecl(
432 unsigned Tag, StringRef Name, DIDescriptor Scope, DIFile F,
433 unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
434 uint64_t AlignInBits = 0, StringRef UniqueIdentifier = StringRef());
436 /// retainType - Retain DIType in a module even if it is not referenced
437 /// through debug info anchors.
438 void retainType(DIType T);
440 /// createUnspecifiedParameter - Create unspecified parameter type
441 /// for a subroutine type.
442 DIBasicType createUnspecifiedParameter();
444 /// getOrCreateArray - Get a DIArray, create one if required.
445 DIArray getOrCreateArray(ArrayRef<Value *> Elements);
447 /// getOrCreateTypeArray - Get a DITypeArray, create one if required.
448 DITypeArray getOrCreateTypeArray(ArrayRef<Value *> Elements);
450 /// getOrCreateSubrange - Create a descriptor for a value range. This
451 /// implicitly uniques the values returned.
452 DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
455 /// createGlobalVariable - Create a new descriptor for the specified
457 /// @param Context Variable scope.
458 /// @param Name Name of the variable.
459 /// @param LinkageName Mangled name of the variable.
460 /// @param File File where this variable is defined.
461 /// @param LineNo Line number.
462 /// @param Ty Variable Type.
463 /// @param isLocalToUnit Boolean flag indicate whether this variable is
464 /// externally visible or not.
465 /// @param Val llvm::Value of the variable.
466 /// @param Decl Reference to the corresponding declaration.
468 createGlobalVariable(DIDescriptor Context, StringRef Name,
469 StringRef LinkageName, DIFile File, unsigned LineNo,
470 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
471 MDNode *Decl = nullptr);
473 /// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
474 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
476 createTempGlobalVariableFwdDecl(DIDescriptor Context, StringRef Name,
477 StringRef LinkageName, DIFile File,
478 unsigned LineNo, DITypeRef Ty,
479 bool isLocalToUnit, llvm::Value *Val,
480 MDNode *Decl = nullptr);
483 /// createLocalVariable - Create a new descriptor for the specified
485 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
486 /// DW_TAG_arg_variable.
487 /// @param Scope Variable scope.
488 /// @param Name Variable name.
489 /// @param File File where this variable is defined.
490 /// @param LineNo Line number.
491 /// @param Ty Variable Type
492 /// @param AlwaysPreserve Boolean. Set to true if debug info for this
493 /// variable should be preserved in optimized build.
494 /// @param Flags Flags, e.g. artificial variable.
495 /// @param ArgNo If this variable is an argument then this argument's
496 /// number. 1 indicates 1st argument.
497 DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
499 DIFile File, unsigned LineNo,
500 DITypeRef Ty, bool AlwaysPreserve = false,
505 /// createComplexVariable - Create a new descriptor for the specified
506 /// variable which has a complex address expression for its address.
507 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
508 /// DW_TAG_arg_variable.
509 /// @param Scope Variable scope.
510 /// @param Name Variable name.
511 /// @param F File where this variable is defined.
512 /// @param LineNo Line number.
513 /// @param Ty Variable Type
514 /// @param Addr An array of complex address operations.
515 /// @param ArgNo If this variable is an argument then this argument's
516 /// number. 1 indicates 1st argument.
517 DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
518 StringRef Name, DIFile F, unsigned LineNo,
519 DITypeRef Ty, ArrayRef<Value *> Addr,
522 /// createVariablePiece - Create a descriptor to describe one part
523 /// of aggregate variable that is fragmented across multiple Values.
525 /// @param Variable Variable that is partially represented by this.
526 /// @param OffsetInBytes Offset of the piece in bytes.
527 /// @param SizeInBytes Size of the piece in bytes.
528 DIVariable createVariablePiece(DIVariable Variable,
529 unsigned OffsetInBytes,
530 unsigned SizeInBytes);
532 /// createFunction - Create a new descriptor for the specified subprogram.
533 /// See comments in DISubprogram for descriptions of these fields.
534 /// @param Scope Function scope.
535 /// @param Name Function name.
536 /// @param LinkageName Mangled function name.
537 /// @param File File where this variable is defined.
538 /// @param LineNo Line number.
539 /// @param Ty Function type.
540 /// @param isLocalToUnit True if this function is not externally visible.
541 /// @param isDefinition True if this is a function definition.
542 /// @param ScopeLine Set to the beginning of the scope this starts
543 /// @param Flags e.g. is this function prototyped or not.
544 /// These flags are used to emit dwarf attributes.
545 /// @param isOptimized True if optimization is ON.
546 /// @param Fn llvm::Function pointer.
547 /// @param TParam Function template parameters.
548 DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
549 StringRef LinkageName,
550 DIFile File, unsigned LineNo,
551 DICompositeType Ty, bool isLocalToUnit,
555 bool isOptimized = false,
556 Function *Fn = nullptr,
557 MDNode *TParam = nullptr,
558 MDNode *Decl = nullptr);
560 /// createTempFunctionFwdDecl - Identical to createFunction,
561 /// except that the resulting DbgNode is meant to be RAUWed.
562 DISubprogram createTempFunctionFwdDecl(DIDescriptor Scope, StringRef Name,
563 StringRef LinkageName,
564 DIFile File, unsigned LineNo,
565 DICompositeType Ty, bool isLocalToUnit,
569 bool isOptimized = false,
570 Function *Fn = nullptr,
571 MDNode *TParam = nullptr,
572 MDNode *Decl = nullptr);
575 /// FIXME: this is added for dragonegg. Once we update dragonegg
576 /// to call resolve function, this will be removed.
577 DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
578 StringRef LinkageName,
579 DIFile File, unsigned LineNo,
580 DICompositeType Ty, bool isLocalToUnit,
584 bool isOptimized = false,
585 Function *Fn = nullptr,
586 MDNode *TParam = nullptr,
587 MDNode *Decl = nullptr);
589 /// createMethod - Create a new descriptor for the specified C++ method.
590 /// See comments in DISubprogram for descriptions of these fields.
591 /// @param Scope Function scope.
592 /// @param Name Function name.
593 /// @param LinkageName Mangled function name.
594 /// @param File File where this variable is defined.
595 /// @param LineNo Line number.
596 /// @param Ty Function type.
597 /// @param isLocalToUnit True if this function is not externally visible..
598 /// @param isDefinition True if this is a function definition.
599 /// @param Virtuality Attributes describing virtualness. e.g. pure
600 /// virtual function.
601 /// @param VTableIndex Index no of this method in virtual table.
602 /// @param VTableHolder Type that holds vtable.
603 /// @param Flags e.g. is this function prototyped or not.
604 /// This flags are used to emit dwarf attributes.
605 /// @param isOptimized True if optimization is ON.
606 /// @param Fn llvm::Function pointer.
607 /// @param TParam Function template parameters.
608 DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
609 StringRef LinkageName,
610 DIFile File, unsigned LineNo,
611 DICompositeType Ty, bool isLocalToUnit,
613 unsigned Virtuality = 0, unsigned VTableIndex = 0,
614 DIType VTableHolder = DIType(),
616 bool isOptimized = false,
617 Function *Fn = nullptr,
618 MDNode *TParam = nullptr);
620 /// createNameSpace - This creates new descriptor for a namespace
621 /// with the specified parent scope.
622 /// @param Scope Namespace scope
623 /// @param Name Name of this namespace
624 /// @param File Source file
625 /// @param LineNo Line number
626 DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
627 DIFile File, unsigned LineNo);
630 /// createLexicalBlockFile - This creates a descriptor for a lexical
631 /// block with a new file attached. This merely extends the existing
632 /// lexical block as it crosses a file.
633 /// @param Scope Lexical block.
634 /// @param File Source file.
635 /// @param Discriminator DWARF path discriminator value.
636 DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope, DIFile File,
637 unsigned Discriminator = 0);
639 /// createLexicalBlock - This creates a descriptor for a lexical block
640 /// with the specified parent context.
641 /// @param Scope Parent lexical scope.
642 /// @param File Source file.
643 /// @param Line Line number.
644 /// @param Col Column number.
645 DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
646 unsigned Line, unsigned Col);
648 /// \brief Create a descriptor for an imported module.
649 /// @param Context The scope this module is imported into
650 /// @param NS The namespace being imported here
651 /// @param Line Line number
652 DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
655 /// \brief Create a descriptor for an imported module.
656 /// @param Context The scope this module is imported into
657 /// @param NS An aliased namespace
658 /// @param Line Line number
659 DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
662 /// \brief Create a descriptor for an imported function.
663 /// @param Context The scope this module is imported into
664 /// @param Decl The declaration (or definition) of a function, type, or
666 /// @param Line Line number
667 DIImportedEntity createImportedDeclaration(DIScope Context, DIScope Decl,
669 StringRef Name = StringRef());
670 DIImportedEntity createImportedDeclaration(DIScope Context,
673 StringRef Name = StringRef());
675 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
676 /// @param Storage llvm::Value of the variable
677 /// @param VarInfo Variable's debug info descriptor.
678 /// @param InsertAtEnd Location for the new intrinsic.
679 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
680 BasicBlock *InsertAtEnd);
682 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
683 /// @param Storage llvm::Value of the variable
684 /// @param VarInfo Variable's debug info descriptor.
685 /// @param InsertBefore Location for the new intrinsic.
686 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
687 Instruction *InsertBefore);
690 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
691 /// @param Val llvm::Value of the variable
692 /// @param Offset Offset
693 /// @param VarInfo Variable's debug info descriptor.
694 /// @param InsertAtEnd Location for the new intrinsic.
695 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
697 BasicBlock *InsertAtEnd);
699 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
700 /// @param Val llvm::Value of the variable
701 /// @param Offset Offset
702 /// @param VarInfo Variable's debug info descriptor.
703 /// @param InsertBefore Location for the new intrinsic.
704 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
706 Instruction *InsertBefore);
708 } // end namespace llvm