1 //===--- llvm/Analysis/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_ANALYSIS_DIBUILDER_H
16 #define LLVM_ANALYSIS_DIBUILDER_H
18 #include "llvm/System/DataTypes.h"
19 #include "llvm/ADT/StringRef.h"
34 LLVMContext & VMContext;
37 DIBuilder(const DIBuilder &); // DO NOT IMPLEMENT
38 void operator=(const DIBuilder &); // DO NOT IMPLEMENT
41 explicit DIBuilder(Module &M);
42 const MDNode *getCU() { return TheCU; }
44 /// CreateCompileUnit - A CompileUnit provides an anchor for all debugging
45 /// information generated during this instance of compilation.
46 /// @param Lang Source programming language, eg. dwarf::DW_LANG_C99
47 /// @param File File name
48 /// @param Dir Directory
49 /// @param Producer String identify producer of debugging information.
50 /// Usuall this is a compiler version string.
51 /// @param isOptimized A boolean flag which indicates whether optimization
53 /// @param Flags This string lists command line options. This string is
54 /// directly embedded in debug info output which may be used
55 /// by a tool analyzing generated debugging information.
56 /// @param RV This indicates runtime version for languages like
58 void CreateCompileUnit(unsigned Lang, StringRef File, StringRef Dir,
60 bool isOptimized, StringRef Flags, unsigned RV);
62 /// CreateFile - Create a file descriptor to hold debugging information
64 DIFile CreateFile(StringRef Filename, StringRef Directory);
66 /// CreateEnumerator - Create a single enumerator value.
67 DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
69 /// CreateBasicType - Create debugging information entry for a basic
71 /// @param Name Type name.
72 /// @param SizeInBits Size of the type.
73 /// @param AlignInBits Type alignment.
74 /// @param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float.
75 DIType CreateBasicType(StringRef Name, uint64_t SizeInBits,
76 uint64_t AlignInBits, unsigned Encoding);
78 /// CreateQualifiedType - Create debugging information entry for a qualified
79 /// type, e.g. 'const int'.
80 /// @param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
81 /// @param FromTy Base Type.
82 DIType CreateQualifiedType(unsigned Tag, DIType FromTy);
84 /// CreatePointerType - Create debugging information entry for a pointer.
85 DIType CreatePointerType(DIType PointeeTy, uint64_t SizeInBits,
86 uint64_t AlignInBits = 0, StringRef Name = StringRef());
88 /// CreateReferenceType - Create debugging information entry for a reference.
89 DIType CreateReferenceType(DIType RTy);
91 /// CreateTypedef - Create debugging information entry for a typedef.
92 DIType CreateTypedef(DIType Ty, StringRef Name, DIFile F, unsigned LineNo);
94 /// CreateFriend - Create debugging information entry for a 'friend'.
95 DIType CreateFriend(DIType Ty, DIType FriendTy);
97 /// CreateInheritance - Create debugging information entry to establish
98 /// inheritance relationship between two types.
99 DIType CreateInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset,
102 /// CreateMemberType - Create debugging information entry for a member.
103 DIType CreateMemberType(DIDescriptor Context, StringRef Name, DIFile F,
104 unsigned LineNumber, uint64_t SizeInBits,
105 uint64_t AlignInBits, uint64_t OffsetInBits,
106 unsigned Flags, DIType Ty);
108 /// CreateArtificialType - Create a new DIType with "artificial" flag set.
109 DIType CreateArtificialType(DIType Ty);
111 } // end namespace llvm