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 /// @param Kind The kind of debug information to generate.
112 /// @param EmitDebugInfo A boolean flag which indicates whether debug
113 /// information should be written to the final
114 /// output or not. When this is false, debug
115 /// information annotations will be present in
116 /// the IL but they are not written to the final
117 /// assembly or object file. This supports tracking
118 /// source location information in the back end
119 /// without actually changing the output (e.g.,
120 /// when using optimization remarks).
121 DICompileUnit createCompileUnit(unsigned Lang, StringRef File,
122 StringRef Dir, StringRef Producer,
123 bool isOptimized, StringRef Flags,
125 StringRef SplitName = StringRef(),
126 DebugEmissionKind Kind = FullDebug,
127 bool EmitDebugInfo = true);
129 /// createFile - Create a file descriptor to hold debugging information
131 DIFile createFile(StringRef Filename, StringRef Directory);
133 /// createEnumerator - Create a single enumerator value.
134 DIEnumerator createEnumerator(StringRef Name, int64_t Val);
136 /// \brief Create a DWARF unspecified type.
137 DIBasicType createUnspecifiedType(StringRef Name);
139 /// \brief Create C++11 nullptr type.
140 DIBasicType createNullPtrType();
142 /// createBasicType - Create debugging information entry for a basic
144 /// @param Name Type name.
145 /// @param SizeInBits Size of the type.
146 /// @param AlignInBits Type alignment.
147 /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
148 DIBasicType createBasicType(StringRef Name, uint64_t SizeInBits,
149 uint64_t AlignInBits, unsigned Encoding);
151 /// createQualifiedType - Create debugging information entry for a qualified
152 /// type, e.g. 'const int'.
153 /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
154 /// @param FromTy Base Type.
155 DIDerivedType createQualifiedType(unsigned Tag, DIType FromTy);
157 /// createPointerType - Create debugging information entry for a pointer.
158 /// @param PointeeTy Type pointed by this pointer.
159 /// @param SizeInBits Size.
160 /// @param AlignInBits Alignment. (optional)
161 /// @param Name Pointer type name. (optional)
163 createPointerType(DIType PointeeTy, uint64_t SizeInBits,
164 uint64_t AlignInBits = 0, StringRef Name = StringRef());
166 /// \brief Create debugging information entry for a pointer to member.
167 /// @param PointeeTy Type pointed to by this pointer.
168 /// @param Class Type for which this pointer points to members of.
169 DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
171 /// createReferenceType - Create debugging information entry for a c++
172 /// style reference or rvalue reference type.
173 DIDerivedType createReferenceType(unsigned Tag, DIType RTy);
175 /// createTypedef - Create debugging information entry for a typedef.
176 /// @param Ty Original type.
177 /// @param Name Typedef name.
178 /// @param File File where this type is defined.
179 /// @param LineNo Line number.
180 /// @param Context The surrounding context for the typedef.
181 DIDerivedType createTypedef(DIType Ty, StringRef Name, DIFile File,
182 unsigned LineNo, DIDescriptor Context);
184 /// createFriend - Create debugging information entry for a 'friend'.
185 DIDerivedType createFriend(DIType Ty, DIType FriendTy);
187 /// createInheritance - Create debugging information entry to establish
188 /// inheritance relationship between two types.
189 /// @param Ty Original type.
190 /// @param BaseTy Base type. Ty is inherits from base.
191 /// @param BaseOffset Base offset.
192 /// @param Flags Flags to describe inheritance attribute,
194 DIDerivedType createInheritance(DIType Ty, DIType BaseTy,
195 uint64_t BaseOffset, unsigned Flags);
197 /// createMemberType - Create debugging information entry for a member.
198 /// @param Scope Member scope.
199 /// @param Name Member name.
200 /// @param File File where this member is defined.
201 /// @param LineNo Line number.
202 /// @param SizeInBits Member size.
203 /// @param AlignInBits Member alignment.
204 /// @param OffsetInBits Member offset.
205 /// @param Flags Flags to encode member attribute, e.g. private
206 /// @param Ty Parent type.
208 createMemberType(DIDescriptor Scope, StringRef Name, DIFile File,
209 unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
210 uint64_t OffsetInBits, unsigned Flags, DIType Ty);
212 /// createStaticMemberType - Create debugging information entry for a
213 /// C++ static data member.
214 /// @param Scope Member scope.
215 /// @param Name Member name.
216 /// @param File File where this member is declared.
217 /// @param LineNo Line number.
218 /// @param Ty Type of the static member.
219 /// @param Flags Flags to encode member attribute, e.g. private.
220 /// @param Val Const initializer of the member.
222 createStaticMemberType(DIDescriptor Scope, StringRef Name,
223 DIFile File, unsigned LineNo, DIType Ty,
224 unsigned Flags, llvm::Value *Val);
226 /// createObjCIVar - Create debugging information entry for Objective-C
227 /// instance variable.
228 /// @param Name Member name.
229 /// @param File File where this member is defined.
230 /// @param LineNo Line number.
231 /// @param SizeInBits Member size.
232 /// @param AlignInBits Member alignment.
233 /// @param OffsetInBits Member offset.
234 /// @param Flags Flags to encode member attribute, e.g. private
235 /// @param Ty Parent type.
236 /// @param PropertyName Name of the Objective C property associated with
238 /// @param PropertyGetterName Name of the Objective C property getter
240 /// @param PropertySetterName Name of the Objective C property setter
242 /// @param PropertyAttributes Objective C property attributes.
243 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
244 unsigned LineNo, uint64_t SizeInBits,
245 uint64_t AlignInBits, uint64_t OffsetInBits,
246 unsigned Flags, DIType Ty,
247 StringRef PropertyName = StringRef(),
248 StringRef PropertyGetterName = StringRef(),
249 StringRef PropertySetterName = StringRef(),
250 unsigned PropertyAttributes = 0);
252 /// createObjCIVar - Create debugging information entry for Objective-C
253 /// instance variable.
254 /// @param Name Member name.
255 /// @param File File where this member is defined.
256 /// @param LineNo Line number.
257 /// @param SizeInBits Member size.
258 /// @param AlignInBits Member alignment.
259 /// @param OffsetInBits Member offset.
260 /// @param Flags Flags to encode member attribute, e.g. private
261 /// @param Ty Parent type.
262 /// @param PropertyNode Property associated with this ivar.
263 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
264 unsigned LineNo, uint64_t SizeInBits,
265 uint64_t AlignInBits, uint64_t OffsetInBits,
266 unsigned Flags, DIType Ty,
267 MDNode *PropertyNode);
269 /// createObjCProperty - Create debugging information entry for Objective-C
271 /// @param Name Property name.
272 /// @param File File where this property is defined.
273 /// @param LineNumber Line number.
274 /// @param GetterName Name of the Objective C property getter selector.
275 /// @param SetterName Name of the Objective C property setter selector.
276 /// @param PropertyAttributes Objective C property attributes.
278 DIObjCProperty createObjCProperty(StringRef Name,
279 DIFile File, unsigned LineNumber,
280 StringRef GetterName,
281 StringRef SetterName,
282 unsigned PropertyAttributes,
285 /// createClassType - Create debugging information entry for a class.
286 /// @param Scope Scope in which this class is defined.
287 /// @param Name class name.
288 /// @param File File where this member is defined.
289 /// @param LineNumber Line number.
290 /// @param SizeInBits Member size.
291 /// @param AlignInBits Member alignment.
292 /// @param OffsetInBits Member offset.
293 /// @param Flags Flags to encode member attribute, e.g. private
294 /// @param Elements class members.
295 /// @param VTableHolder Debug info of the base class that contains vtable
296 /// for this type. This is used in
297 /// DW_AT_containing_type. See DWARF documentation
299 /// @param TemplateParms Template type parameters.
300 /// @param UniqueIdentifier A unique identifier for the class.
301 DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
302 DIFile File, unsigned LineNumber,
303 uint64_t SizeInBits, uint64_t AlignInBits,
304 uint64_t OffsetInBits, unsigned Flags,
305 DIType DerivedFrom, DIArray Elements,
306 DIType VTableHolder = DIType(),
307 MDNode *TemplateParms = nullptr,
308 StringRef UniqueIdentifier = StringRef());
310 /// createStructType - Create debugging information entry for a struct.
311 /// @param Scope Scope in which this struct is defined.
312 /// @param Name Struct name.
313 /// @param File File where this member is defined.
314 /// @param LineNumber Line number.
315 /// @param SizeInBits Member size.
316 /// @param AlignInBits Member alignment.
317 /// @param Flags Flags to encode member attribute, e.g. private
318 /// @param Elements Struct elements.
319 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
320 /// @param UniqueIdentifier A unique identifier for the struct.
321 DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
322 DIFile File, unsigned LineNumber,
323 uint64_t SizeInBits, uint64_t AlignInBits,
324 unsigned Flags, DIType DerivedFrom,
325 DIArray Elements, unsigned RunTimeLang = 0,
326 DIType VTableHolder = DIType(),
327 StringRef UniqueIdentifier = StringRef());
329 /// createUnionType - Create debugging information entry for an union.
330 /// @param Scope Scope in which this union is defined.
331 /// @param Name Union name.
332 /// @param File File where this member is defined.
333 /// @param LineNumber Line number.
334 /// @param SizeInBits Member size.
335 /// @param AlignInBits Member alignment.
336 /// @param Flags Flags to encode member attribute, e.g. private
337 /// @param Elements Union elements.
338 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
339 /// @param UniqueIdentifier A unique identifier for the union.
340 DICompositeType createUnionType(
341 DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
342 uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
343 DIArray Elements, unsigned RunTimeLang = 0,
344 StringRef UniqueIdentifier = StringRef());
346 /// createTemplateTypeParameter - Create debugging information for template
348 /// @param Scope Scope in which this type is defined.
349 /// @param Name Type parameter name.
350 /// @param Ty Parameter type.
351 /// @param File File where this type parameter is defined.
352 /// @param LineNo Line number.
353 /// @param ColumnNo Column Number.
354 DITemplateTypeParameter
355 createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
356 MDNode *File = nullptr, unsigned LineNo = 0,
357 unsigned ColumnNo = 0);
359 /// createTemplateValueParameter - Create debugging information for template
361 /// @param Scope Scope in which this type is defined.
362 /// @param Name Value parameter name.
363 /// @param Ty Parameter type.
364 /// @param Val Constant parameter value.
365 /// @param File File where this type parameter is defined.
366 /// @param LineNo Line number.
367 /// @param ColumnNo Column Number.
368 DITemplateValueParameter
369 createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
370 DIType Ty, Value *Val, MDNode *File = nullptr,
371 unsigned LineNo = 0, unsigned ColumnNo = 0);
373 /// \brief Create debugging information for a template template parameter.
374 /// @param Scope Scope in which this type is defined.
375 /// @param Name Value parameter name.
376 /// @param Ty Parameter type.
377 /// @param Val The fully qualified name of the template.
378 /// @param File File where this type parameter is defined.
379 /// @param LineNo Line number.
380 /// @param ColumnNo Column Number.
381 DITemplateValueParameter
382 createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
383 DIType Ty, StringRef Val,
384 MDNode *File = nullptr, unsigned LineNo = 0,
385 unsigned ColumnNo = 0);
387 /// \brief Create debugging information for a template parameter pack.
388 /// @param Scope Scope in which this type is defined.
389 /// @param Name Value parameter name.
390 /// @param Ty Parameter type.
391 /// @param Val An array of types in the pack.
392 /// @param File File where this type parameter is defined.
393 /// @param LineNo Line number.
394 /// @param ColumnNo Column Number.
395 DITemplateValueParameter
396 createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
397 DIType Ty, DIArray Val, MDNode *File = nullptr,
398 unsigned LineNo = 0, unsigned ColumnNo = 0);
400 /// createArrayType - Create debugging information entry for an array.
401 /// @param Size Array size.
402 /// @param AlignInBits Alignment.
403 /// @param Ty Element type.
404 /// @param Subscripts Subscripts.
405 DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
406 DIType Ty, DIArray Subscripts);
408 /// createVectorType - Create debugging information entry for a vector type.
409 /// @param Size Array size.
410 /// @param AlignInBits Alignment.
411 /// @param Ty Element type.
412 /// @param Subscripts Subscripts.
413 DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
414 DIType Ty, DIArray Subscripts);
416 /// createEnumerationType - Create debugging information entry for an
418 /// @param Scope Scope in which this enumeration is defined.
419 /// @param Name Union name.
420 /// @param File File where this member is defined.
421 /// @param LineNumber Line number.
422 /// @param SizeInBits Member size.
423 /// @param AlignInBits Member alignment.
424 /// @param Elements Enumeration elements.
425 /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
426 /// @param UniqueIdentifier A unique identifier for the enum.
427 DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
428 DIFile File, unsigned LineNumber, uint64_t SizeInBits,
429 uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
430 StringRef UniqueIdentifier = StringRef());
432 /// createSubroutineType - Create subroutine type.
433 /// @param File File in which this subroutine is defined.
434 /// @param ParameterTypes An array of subroutine parameter types. This
435 /// includes return type at 0th index.
436 /// @param Flags E.g.: LValueReference.
437 /// These flags are used to emit dwarf attributes.
438 DICompositeType createSubroutineType(DIFile File, DIArray ParameterTypes,
441 /// createArtificialType - Create a new DIType with "artificial" flag set.
442 DIType createArtificialType(DIType Ty);
444 /// createObjectPointerType - Create a new DIType with the "object pointer"
446 DIType createObjectPointerType(DIType Ty);
448 /// \brief Create a permanent forward-declared type.
449 DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
450 DIDescriptor Scope, DIFile F,
451 unsigned Line, unsigned RuntimeLang = 0,
452 uint64_t SizeInBits = 0,
453 uint64_t AlignInBits = 0,
454 StringRef UniqueIdentifier = StringRef());
456 /// \brief Create a temporary forward-declared type.
457 DICompositeType createReplaceableForwardDecl(
458 unsigned Tag, StringRef Name, DIDescriptor Scope, DIFile F,
459 unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
460 uint64_t AlignInBits = 0, StringRef UniqueIdentifier = StringRef());
462 /// retainType - Retain DIType in a module even if it is not referenced
463 /// through debug info anchors.
464 void retainType(DIType T);
466 /// createUnspecifiedParameter - Create unspecified type descriptor
467 /// for a subroutine type.
468 DIDescriptor createUnspecifiedParameter();
470 /// getOrCreateArray - Get a DIArray, create one if required.
471 DIArray getOrCreateArray(ArrayRef<Value *> Elements);
473 /// getOrCreateSubrange - Create a descriptor for a value range. This
474 /// implicitly uniques the values returned.
475 DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
477 /// createGlobalVariable - Create a new descriptor for the specified global.
478 /// @param Name Name of the variable.
479 /// @param File File where this variable is defined.
480 /// @param LineNo Line number.
481 /// @param Ty Variable Type.
482 /// @param isLocalToUnit Boolean flag indicate whether this variable is
483 /// externally visible or not.
484 /// @param Val llvm::Value of the variable.
486 createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
487 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val);
489 /// \brief Create a new descriptor for the specified global.
490 /// @param Name Name of the variable.
491 /// @param LinkageName Mangled variable name.
492 /// @param File File where this variable is defined.
493 /// @param LineNo Line number.
494 /// @param Ty Variable Type.
495 /// @param isLocalToUnit Boolean flag indicate whether this variable is
496 /// externally visible or not.
497 /// @param Val llvm::Value of the variable.
499 createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
500 unsigned LineNo, DITypeRef Ty, bool isLocalToUnit,
503 /// createStaticVariable - Create a new descriptor for the specified
505 /// @param Context Variable scope.
506 /// @param Name Name of the variable.
507 /// @param LinkageName Mangled name of the variable.
508 /// @param File File where this variable is defined.
509 /// @param LineNo Line number.
510 /// @param Ty Variable Type.
511 /// @param isLocalToUnit Boolean flag indicate whether this variable is
512 /// externally visible or not.
513 /// @param Val llvm::Value of the variable.
514 /// @param Decl Reference to the corresponding declaration.
516 createStaticVariable(DIDescriptor Context, StringRef Name,
517 StringRef LinkageName, DIFile File, unsigned LineNo,
518 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
519 MDNode *Decl = nullptr);
522 /// createLocalVariable - Create a new descriptor for the specified
524 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
525 /// DW_TAG_arg_variable.
526 /// @param Scope Variable scope.
527 /// @param Name Variable name.
528 /// @param File File where this variable is defined.
529 /// @param LineNo Line number.
530 /// @param Ty Variable Type
531 /// @param AlwaysPreserve Boolean. Set to true if debug info for this
532 /// variable should be preserved in optimized build.
533 /// @param Flags Flags, e.g. artificial variable.
534 /// @param ArgNo If this variable is an argument then this argument's
535 /// number. 1 indicates 1st argument.
536 DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
538 DIFile File, unsigned LineNo,
539 DITypeRef Ty, bool AlwaysPreserve = false,
544 /// createComplexVariable - Create a new descriptor for the specified
545 /// variable which has a complex address expression for its address.
546 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
547 /// DW_TAG_arg_variable.
548 /// @param Scope Variable scope.
549 /// @param Name Variable name.
550 /// @param F File where this variable is defined.
551 /// @param LineNo Line number.
552 /// @param Ty Variable Type
553 /// @param Addr An array of complex address operations.
554 /// @param ArgNo If this variable is an argument then this argument's
555 /// number. 1 indicates 1st argument.
556 DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
557 StringRef Name, DIFile F, unsigned LineNo,
558 DITypeRef Ty, ArrayRef<Value *> Addr,
561 /// createFunction - Create a new descriptor for the specified subprogram.
562 /// See comments in DISubprogram for descriptions of these fields.
563 /// @param Scope Function scope.
564 /// @param Name Function name.
565 /// @param LinkageName Mangled function name.
566 /// @param File File where this variable is defined.
567 /// @param LineNo Line number.
568 /// @param Ty Function type.
569 /// @param isLocalToUnit True if this function is not externally visible.
570 /// @param isDefinition True if this is a function definition.
571 /// @param ScopeLine Set to the beginning of the scope this starts
572 /// @param Flags e.g. is this function prototyped or not.
573 /// These flags are used to emit dwarf attributes.
574 /// @param isOptimized True if optimization is ON.
575 /// @param Fn llvm::Function pointer.
576 /// @param TParam Function template parameters.
577 DISubprogram createFunction(DIDescriptor 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 /// FIXME: this is added for dragonegg. Once we update dragonegg
590 /// to call resolve function, this will be removed.
591 DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
592 StringRef LinkageName,
593 DIFile File, unsigned LineNo,
594 DICompositeType Ty, bool isLocalToUnit,
598 bool isOptimized = false,
599 Function *Fn = nullptr,
600 MDNode *TParam = nullptr,
601 MDNode *Decl = nullptr);
603 /// createMethod - Create a new descriptor for the specified C++ method.
604 /// See comments in DISubprogram for descriptions of these fields.
605 /// @param Scope Function scope.
606 /// @param Name Function name.
607 /// @param LinkageName Mangled function name.
608 /// @param File File where this variable is defined.
609 /// @param LineNo Line number.
610 /// @param Ty Function type.
611 /// @param isLocalToUnit True if this function is not externally visible..
612 /// @param isDefinition True if this is a function definition.
613 /// @param Virtuality Attributes describing virtualness. e.g. pure
614 /// virtual function.
615 /// @param VTableIndex Index no of this method in virtual table.
616 /// @param VTableHolder Type that holds vtable.
617 /// @param Flags e.g. is this function prototyped or not.
618 /// This flags are used to emit dwarf attributes.
619 /// @param isOptimized True if optimization is ON.
620 /// @param Fn llvm::Function pointer.
621 /// @param TParam Function template parameters.
622 DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
623 StringRef LinkageName,
624 DIFile File, unsigned LineNo,
625 DICompositeType Ty, bool isLocalToUnit,
627 unsigned Virtuality = 0, unsigned VTableIndex = 0,
628 DIType VTableHolder = DIType(),
630 bool isOptimized = false,
631 Function *Fn = nullptr,
632 MDNode *TParam = nullptr);
634 /// createNameSpace - This creates new descriptor for a namespace
635 /// with the specified parent scope.
636 /// @param Scope Namespace scope
637 /// @param Name Name of this namespace
638 /// @param File Source file
639 /// @param LineNo Line number
640 DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
641 DIFile File, unsigned LineNo);
644 /// createLexicalBlockFile - This creates a descriptor for a lexical
645 /// block with a new file attached. This merely extends the existing
646 /// lexical block as it crosses a file.
647 /// @param Scope Lexical block.
648 /// @param File Source file.
649 DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope,
652 /// createLexicalBlock - This creates a descriptor for a lexical block
653 /// with the specified parent context.
654 /// @param Scope Parent lexical scope.
655 /// @param File Source file.
656 /// @param Line Line number.
657 /// @param Col Column number.
658 /// @param Discriminator DWARF path discriminator value.
659 DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
660 unsigned Line, unsigned Col,
661 unsigned Discriminator);
663 /// \brief Create a descriptor for an imported module.
664 /// @param Context The scope this module is imported into
665 /// @param NS The namespace being imported here
666 /// @param Line Line number
667 DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
670 /// \brief Create a descriptor for an imported module.
671 /// @param Context The scope this module is imported into
672 /// @param NS An aliased namespace
673 /// @param Line Line number
674 DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
677 /// \brief Create a descriptor for an imported function.
678 /// @param Context The scope this module is imported into
679 /// @param Decl The declaration (or definition) of a function, type, or
681 /// @param Line Line number
682 DIImportedEntity createImportedDeclaration(DIScope Context, DIScope Decl,
684 StringRef Name = StringRef());
685 DIImportedEntity createImportedDeclaration(DIScope Context,
688 StringRef Name = StringRef());
690 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
691 /// @param Storage llvm::Value of the variable
692 /// @param VarInfo Variable's debug info descriptor.
693 /// @param InsertAtEnd Location for the new intrinsic.
694 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
695 BasicBlock *InsertAtEnd);
697 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
698 /// @param Storage llvm::Value of the variable
699 /// @param VarInfo Variable's debug info descriptor.
700 /// @param InsertBefore Location for the new intrinsic.
701 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
702 Instruction *InsertBefore);
705 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
706 /// @param Val llvm::Value of the variable
707 /// @param Offset Offset
708 /// @param VarInfo Variable's debug info descriptor.
709 /// @param InsertAtEnd Location for the new intrinsic.
710 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
712 BasicBlock *InsertAtEnd);
714 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
715 /// @param Val llvm::Value of the variable
716 /// @param Offset Offset
717 /// @param VarInfo Variable's debug info descriptor.
718 /// @param InsertBefore Location for the new intrinsic.
719 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
721 Instruction *InsertBefore);
724 } // end namespace llvm