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 DebugEmissionKind { FullDebug=1, LineTablesOnly };
90 /// finalize - Construct any deferred debug info descriptors.
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 Identify the producer of debugging information and code.
99 /// Usually this is a compiler version string.
100 /// @param isOptimized A boolean flag which indicates whether optimization
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
107 /// @param SplitName The name of the file that we'll split debug info out
109 /// @param Kind The kind of debug information to generate.
110 /// @param EmitDebugInfo A boolean flag which indicates whether debug
111 /// information should be written to the final
112 /// output or not. When this is false, debug
113 /// information annotations will be present in
114 /// the IL but they are not written to the final
115 /// assembly or object file. This supports tracking
116 /// source location information in the back end
117 /// without actually changing the output (e.g.,
118 /// when using optimization remarks).
119 DICompileUnit createCompileUnit(unsigned Lang, StringRef File,
120 StringRef Dir, StringRef Producer,
121 bool isOptimized, StringRef Flags,
123 StringRef SplitName = StringRef(),
124 DebugEmissionKind Kind = FullDebug,
125 bool EmitDebugInfo = true);
127 /// createFile - Create a file descriptor to hold debugging information
129 DIFile createFile(StringRef Filename, StringRef Directory);
131 /// createEnumerator - Create a single enumerator value.
132 DIEnumerator createEnumerator(StringRef Name, int64_t Val);
134 /// \brief Create a DWARF unspecified type.
135 DIBasicType createUnspecifiedType(StringRef Name);
137 /// \brief Create C++11 nullptr type.
138 DIBasicType createNullPtrType();
140 /// createBasicType - Create debugging information entry for a basic
142 /// @param Name Type name.
143 /// @param SizeInBits Size of the type.
144 /// @param AlignInBits Type alignment.
145 /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
146 DIBasicType createBasicType(StringRef Name, uint64_t SizeInBits,
147 uint64_t AlignInBits, unsigned Encoding);
149 /// createQualifiedType - Create debugging information entry for a qualified
150 /// type, e.g. 'const int'.
151 /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
152 /// @param FromTy Base Type.
153 DIDerivedType createQualifiedType(unsigned Tag, DIType FromTy);
155 /// createPointerType - Create debugging information entry for a pointer.
156 /// @param PointeeTy Type pointed by this pointer.
157 /// @param SizeInBits Size.
158 /// @param AlignInBits Alignment. (optional)
159 /// @param Name Pointer type name. (optional)
161 createPointerType(DIType PointeeTy, uint64_t SizeInBits,
162 uint64_t AlignInBits = 0, StringRef Name = StringRef());
164 /// \brief Create debugging information entry for a pointer to member.
165 /// @param PointeeTy Type pointed to by this pointer.
166 /// @param Class Type for which this pointer points to members of.
167 DIDerivedType createMemberPointerType(DIType PointeeTy, DIType Class);
169 /// createReferenceType - Create debugging information entry for a c++
170 /// style reference or rvalue reference type.
171 DIDerivedType createReferenceType(unsigned Tag, DIType RTy);
173 /// createTypedef - Create debugging information entry for a typedef.
174 /// @param Ty Original type.
175 /// @param Name Typedef name.
176 /// @param File File where this type is defined.
177 /// @param LineNo Line number.
178 /// @param Context The surrounding context for the typedef.
179 DIDerivedType createTypedef(DIType Ty, StringRef Name, DIFile File,
180 unsigned LineNo, DIDescriptor Context);
182 /// createFriend - Create debugging information entry for a 'friend'.
183 DIDerivedType createFriend(DIType Ty, DIType FriendTy);
185 /// createInheritance - Create debugging information entry to establish
186 /// inheritance relationship between two types.
187 /// @param Ty Original type.
188 /// @param BaseTy Base type. Ty is inherits from base.
189 /// @param BaseOffset Base offset.
190 /// @param Flags Flags to describe inheritance attribute,
192 DIDerivedType createInheritance(DIType Ty, DIType BaseTy,
193 uint64_t BaseOffset, unsigned Flags);
195 /// createMemberType - Create debugging information entry for a member.
196 /// @param Scope Member scope.
197 /// @param Name Member name.
198 /// @param File File where this member is defined.
199 /// @param LineNo Line number.
200 /// @param SizeInBits Member size.
201 /// @param AlignInBits Member alignment.
202 /// @param OffsetInBits Member offset.
203 /// @param Flags Flags to encode member attribute, e.g. private
204 /// @param Ty Parent type.
206 createMemberType(DIDescriptor Scope, StringRef Name, DIFile File,
207 unsigned LineNo, uint64_t SizeInBits, uint64_t AlignInBits,
208 uint64_t OffsetInBits, unsigned Flags, DIType Ty);
210 /// createStaticMemberType - Create debugging information entry for a
211 /// C++ static data member.
212 /// @param Scope Member scope.
213 /// @param Name Member name.
214 /// @param File File where this member is declared.
215 /// @param LineNo Line number.
216 /// @param Ty Type of the static member.
217 /// @param Flags Flags to encode member attribute, e.g. private.
218 /// @param Val Const initializer of the member.
220 createStaticMemberType(DIDescriptor Scope, StringRef Name,
221 DIFile File, unsigned LineNo, DIType Ty,
222 unsigned Flags, llvm::Value *Val);
224 /// createObjCIVar - Create debugging information entry for Objective-C
225 /// instance variable.
226 /// @param Name Member name.
227 /// @param File File where this member is defined.
228 /// @param LineNo Line number.
229 /// @param SizeInBits Member size.
230 /// @param AlignInBits Member alignment.
231 /// @param OffsetInBits Member offset.
232 /// @param Flags Flags to encode member attribute, e.g. private
233 /// @param Ty Parent type.
234 /// @param PropertyNode Property associated with this ivar.
235 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
236 unsigned LineNo, uint64_t SizeInBits,
237 uint64_t AlignInBits, uint64_t OffsetInBits,
238 unsigned Flags, DIType Ty,
239 MDNode *PropertyNode);
241 /// createObjCProperty - Create debugging information entry for Objective-C
243 /// @param Name Property name.
244 /// @param File File where this property is defined.
245 /// @param LineNumber Line number.
246 /// @param GetterName Name of the Objective C property getter selector.
247 /// @param SetterName Name of the Objective C property setter selector.
248 /// @param PropertyAttributes Objective C property attributes.
250 DIObjCProperty createObjCProperty(StringRef Name,
251 DIFile File, unsigned LineNumber,
252 StringRef GetterName,
253 StringRef SetterName,
254 unsigned PropertyAttributes,
257 /// createClassType - Create debugging information entry for a class.
258 /// @param Scope Scope in which this class is defined.
259 /// @param Name class name.
260 /// @param File File where this member is defined.
261 /// @param LineNumber Line number.
262 /// @param SizeInBits Member size.
263 /// @param AlignInBits Member alignment.
264 /// @param OffsetInBits Member offset.
265 /// @param Flags Flags to encode member attribute, e.g. private
266 /// @param Elements class members.
267 /// @param VTableHolder Debug info of the base class that contains vtable
268 /// for this type. This is used in
269 /// DW_AT_containing_type. See DWARF documentation
271 /// @param TemplateParms Template type parameters.
272 /// @param UniqueIdentifier A unique identifier for the class.
273 DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
274 DIFile File, unsigned LineNumber,
275 uint64_t SizeInBits, uint64_t AlignInBits,
276 uint64_t OffsetInBits, unsigned Flags,
277 DIType DerivedFrom, DIArray Elements,
278 DIType VTableHolder = DIType(),
279 MDNode *TemplateParms = nullptr,
280 StringRef UniqueIdentifier = StringRef());
282 /// createStructType - Create debugging information entry for a struct.
283 /// @param Scope Scope in which this struct is defined.
284 /// @param Name Struct name.
285 /// @param File File where this member is defined.
286 /// @param LineNumber Line number.
287 /// @param SizeInBits Member size.
288 /// @param AlignInBits Member alignment.
289 /// @param Flags Flags to encode member attribute, e.g. private
290 /// @param Elements Struct elements.
291 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
292 /// @param UniqueIdentifier A unique identifier for the struct.
293 DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
294 DIFile File, unsigned LineNumber,
295 uint64_t SizeInBits, uint64_t AlignInBits,
296 unsigned Flags, DIType DerivedFrom,
297 DIArray Elements, unsigned RunTimeLang = 0,
298 DIType VTableHolder = DIType(),
299 StringRef UniqueIdentifier = StringRef());
301 /// createUnionType - Create debugging information entry for an union.
302 /// @param Scope Scope in which this union is defined.
303 /// @param Name Union name.
304 /// @param File File where this member is defined.
305 /// @param LineNumber Line number.
306 /// @param SizeInBits Member size.
307 /// @param AlignInBits Member alignment.
308 /// @param Flags Flags to encode member attribute, e.g. private
309 /// @param Elements Union elements.
310 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
311 /// @param UniqueIdentifier A unique identifier for the union.
312 DICompositeType createUnionType(
313 DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
314 uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
315 DIArray Elements, unsigned RunTimeLang = 0,
316 StringRef UniqueIdentifier = StringRef());
318 /// createTemplateTypeParameter - Create debugging information for template
320 /// @param Scope Scope in which this type is defined.
321 /// @param Name Type parameter name.
322 /// @param Ty Parameter type.
323 /// @param File File where this type parameter is defined.
324 /// @param LineNo Line number.
325 /// @param ColumnNo Column Number.
326 DITemplateTypeParameter
327 createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
328 MDNode *File = nullptr, unsigned LineNo = 0,
329 unsigned ColumnNo = 0);
331 /// createTemplateValueParameter - Create debugging information for template
333 /// @param Scope Scope in which this type is defined.
334 /// @param Name Value parameter name.
335 /// @param Ty Parameter type.
336 /// @param Val Constant parameter value.
337 /// @param File File where this type parameter is defined.
338 /// @param LineNo Line number.
339 /// @param ColumnNo Column Number.
340 DITemplateValueParameter
341 createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
342 DIType Ty, Value *Val, MDNode *File = nullptr,
343 unsigned LineNo = 0, unsigned ColumnNo = 0);
345 /// \brief Create debugging information for a template template parameter.
346 /// @param Scope Scope in which this type is defined.
347 /// @param Name Value parameter name.
348 /// @param Ty Parameter type.
349 /// @param Val The fully qualified name of the template.
350 /// @param File File where this type parameter is defined.
351 /// @param LineNo Line number.
352 /// @param ColumnNo Column Number.
353 DITemplateValueParameter
354 createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
355 DIType Ty, StringRef Val,
356 MDNode *File = nullptr, unsigned LineNo = 0,
357 unsigned ColumnNo = 0);
359 /// \brief Create debugging information for a template parameter pack.
360 /// @param Scope Scope in which this type is defined.
361 /// @param Name Value parameter name.
362 /// @param Ty Parameter type.
363 /// @param Val An array of types in the pack.
364 /// @param File File where this type parameter is defined.
365 /// @param LineNo Line number.
366 /// @param ColumnNo Column Number.
367 DITemplateValueParameter
368 createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
369 DIType Ty, DIArray Val, MDNode *File = nullptr,
370 unsigned LineNo = 0, unsigned ColumnNo = 0);
372 /// createArrayType - Create debugging information entry for an array.
373 /// @param Size Array size.
374 /// @param AlignInBits Alignment.
375 /// @param Ty Element type.
376 /// @param Subscripts Subscripts.
377 DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
378 DIType Ty, DIArray Subscripts);
380 /// createVectorType - Create debugging information entry for a vector type.
381 /// @param Size Array size.
382 /// @param AlignInBits Alignment.
383 /// @param Ty Element type.
384 /// @param Subscripts Subscripts.
385 DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
386 DIType Ty, DIArray Subscripts);
388 /// createEnumerationType - Create debugging information entry for an
390 /// @param Scope Scope in which this enumeration is defined.
391 /// @param Name Union name.
392 /// @param File File where this member is defined.
393 /// @param LineNumber Line number.
394 /// @param SizeInBits Member size.
395 /// @param AlignInBits Member alignment.
396 /// @param Elements Enumeration elements.
397 /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
398 /// @param UniqueIdentifier A unique identifier for the enum.
399 DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
400 DIFile File, unsigned LineNumber, uint64_t SizeInBits,
401 uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
402 StringRef UniqueIdentifier = StringRef());
404 /// createSubroutineType - Create subroutine type.
405 /// @param File File in which this subroutine is defined.
406 /// @param ParameterTypes An array of subroutine parameter types. This
407 /// includes return type at 0th index.
408 /// @param Flags E.g.: LValueReference.
409 /// These flags are used to emit dwarf attributes.
410 DISubroutineType createSubroutineType(DIFile File,
411 DITypeArray ParameterTypes,
414 /// createArtificialType - Create a new DIType with "artificial" flag set.
415 DIType createArtificialType(DIType Ty);
417 /// createObjectPointerType - Create a new DIType with the "object pointer"
419 DIType createObjectPointerType(DIType Ty);
421 /// \brief Create a permanent forward-declared type.
422 DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
423 DIDescriptor Scope, DIFile F,
424 unsigned Line, unsigned RuntimeLang = 0,
425 uint64_t SizeInBits = 0,
426 uint64_t AlignInBits = 0,
427 StringRef UniqueIdentifier = StringRef());
429 /// \brief Create a temporary forward-declared type.
430 DICompositeType createReplaceableForwardDecl(
431 unsigned Tag, StringRef Name, DIDescriptor Scope, DIFile F,
432 unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
433 uint64_t AlignInBits = 0, StringRef UniqueIdentifier = StringRef());
435 /// retainType - Retain DIType in a module even if it is not referenced
436 /// through debug info anchors.
437 void retainType(DIType T);
439 /// createUnspecifiedParameter - Create unspecified parameter type
440 /// for a subroutine type.
441 DIBasicType createUnspecifiedParameter();
443 /// getOrCreateArray - Get a DIArray, create one if required.
444 DIArray getOrCreateArray(ArrayRef<Value *> Elements);
446 /// getOrCreateTypeArray - Get a DITypeArray, create one if required.
447 DITypeArray getOrCreateTypeArray(ArrayRef<Value *> Elements);
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);
454 /// createGlobalVariable - Create a new descriptor for the specified
456 /// @param Context Variable scope.
457 /// @param Name Name of the variable.
458 /// @param LinkageName Mangled name of the variable.
459 /// @param File File where this variable is defined.
460 /// @param LineNo Line number.
461 /// @param Ty Variable Type.
462 /// @param isLocalToUnit Boolean flag indicate whether this variable is
463 /// externally visible or not.
464 /// @param Val llvm::Value of the variable.
465 /// @param Decl Reference to the corresponding declaration.
467 createGlobalVariable(DIDescriptor Context, StringRef Name,
468 StringRef LinkageName, DIFile File, unsigned LineNo,
469 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
470 MDNode *Decl = nullptr);
472 /// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
473 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
475 createTempGlobalVariableFwdDecl(DIDescriptor Context, StringRef Name,
476 StringRef LinkageName, DIFile File,
477 unsigned LineNo, DITypeRef Ty,
478 bool isLocalToUnit, llvm::Value *Val,
479 MDNode *Decl = nullptr);
482 /// createLocalVariable - Create a new descriptor for the specified
484 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
485 /// DW_TAG_arg_variable.
486 /// @param Scope Variable scope.
487 /// @param Name Variable name.
488 /// @param File File where this variable is defined.
489 /// @param LineNo Line number.
490 /// @param Ty Variable Type
491 /// @param AlwaysPreserve Boolean. Set to true if debug info for this
492 /// variable should be preserved in optimized build.
493 /// @param Flags Flags, e.g. artificial variable.
494 /// @param ArgNo If this variable is an argument then this argument's
495 /// number. 1 indicates 1st argument.
496 DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
498 DIFile File, unsigned LineNo,
499 DITypeRef Ty, bool AlwaysPreserve = false,
503 /// createExpression - Create a new descriptor for the specified
504 /// variable which has a complex address expression for its address.
505 /// @param Addr An array of complex address operations.
506 DIExpression createExpression(ArrayRef<int64_t> Addr = None);
508 /// createFunction - Create a new descriptor for the specified subprogram.
509 /// See comments in DISubprogram for descriptions of these fields.
510 /// @param Scope Function scope.
511 /// @param Name Function name.
512 /// @param LinkageName Mangled function name.
513 /// @param File File where this variable is defined.
514 /// @param LineNo Line number.
515 /// @param Ty Function type.
516 /// @param isLocalToUnit True if this function is not externally visible.
517 /// @param isDefinition True if this is a function definition.
518 /// @param ScopeLine Set to the beginning of the scope this starts
519 /// @param Flags e.g. is this function prototyped or not.
520 /// These flags are used to emit dwarf attributes.
521 /// @param isOptimized True if optimization is ON.
522 /// @param Fn llvm::Function pointer.
523 /// @param TParam Function template parameters.
524 DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
525 StringRef LinkageName,
526 DIFile File, unsigned LineNo,
527 DICompositeType Ty, bool isLocalToUnit,
531 bool isOptimized = false,
532 Function *Fn = nullptr,
533 MDNode *TParam = nullptr,
534 MDNode *Decl = nullptr);
536 /// createTempFunctionFwdDecl - Identical to createFunction,
537 /// except that the resulting DbgNode is meant to be RAUWed.
538 DISubprogram createTempFunctionFwdDecl(DIDescriptor Scope, StringRef Name,
539 StringRef LinkageName,
540 DIFile File, unsigned LineNo,
541 DICompositeType Ty, bool isLocalToUnit,
545 bool isOptimized = false,
546 Function *Fn = nullptr,
547 MDNode *TParam = nullptr,
548 MDNode *Decl = nullptr);
551 /// FIXME: this is added for dragonegg. Once we update dragonegg
552 /// to call resolve function, this will be removed.
553 DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
554 StringRef LinkageName,
555 DIFile File, unsigned LineNo,
556 DICompositeType Ty, bool isLocalToUnit,
560 bool isOptimized = false,
561 Function *Fn = nullptr,
562 MDNode *TParam = nullptr,
563 MDNode *Decl = nullptr);
565 /// createMethod - Create a new descriptor for the specified C++ method.
566 /// See comments in DISubprogram for descriptions of these fields.
567 /// @param Scope Function scope.
568 /// @param Name Function name.
569 /// @param LinkageName Mangled function name.
570 /// @param File File where this variable is defined.
571 /// @param LineNo Line number.
572 /// @param Ty Function type.
573 /// @param isLocalToUnit True if this function is not externally visible..
574 /// @param isDefinition True if this is a function definition.
575 /// @param Virtuality Attributes describing virtualness. e.g. pure
576 /// virtual function.
577 /// @param VTableIndex Index no of this method in virtual table.
578 /// @param VTableHolder Type that holds vtable.
579 /// @param Flags e.g. is this function prototyped or not.
580 /// This flags are used to emit dwarf attributes.
581 /// @param isOptimized True if optimization is ON.
582 /// @param Fn llvm::Function pointer.
583 /// @param TParam Function template parameters.
584 DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
585 StringRef LinkageName,
586 DIFile File, unsigned LineNo,
587 DICompositeType Ty, bool isLocalToUnit,
589 unsigned Virtuality = 0, unsigned VTableIndex = 0,
590 DIType VTableHolder = DIType(),
592 bool isOptimized = false,
593 Function *Fn = nullptr,
594 MDNode *TParam = nullptr);
596 /// createNameSpace - This creates new descriptor for a namespace
597 /// with the specified parent scope.
598 /// @param Scope Namespace scope
599 /// @param Name Name of this namespace
600 /// @param File Source file
601 /// @param LineNo Line number
602 DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
603 DIFile File, unsigned LineNo);
606 /// createLexicalBlockFile - This creates a descriptor for a lexical
607 /// block with a new file attached. This merely extends the existing
608 /// lexical block as it crosses a file.
609 /// @param Scope Lexical block.
610 /// @param File Source file.
611 /// @param Discriminator DWARF path discriminator value.
612 DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope, DIFile File,
613 unsigned Discriminator = 0);
615 /// createLexicalBlock - This creates a descriptor for a lexical block
616 /// with the specified parent context.
617 /// @param Scope Parent lexical scope.
618 /// @param File Source file.
619 /// @param Line Line number.
620 /// @param Col Column number.
621 DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
622 unsigned Line, unsigned Col);
624 /// \brief Create a descriptor for an imported module.
625 /// @param Context The scope this module is imported into
626 /// @param NS The namespace being imported here
627 /// @param Line Line number
628 DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
631 /// \brief Create a descriptor for an imported module.
632 /// @param Context The scope this module is imported into
633 /// @param NS An aliased namespace
634 /// @param Line Line number
635 DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
638 /// \brief Create a descriptor for an imported function.
639 /// @param Context The scope this module is imported into
640 /// @param Decl The declaration (or definition) of a function, type, or
642 /// @param Line Line number
643 DIImportedEntity createImportedDeclaration(DIScope Context, DIScope Decl,
645 StringRef Name = StringRef());
646 DIImportedEntity createImportedDeclaration(DIScope Context,
649 StringRef Name = StringRef());
651 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
652 /// @param Storage llvm::Value of the variable
653 /// @param VarInfo Variable's debug info descriptor.
654 /// @param Expr A complex location expression.
655 /// @param InsertAtEnd Location for the new intrinsic.
656 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
657 DIExpression Expr, BasicBlock *InsertAtEnd);
659 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
660 /// @param Storage llvm::Value of the variable
661 /// @param VarInfo Variable's debug info descriptor.
662 /// @param Expr A complex location expression.
663 /// @param InsertBefore Location for the new intrinsic.
664 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
665 DIExpression Expr, Instruction *InsertBefore);
667 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
668 /// @param Val llvm::Value of the variable
669 /// @param Offset Offset
670 /// @param VarInfo Variable's debug info descriptor.
671 /// @param Expr A complex location expression.
672 /// @param InsertAtEnd Location for the new intrinsic.
673 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
674 DIVariable VarInfo, DIExpression Expr,
675 BasicBlock *InsertAtEnd);
677 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
678 /// @param Val llvm::Value of the variable
679 /// @param Offset Offset
680 /// @param VarInfo Variable's debug info descriptor.
681 /// @param Expr A complex location expression.
682 /// @param InsertBefore Location for the new intrinsic.
683 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
684 DIVariable VarInfo, DIExpression Expr,
685 Instruction *InsertBefore);
687 } // end namespace llvm