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 void CreateCompileUnit(unsigned Lang, StringRef F, StringRef D, StringRef P,
47 bool isOptimized, StringRef Flags, unsigned RV);
49 /// CreateFile - Create a file descriptor to hold debugging information
51 DIFile CreateFile(StringRef Filename, StringRef Directory);
53 /// CreateEnumerator - Create a single enumerator value.
54 DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
56 /// CreateBasicType - Create debugging information entry for a basic
58 DIType CreateBasicType(StringRef Name, uint64_t SizeInBits,
59 uint64_t AlignInBits, unsigned Encoding);
61 /// CreateQaulifiedType - Create debugging information entry for a qualified
62 /// type, e.g. 'const int'.
63 DIType CreateQualifiedType(unsigned Tag, DIType FromTy);
65 /// CreatePointerType - Create debugging information entry for a pointer.
66 DIType CreatePointerType(DIType PointeeTy, uint64_t SizeInBits,
67 uint64_t AlignInBits = 0, StringRef Name = StringRef());
69 /// CreateReferenceType - Create debugging information entry for a reference.
70 DIType CreateReferenceType(DIType RTy);
72 /// CreateTypedef - Create debugging information entry for a typedef.
73 DIType CreateTypedef(DIType Ty, StringRef Name, DIFile F, unsigned LineNo);
75 /// CreateFriend - Create debugging information entry for a 'friend'.
76 DIType CreateFriend(DIType Ty, DIType FriendTy);
78 /// CreateInheritance - Create debugging information entry to establish
79 /// inheritnace relationship between two types.
80 DIType CreateInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset,
83 /// CreateMemberType - Create debugging information entry for a member.
84 DIType CreateMemberType(DIDescriptor Context, StringRef Name, DIFile F,
85 unsigned LineNumber, uint64_t SizeInBits,
86 uint64_t AlignInBits, uint64_t OffsetInBits,
87 unsigned Flags, DIType Ty);
89 /// CreateArtificialType - Create a new DIType with "artificial" flag set.
90 DIType CreateArtificialType(DIType Ty);
92 } // end namespace llvm