1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/include/llvm/Analysis/DIBuilder.h
Devang Patel 6c1b802673 Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
	DBuilder.CreatePointerType(Ty, Size);
instead of
	DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
                                       TheCU, "", getOrCreateMainFile(),
                                       0, Size, 0, 0, 0, OCTy);

llvm-svn: 118248
2010-11-04 15:01:38 +00:00

95 lines
3.5 KiB
C++

//===--- llvm/Analysis/DIBuilder.h - Debug Information Builder --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a DIBuilder that is useful for creating debugging
// information entries in LLVM IR form.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ANALYSIS_DIBUILDER_H
#define LLVM_ANALYSIS_DIBUILDER_H
#include "llvm/System/DataTypes.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
class Module;
class LLVMContext;
class MDNode;
class StringRef;
class DIDescriptor;
class DIFile;
class DIEnumerator;
class DIType;
class DIBuilder {
private:
Module &M;
LLVMContext & VMContext;
MDNode *TheCU;
DIBuilder(const DIBuilder &); // DO NOT IMPLEMENT
void operator=(const DIBuilder &); // DO NOT IMPLEMENT
public:
explicit DIBuilder(Module &M);
const MDNode *getCU() { return TheCU; }
/// CreateCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
void CreateCompileUnit(unsigned Lang, StringRef F, StringRef D, StringRef P,
bool isOptimized, StringRef Flags, unsigned RV);
/// CreateFile - Create a file descriptor to hold debugging information
/// for a file.
DIFile CreateFile(StringRef Filename, StringRef Directory);
/// CreateEnumerator - Create a single enumerator value.
DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
/// CreateBasicType - Create debugging information entry for a basic
/// type, e.g 'char'.
DIType CreateBasicType(StringRef Name, uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Encoding);
/// CreateQaulifiedType - Create debugging information entry for a qualified
/// type, e.g. 'const int'.
DIType CreateQualifiedType(unsigned Tag, DIType FromTy);
/// CreatePointerType - Create debugging information entry for a pointer.
DIType CreatePointerType(DIType PointeeTy, uint64_t SizeInBits,
uint64_t AlignInBits = 0, StringRef Name = StringRef());
/// CreateReferenceType - Create debugging information entry for a reference.
DIType CreateReferenceType(DIType RTy);
/// CreateTypedef - Create debugging information entry for a typedef.
DIType CreateTypedef(DIType Ty, StringRef Name, DIFile F, unsigned LineNo);
/// CreateFriend - Create debugging information entry for a 'friend'.
DIType CreateFriend(DIType Ty, DIType FriendTy);
/// CreateInheritance - Create debugging information entry to establish
/// inheritnace relationship between two types.
DIType CreateInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset,
unsigned Flags);
/// CreateMemberType - Create debugging information entry for a member.
DIType CreateMemberType(DIDescriptor Context, StringRef Name, DIFile F,
unsigned LineNumber, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, DIType Ty);
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
DIType CreateArtificialType(DIType Ty);
};
} // end namespace llvm
#endif