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;
56 LLVMContext &VMContext;
58 MDNode *TempEnumTypes;
59 MDNode *TempRetainTypes;
60 MDNode *TempSubprograms;
62 MDNode *TempImportedModules;
64 Function *DeclareFn; // llvm.dbg.declare
65 Function *ValueFn; // llvm.dbg.value
67 SmallVector<Value *, 4> AllEnumTypes;
68 /// Use TrackingVH to collect RetainTypes, since they can be updated
70 SmallVector<TrackingVH<MDNode>, 4> AllRetainTypes;
71 SmallVector<Value *, 4> AllSubprograms;
72 SmallVector<Value *, 4> AllGVs;
73 SmallVector<TrackingVH<MDNode>, 4> AllImportedModules;
75 /// Each subprogram's preserved local variables.
76 DenseMap<MDNode *, std::vector<TrackingVH<MDNode>>> PreservedVariables;
78 // Private use for multiple types of template parameters.
79 DITemplateValueParameter
80 createTemplateValueParameter(unsigned Tag, DIDescriptor Scope,
81 StringRef Name, DIType Ty, Value *Val,
82 MDNode *File = nullptr, unsigned LineNo = 0,
83 unsigned ColumnNo = 0);
85 DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
86 void operator=(const DIBuilder &) LLVM_DELETED_FUNCTION;
89 explicit DIBuilder(Module &M);
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 PropertyNode Property associated with this ivar.
237 DIDerivedType createObjCIVar(StringRef Name, DIFile File,
238 unsigned LineNo, uint64_t SizeInBits,
239 uint64_t AlignInBits, uint64_t OffsetInBits,
240 unsigned Flags, DIType Ty,
241 MDNode *PropertyNode);
243 /// createObjCProperty - Create debugging information entry for Objective-C
245 /// @param Name Property name.
246 /// @param File File where this property is defined.
247 /// @param LineNumber Line number.
248 /// @param GetterName Name of the Objective C property getter selector.
249 /// @param SetterName Name of the Objective C property setter selector.
250 /// @param PropertyAttributes Objective C property attributes.
252 DIObjCProperty createObjCProperty(StringRef Name,
253 DIFile File, unsigned LineNumber,
254 StringRef GetterName,
255 StringRef SetterName,
256 unsigned PropertyAttributes,
259 /// createClassType - Create debugging information entry for a class.
260 /// @param Scope Scope in which this class is defined.
261 /// @param Name class name.
262 /// @param File File where this member is defined.
263 /// @param LineNumber Line number.
264 /// @param SizeInBits Member size.
265 /// @param AlignInBits Member alignment.
266 /// @param OffsetInBits Member offset.
267 /// @param Flags Flags to encode member attribute, e.g. private
268 /// @param Elements class members.
269 /// @param VTableHolder Debug info of the base class that contains vtable
270 /// for this type. This is used in
271 /// DW_AT_containing_type. See DWARF documentation
273 /// @param TemplateParms Template type parameters.
274 /// @param UniqueIdentifier A unique identifier for the class.
275 DICompositeType createClassType(DIDescriptor Scope, StringRef Name,
276 DIFile File, unsigned LineNumber,
277 uint64_t SizeInBits, uint64_t AlignInBits,
278 uint64_t OffsetInBits, unsigned Flags,
279 DIType DerivedFrom, DIArray Elements,
280 DIType VTableHolder = DIType(),
281 MDNode *TemplateParms = nullptr,
282 StringRef UniqueIdentifier = StringRef());
284 /// createStructType - Create debugging information entry for a struct.
285 /// @param Scope Scope in which this struct is defined.
286 /// @param Name Struct name.
287 /// @param File File where this member is defined.
288 /// @param LineNumber Line number.
289 /// @param SizeInBits Member size.
290 /// @param AlignInBits Member alignment.
291 /// @param Flags Flags to encode member attribute, e.g. private
292 /// @param Elements Struct elements.
293 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
294 /// @param UniqueIdentifier A unique identifier for the struct.
295 DICompositeType createStructType(DIDescriptor Scope, StringRef Name,
296 DIFile File, unsigned LineNumber,
297 uint64_t SizeInBits, uint64_t AlignInBits,
298 unsigned Flags, DIType DerivedFrom,
299 DIArray Elements, unsigned RunTimeLang = 0,
300 DIType VTableHolder = DIType(),
301 StringRef UniqueIdentifier = StringRef());
303 /// createUnionType - Create debugging information entry for an union.
304 /// @param Scope Scope in which this union is defined.
305 /// @param Name Union name.
306 /// @param File File where this member is defined.
307 /// @param LineNumber Line number.
308 /// @param SizeInBits Member size.
309 /// @param AlignInBits Member alignment.
310 /// @param Flags Flags to encode member attribute, e.g. private
311 /// @param Elements Union elements.
312 /// @param RunTimeLang Optional parameter, Objective-C runtime version.
313 /// @param UniqueIdentifier A unique identifier for the union.
314 DICompositeType createUnionType(
315 DIDescriptor Scope, StringRef Name, DIFile File, unsigned LineNumber,
316 uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
317 DIArray Elements, unsigned RunTimeLang = 0,
318 StringRef UniqueIdentifier = StringRef());
320 /// createTemplateTypeParameter - Create debugging information for template
322 /// @param Scope Scope in which this type is defined.
323 /// @param Name Type parameter name.
324 /// @param Ty Parameter type.
325 /// @param File File where this type parameter is defined.
326 /// @param LineNo Line number.
327 /// @param ColumnNo Column Number.
328 DITemplateTypeParameter
329 createTemplateTypeParameter(DIDescriptor Scope, StringRef Name, DIType Ty,
330 MDNode *File = nullptr, unsigned LineNo = 0,
331 unsigned ColumnNo = 0);
333 /// createTemplateValueParameter - Create debugging information for template
335 /// @param Scope Scope in which this type is defined.
336 /// @param Name Value parameter name.
337 /// @param Ty Parameter type.
338 /// @param Val Constant parameter value.
339 /// @param File File where this type parameter is defined.
340 /// @param LineNo Line number.
341 /// @param ColumnNo Column Number.
342 DITemplateValueParameter
343 createTemplateValueParameter(DIDescriptor Scope, StringRef Name,
344 DIType Ty, Value *Val, MDNode *File = nullptr,
345 unsigned LineNo = 0, unsigned ColumnNo = 0);
347 /// \brief Create debugging information for a template template parameter.
348 /// @param Scope Scope in which this type is defined.
349 /// @param Name Value parameter name.
350 /// @param Ty Parameter type.
351 /// @param Val The fully qualified name of the template.
352 /// @param File File where this type parameter is defined.
353 /// @param LineNo Line number.
354 /// @param ColumnNo Column Number.
355 DITemplateValueParameter
356 createTemplateTemplateParameter(DIDescriptor Scope, StringRef Name,
357 DIType Ty, StringRef Val,
358 MDNode *File = nullptr, unsigned LineNo = 0,
359 unsigned ColumnNo = 0);
361 /// \brief Create debugging information for a template parameter pack.
362 /// @param Scope Scope in which this type is defined.
363 /// @param Name Value parameter name.
364 /// @param Ty Parameter type.
365 /// @param Val An array of types in the pack.
366 /// @param File File where this type parameter is defined.
367 /// @param LineNo Line number.
368 /// @param ColumnNo Column Number.
369 DITemplateValueParameter
370 createTemplateParameterPack(DIDescriptor Scope, StringRef Name,
371 DIType Ty, DIArray Val, MDNode *File = nullptr,
372 unsigned LineNo = 0, unsigned ColumnNo = 0);
374 /// createArrayType - Create debugging information entry for an array.
375 /// @param Size Array size.
376 /// @param AlignInBits Alignment.
377 /// @param Ty Element type.
378 /// @param Subscripts Subscripts.
379 DICompositeType createArrayType(uint64_t Size, uint64_t AlignInBits,
380 DIType Ty, DIArray Subscripts);
382 /// createVectorType - Create debugging information entry for a vector type.
383 /// @param Size Array size.
384 /// @param AlignInBits Alignment.
385 /// @param Ty Element type.
386 /// @param Subscripts Subscripts.
387 DICompositeType createVectorType(uint64_t Size, uint64_t AlignInBits,
388 DIType Ty, DIArray Subscripts);
390 /// createEnumerationType - Create debugging information entry for an
392 /// @param Scope Scope in which this enumeration is defined.
393 /// @param Name Union name.
394 /// @param File File where this member is defined.
395 /// @param LineNumber Line number.
396 /// @param SizeInBits Member size.
397 /// @param AlignInBits Member alignment.
398 /// @param Elements Enumeration elements.
399 /// @param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
400 /// @param UniqueIdentifier A unique identifier for the enum.
401 DICompositeType createEnumerationType(DIDescriptor Scope, StringRef Name,
402 DIFile File, unsigned LineNumber, uint64_t SizeInBits,
403 uint64_t AlignInBits, DIArray Elements, DIType UnderlyingType,
404 StringRef UniqueIdentifier = StringRef());
406 /// createSubroutineType - Create subroutine type.
407 /// @param File File in which this subroutine is defined.
408 /// @param ParameterTypes An array of subroutine parameter types. This
409 /// includes return type at 0th index.
410 /// @param Flags E.g.: LValueReference.
411 /// These flags are used to emit dwarf attributes.
412 DISubroutineType createSubroutineType(DIFile File,
413 DITypeArray ParameterTypes,
416 /// createArtificialType - Create a new DIType with "artificial" flag set.
417 DIType createArtificialType(DIType Ty);
419 /// createObjectPointerType - Create a new DIType with the "object pointer"
421 DIType createObjectPointerType(DIType Ty);
423 /// \brief Create a permanent forward-declared type.
424 DICompositeType createForwardDecl(unsigned Tag, StringRef Name,
425 DIDescriptor Scope, DIFile F,
426 unsigned Line, unsigned RuntimeLang = 0,
427 uint64_t SizeInBits = 0,
428 uint64_t AlignInBits = 0,
429 StringRef UniqueIdentifier = StringRef());
431 /// \brief Create a temporary forward-declared type.
432 DICompositeType createReplaceableForwardDecl(
433 unsigned Tag, StringRef Name, DIDescriptor Scope, DIFile F,
434 unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
435 uint64_t AlignInBits = 0, StringRef UniqueIdentifier = StringRef());
437 /// retainType - Retain DIType in a module even if it is not referenced
438 /// through debug info anchors.
439 void retainType(DIType T);
441 /// createUnspecifiedParameter - Create unspecified parameter type
442 /// for a subroutine type.
443 DIBasicType createUnspecifiedParameter();
445 /// getOrCreateArray - Get a DIArray, create one if required.
446 DIArray getOrCreateArray(ArrayRef<Value *> Elements);
448 /// getOrCreateTypeArray - Get a DITypeArray, create one if required.
449 DITypeArray getOrCreateTypeArray(ArrayRef<Value *> Elements);
451 /// getOrCreateSubrange - Create a descriptor for a value range. This
452 /// implicitly uniques the values returned.
453 DISubrange getOrCreateSubrange(int64_t Lo, int64_t Count);
456 /// createGlobalVariable - Create a new descriptor for the specified
458 /// @param Context Variable scope.
459 /// @param Name Name of the variable.
460 /// @param LinkageName Mangled name of the variable.
461 /// @param File File where this variable is defined.
462 /// @param LineNo Line number.
463 /// @param Ty Variable Type.
464 /// @param isLocalToUnit Boolean flag indicate whether this variable is
465 /// externally visible or not.
466 /// @param Val llvm::Value of the variable.
467 /// @param Decl Reference to the corresponding declaration.
469 createGlobalVariable(DIDescriptor Context, StringRef Name,
470 StringRef LinkageName, DIFile File, unsigned LineNo,
471 DITypeRef Ty, bool isLocalToUnit, llvm::Value *Val,
472 MDNode *Decl = nullptr);
474 /// createTempGlobalVariableFwdDecl - Identical to createGlobalVariable
475 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
477 createTempGlobalVariableFwdDecl(DIDescriptor Context, StringRef Name,
478 StringRef LinkageName, DIFile File,
479 unsigned LineNo, DITypeRef Ty,
480 bool isLocalToUnit, llvm::Value *Val,
481 MDNode *Decl = nullptr);
484 /// createLocalVariable - Create a new descriptor for the specified
486 /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
487 /// DW_TAG_arg_variable.
488 /// @param Scope Variable scope.
489 /// @param Name Variable name.
490 /// @param File File where this variable is defined.
491 /// @param LineNo Line number.
492 /// @param Ty Variable Type
493 /// @param AlwaysPreserve Boolean. Set to true if debug info for this
494 /// variable should be preserved in optimized build.
495 /// @param Flags Flags, e.g. artificial variable.
496 /// @param ArgNo If this variable is an argument then this argument's
497 /// number. 1 indicates 1st argument.
498 DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
500 DIFile File, unsigned LineNo,
501 DITypeRef Ty, bool AlwaysPreserve = false,
505 /// createExpression - Create a new descriptor for the specified
506 /// variable which has a complex address expression for its address.
507 /// @param Addr An array of complex address operations.
508 DIExpression createExpression(ArrayRef<int64_t> Addr = None);
510 /// createPieceExpression - Create a descriptor to describe one part
511 /// of aggregate variable that is fragmented across multiple Values.
513 /// @param OffsetInBytes Offset of the piece in bytes.
514 /// @param SizeInBytes Size of the piece in bytes.
515 DIExpression createPieceExpression(unsigned OffsetInBytes,
516 unsigned SizeInBytes);
518 /// createFunction - Create a new descriptor for the specified subprogram.
519 /// See comments in DISubprogram for descriptions of these fields.
520 /// @param Scope Function scope.
521 /// @param Name Function name.
522 /// @param LinkageName Mangled function name.
523 /// @param File File where this variable is defined.
524 /// @param LineNo Line number.
525 /// @param Ty Function type.
526 /// @param isLocalToUnit True if this function is not externally visible.
527 /// @param isDefinition True if this is a function definition.
528 /// @param ScopeLine Set to the beginning of the scope this starts
529 /// @param Flags e.g. is this function prototyped or not.
530 /// These flags are used to emit dwarf attributes.
531 /// @param isOptimized True if optimization is ON.
532 /// @param Fn llvm::Function pointer.
533 /// @param TParam Function template parameters.
534 DISubprogram createFunction(DIDescriptor Scope, StringRef Name,
535 StringRef LinkageName,
536 DIFile File, unsigned LineNo,
537 DICompositeType Ty, bool isLocalToUnit,
541 bool isOptimized = false,
542 Function *Fn = nullptr,
543 MDNode *TParam = nullptr,
544 MDNode *Decl = nullptr);
546 /// createTempFunctionFwdDecl - Identical to createFunction,
547 /// except that the resulting DbgNode is meant to be RAUWed.
548 DISubprogram createTempFunctionFwdDecl(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);
561 /// FIXME: this is added for dragonegg. Once we update dragonegg
562 /// to call resolve function, this will be removed.
563 DISubprogram createFunction(DIScopeRef Scope, StringRef Name,
564 StringRef LinkageName,
565 DIFile File, unsigned LineNo,
566 DICompositeType Ty, bool isLocalToUnit,
570 bool isOptimized = false,
571 Function *Fn = nullptr,
572 MDNode *TParam = nullptr,
573 MDNode *Decl = nullptr);
575 /// createMethod - Create a new descriptor for the specified C++ method.
576 /// See comments in DISubprogram for descriptions of these fields.
577 /// @param Scope Function scope.
578 /// @param Name Function name.
579 /// @param LinkageName Mangled function name.
580 /// @param File File where this variable is defined.
581 /// @param LineNo Line number.
582 /// @param Ty Function type.
583 /// @param isLocalToUnit True if this function is not externally visible..
584 /// @param isDefinition True if this is a function definition.
585 /// @param Virtuality Attributes describing virtualness. e.g. pure
586 /// virtual function.
587 /// @param VTableIndex Index no of this method in virtual table.
588 /// @param VTableHolder Type that holds vtable.
589 /// @param Flags e.g. is this function prototyped or not.
590 /// This flags are used to emit dwarf attributes.
591 /// @param isOptimized True if optimization is ON.
592 /// @param Fn llvm::Function pointer.
593 /// @param TParam Function template parameters.
594 DISubprogram createMethod(DIDescriptor Scope, StringRef Name,
595 StringRef LinkageName,
596 DIFile File, unsigned LineNo,
597 DICompositeType Ty, bool isLocalToUnit,
599 unsigned Virtuality = 0, unsigned VTableIndex = 0,
600 DIType VTableHolder = DIType(),
602 bool isOptimized = false,
603 Function *Fn = nullptr,
604 MDNode *TParam = nullptr);
606 /// createNameSpace - This creates new descriptor for a namespace
607 /// with the specified parent scope.
608 /// @param Scope Namespace scope
609 /// @param Name Name of this namespace
610 /// @param File Source file
611 /// @param LineNo Line number
612 DINameSpace createNameSpace(DIDescriptor Scope, StringRef Name,
613 DIFile File, unsigned LineNo);
616 /// createLexicalBlockFile - This creates a descriptor for a lexical
617 /// block with a new file attached. This merely extends the existing
618 /// lexical block as it crosses a file.
619 /// @param Scope Lexical block.
620 /// @param File Source file.
621 /// @param Discriminator DWARF path discriminator value.
622 DILexicalBlockFile createLexicalBlockFile(DIDescriptor Scope, DIFile File,
623 unsigned Discriminator = 0);
625 /// createLexicalBlock - This creates a descriptor for a lexical block
626 /// with the specified parent context.
627 /// @param Scope Parent lexical scope.
628 /// @param File Source file.
629 /// @param Line Line number.
630 /// @param Col Column number.
631 DILexicalBlock createLexicalBlock(DIDescriptor Scope, DIFile File,
632 unsigned Line, unsigned Col);
634 /// \brief Create a descriptor for an imported module.
635 /// @param Context The scope this module is imported into
636 /// @param NS The namespace being imported here
637 /// @param Line Line number
638 DIImportedEntity createImportedModule(DIScope Context, DINameSpace NS,
641 /// \brief Create a descriptor for an imported module.
642 /// @param Context The scope this module is imported into
643 /// @param NS An aliased namespace
644 /// @param Line Line number
645 DIImportedEntity createImportedModule(DIScope Context, DIImportedEntity NS,
648 /// \brief Create a descriptor for an imported function.
649 /// @param Context The scope this module is imported into
650 /// @param Decl The declaration (or definition) of a function, type, or
652 /// @param Line Line number
653 DIImportedEntity createImportedDeclaration(DIScope Context, DIDescriptor Decl,
655 StringRef Name = StringRef());
656 DIImportedEntity createImportedDeclaration(DIScope Context,
659 StringRef Name = StringRef());
661 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
662 /// @param Storage llvm::Value of the variable
663 /// @param VarInfo Variable's debug info descriptor.
664 /// @param Expr A complex location expression.
665 /// @param InsertAtEnd Location for the new intrinsic.
666 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
667 DIExpression Expr, BasicBlock *InsertAtEnd);
669 /// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
670 /// @param Storage llvm::Value of the variable
671 /// @param VarInfo Variable's debug info descriptor.
672 /// @param Expr A complex location expression.
673 /// @param InsertBefore Location for the new intrinsic.
674 Instruction *insertDeclare(llvm::Value *Storage, DIVariable VarInfo,
675 DIExpression Expr, Instruction *InsertBefore);
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 InsertAtEnd Location for the new intrinsic.
683 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
684 DIVariable VarInfo, DIExpression Expr,
685 BasicBlock *InsertAtEnd);
687 /// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
688 /// @param Val llvm::Value of the variable
689 /// @param Offset Offset
690 /// @param VarInfo Variable's debug info descriptor.
691 /// @param Expr A complex location expression.
692 /// @param InsertBefore Location for the new intrinsic.
693 Instruction *insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
694 DIVariable VarInfo, DIExpression Expr,
695 Instruction *InsertBefore);
697 } // end namespace llvm