blob: 44cc49ade123a95cac3db4ea2636ba0d33efad63 [file] [log] [blame]
Daniel Dunbar3845f862008-10-31 03:54:29 +00001//===--- CGDebugInfo.h - DebugInfo for LLVM CodeGen -------------*- C++ -*-===//
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
Mike Stump1eb44332009-09-09 15:08:12 +000010// This is the source level debug info generator for llvm translation.
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_CODEGEN_CGDEBUGINFO_H
15#define CLANG_CODEGEN_CGDEBUGINFO_H
16
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +000017#include "clang/AST/Type.h"
Mike Stumpb1a6e682009-09-30 02:43:10 +000018#include "clang/AST/Expr.h"
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000019#include "clang/Basic/SourceLocation.h"
Bill Wendling2a5d6442012-06-28 00:30:19 +000020#include "llvm/DebugInfo.h"
Bill Wendling7b7c9732012-06-29 08:32:29 +000021#include "llvm/DIBuilder.h"
Chris Lattner9c85ba32008-11-10 06:08:34 +000022#include "llvm/ADT/DenseMap.h"
Daniel Dunbar23e81ba2009-09-19 19:27:24 +000023#include "llvm/Support/ValueHandle.h"
Devang Patel9c6c3a02010-01-14 00:36:21 +000024#include "llvm/Support/Allocator.h"
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000025
Daniel Dunbar45d196b2008-11-01 01:53:16 +000026#include "CGBuilder.h"
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000027
Daniel Dunbar23e81ba2009-09-19 19:27:24 +000028namespace llvm {
29 class MDNode;
30}
31
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000032namespace clang {
Benjamin Kramer478851c2012-07-04 17:04:04 +000033 class CXXMethodDecl;
Sanjiv Guptacc9b1632008-05-30 10:30:31 +000034 class VarDecl;
Devang Patel9ca36b62009-02-26 21:10:26 +000035 class ObjCInterfaceDecl;
Devang Patel9c1714b2011-04-05 17:30:54 +000036 class ClassTemplateSpecializationDecl;
Peter Collingbournefd05ca02011-06-14 04:02:39 +000037 class GlobalDecl;
Daniel Dunbar45d196b2008-11-01 01:53:16 +000038
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000039namespace CodeGen {
40 class CodeGenModule;
Mike Stumpb1a6e682009-09-30 02:43:10 +000041 class CodeGenFunction;
John McCall6b5a61b2011-02-07 10:33:21 +000042 class CGBlockInfo;
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000043
Mike Stump1eb44332009-09-09 15:08:12 +000044/// CGDebugInfo - This class gathers all debug information during compilation
45/// and is responsible for emitting to llvm globals or pass directly to
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +000046/// the backend.
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +000047class CGDebugInfo {
Anders Carlsson20f12a22009-12-06 18:00:51 +000048 CodeGenModule &CGM;
Devang Patel823d8e92010-12-08 22:42:58 +000049 llvm::DIBuilder DBuilder;
Devang Patel17800552010-03-09 00:44:50 +000050 llvm::DICompileUnit TheCU;
Chris Lattner9c85ba32008-11-10 06:08:34 +000051 SourceLocation CurLoc, PrevLoc;
Devang Patel4ce3f202010-01-28 18:11:52 +000052 llvm::DIType VTablePtrType;
Devang Patel17800552010-03-09 00:44:50 +000053
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +000054 /// TypeCache - Cache of previously constructed Types.
Ted Kremenek590838b2010-03-29 18:29:57 +000055 llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
Mike Stump1eb44332009-09-09 15:08:12 +000056
Eric Christopher9965dea2012-02-16 22:54:45 +000057 /// CompleteTypeCache - Cache of previously constructed complete RecordTypes.
58 llvm::DenseMap<void *, llvm::WeakVH> CompletedTypeCache;
59
Eric Christopher7ff0c5d2012-02-18 00:50:17 +000060 /// ReplaceMap - Cache of forward declared types to RAUW at the end of
61 /// compilation.
62 std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap;
63
Mike Stump9bc093c2009-05-14 02:03:51 +000064 bool BlockLiteralGenericSet;
65 llvm::DIType BlockLiteralGeneric;
66
Eric Christopheraa2164c2011-09-29 00:00:45 +000067 // LexicalBlockStack - Keep track of our current nested lexical block.
68 std::vector<llvm::TrackingVH<llvm::MDNode> > LexicalBlockStack;
Devang Patel3dd96a12010-01-29 18:11:03 +000069 llvm::DenseMap<const Decl *, llvm::WeakVH> RegionMap;
Eric Christopheraa2164c2011-09-29 00:00:45 +000070 // FnBeginRegionCount - Keep track of LexicalBlockStack counter at the
71 // beginning of a function. This is used to pop unbalanced regions at
72 // the end of a function.
Devang Patel5a6fbcf2010-07-22 22:29:16 +000073 std::vector<unsigned> FnBeginRegionCount;
74
Devang Patel89f05f82010-01-28 18:21:00 +000075 /// DebugInfoNames - This is a storage for names that are
Devang Patel9c6c3a02010-01-14 00:36:21 +000076 /// constructed on demand. For example, C++ destructors, C++ operators etc..
Devang Patel89f05f82010-01-28 18:21:00 +000077 llvm::BumpPtrAllocator DebugInfoNames;
Chris Lattner686775d2011-07-20 06:58:45 +000078 StringRef CWDName;
Devang Patel9c6c3a02010-01-14 00:36:21 +000079
Ted Kremenek9c250392010-03-30 00:27:51 +000080 llvm::DenseMap<const char *, llvm::WeakVH> DIFileCache;
Devang Patel4125fd22010-01-19 01:54:44 +000081 llvm::DenseMap<const FunctionDecl *, llvm::WeakVH> SPCache;
Devang Patelabb485f2010-02-01 19:16:32 +000082 llvm::DenseMap<const NamespaceDecl *, llvm::WeakVH> NameSpaceCache;
Devang Patel4125fd22010-01-19 01:54:44 +000083
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +000084 /// Helper functions for getOrCreateType.
Devang Patelf1d1d9a2010-11-01 16:52:40 +000085 llvm::DIType CreateType(const BuiltinType *Ty);
Devang Patel344ff5d2010-12-09 00:25:29 +000086 llvm::DIType CreateType(const ComplexType *Ty);
Devang Patel17800552010-03-09 00:44:50 +000087 llvm::DIType CreateQualifiedType(QualType Ty, llvm::DIFile F);
88 llvm::DIType CreateType(const TypedefType *Ty, llvm::DIFile F);
Mike Stump1eb44332009-09-09 15:08:12 +000089 llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
Devang Patel17800552010-03-09 00:44:50 +000090 llvm::DIFile F);
91 llvm::DIType CreateType(const PointerType *Ty, llvm::DIFile F);
92 llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DIFile F);
93 llvm::DIType CreateType(const FunctionType *Ty, llvm::DIFile F);
Devang Patel31f7d022011-01-17 22:23:07 +000094 llvm::DIType CreateType(const RecordType *Ty);
Eric Christopher9965dea2012-02-16 22:54:45 +000095 llvm::DIType CreateLimitedType(const RecordType *Ty);
Devang Patel17800552010-03-09 00:44:50 +000096 llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DIFile F);
John McCallc12c5bb2010-05-15 11:32:37 +000097 llvm::DIType CreateType(const ObjCObjectType *Ty, llvm::DIFile F);
Devang Patel17800552010-03-09 00:44:50 +000098 llvm::DIType CreateType(const VectorType *Ty, llvm::DIFile F);
99 llvm::DIType CreateType(const ArrayType *Ty, llvm::DIFile F);
100 llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DIFile F);
Douglas Gregor36b8ee62011-01-22 01:58:15 +0000101 llvm::DIType CreateType(const RValueReferenceType *Ty, llvm::DIFile Unit);
Devang Patel17800552010-03-09 00:44:50 +0000102 llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F);
Eli Friedmanb001de72011-10-06 23:00:33 +0000103 llvm::DIType CreateType(const AtomicType *Ty, llvm::DIFile F);
Devang Patel31f7d022011-01-17 22:23:07 +0000104 llvm::DIType CreateEnumType(const EnumDecl *ED);
Eric Christopher973bbb62011-12-16 23:40:18 +0000105 llvm::DIType getTypeOrNull(const QualType);
Eric Christopher9965dea2012-02-16 22:54:45 +0000106 llvm::DIType getCompletedTypeOrNull(const QualType);
Devang Patela6da1922010-01-28 00:28:01 +0000107 llvm::DIType getOrCreateMethodType(const CXXMethodDecl *Method,
Devang Patel17800552010-03-09 00:44:50 +0000108 llvm::DIFile F);
Devang Patel1c296522011-05-31 20:46:46 +0000109 llvm::DIType getOrCreateFunctionType(const Decl *D, QualType FnType,
110 llvm::DIFile F);
Devang Patel17800552010-03-09 00:44:50 +0000111 llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
Devang Patel170cef32010-12-09 00:33:05 +0000112 llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
Devang Patelc69e1cf2010-09-30 19:05:55 +0000113 llvm::DIType CreatePointeeType(QualType PointeeTy, llvm::DIFile F);
Anders Carlssona031b352009-11-06 19:19:55 +0000114 llvm::DIType CreatePointerLikeType(unsigned Tag,
115 const Type *Ty, QualType PointeeTy,
Devang Patel17800552010-03-09 00:44:50 +0000116 llvm::DIFile F);
Anders Carlssond6f9a0d2010-01-26 04:49:33 +0000117
Anders Carlsson4433f1c2010-01-26 05:19:50 +0000118 llvm::DISubprogram CreateCXXMemberFunction(const CXXMethodDecl *Method,
Devang Patel17800552010-03-09 00:44:50 +0000119 llvm::DIFile F,
Dan Gohman4cac5b42010-08-20 22:02:57 +0000120 llvm::DIType RecordTy);
Anders Carlssond6f9a0d2010-01-26 04:49:33 +0000121
Devang Patel4125fd22010-01-19 01:54:44 +0000122 void CollectCXXMemberFunctions(const CXXRecordDecl *Decl,
Devang Patel17800552010-03-09 00:44:50 +0000123 llvm::DIFile F,
Chris Lattner686775d2011-07-20 06:58:45 +0000124 SmallVectorImpl<llvm::Value *> &E,
Dan Gohman4cac5b42010-08-20 22:02:57 +0000125 llvm::DIType T);
Devang Patel2ed8f002010-08-27 17:47:47 +0000126
127 void CollectCXXFriends(const CXXRecordDecl *Decl,
128 llvm::DIFile F,
Chris Lattner686775d2011-07-20 06:58:45 +0000129 SmallVectorImpl<llvm::Value *> &EltTys,
Devang Patel2ed8f002010-08-27 17:47:47 +0000130 llvm::DIType RecordTy);
131
Devang Patela245c5b2010-01-25 23:32:18 +0000132 void CollectCXXBases(const CXXRecordDecl *Decl,
Devang Patel17800552010-03-09 00:44:50 +0000133 llvm::DIFile F,
Chris Lattner686775d2011-07-20 06:58:45 +0000134 SmallVectorImpl<llvm::Value *> &EltTys,
Dan Gohman4cac5b42010-08-20 22:02:57 +0000135 llvm::DIType RecordTy);
Devang Patel5ecb1df2011-04-05 22:54:11 +0000136
137 llvm::DIArray
138 CollectTemplateParams(const TemplateParameterList *TPList,
139 const TemplateArgumentList &TAList,
140 llvm::DIFile Unit);
141 llvm::DIArray
142 CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile Unit);
Devang Patel9c1714b2011-04-05 17:30:54 +0000143 llvm::DIArray
144 CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS,
145 llvm::DIFile F);
146
Chris Lattner686775d2011-07-20 06:58:45 +0000147 llvm::DIType createFieldType(StringRef name, QualType type,
Richard Smitha6b8b2c2011-10-10 18:28:20 +0000148 uint64_t sizeInBitsOverride, SourceLocation loc,
John McCall8178df32011-02-22 22:38:33 +0000149 AccessSpecifier AS, uint64_t offsetInBits,
Devang Patel1d323e02011-06-24 22:00:59 +0000150 llvm::DIFile tunit,
151 llvm::DIDescriptor scope);
Eric Christopher6faa5542012-01-26 01:57:13 +0000152 void CollectRecordStaticVars(const RecordDecl *, llvm::DIType);
Devang Patel17800552010-03-09 00:44:50 +0000153 void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F,
Chris Lattner686775d2011-07-20 06:58:45 +0000154 SmallVectorImpl<llvm::Value *> &E,
Devang Patel1d323e02011-06-24 22:00:59 +0000155 llvm::DIType RecordTy);
Devang Patel4ce3f202010-01-28 18:11:52 +0000156
Anders Carlsson046c2942010-04-17 20:15:18 +0000157 void CollectVTableInfo(const CXXRecordDecl *Decl,
Devang Patel17800552010-03-09 00:44:50 +0000158 llvm::DIFile F,
Chris Lattner686775d2011-07-20 06:58:45 +0000159 SmallVectorImpl<llvm::Value *> &EltTys);
Devang Patel4ce3f202010-01-28 18:11:52 +0000160
Eric Christopher73fb3502011-10-13 21:45:18 +0000161 // CreateLexicalBlock - Create a new lexical block node and push it on
162 // the stack.
163 void CreateLexicalBlock(SourceLocation Loc);
164
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000165public:
Anders Carlsson20f12a22009-12-06 18:00:51 +0000166 CGDebugInfo(CodeGenModule &CGM);
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000167 ~CGDebugInfo();
Eric Christopher7ff0c5d2012-02-18 00:50:17 +0000168
169 void finalize(void);
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000170
Daniel Dunbar66031a52008-10-17 16:15:48 +0000171 /// setLocation - Update the current source location. If \arg loc is
172 /// invalid it is ignored.
Chris Lattner9c85ba32008-11-10 06:08:34 +0000173 void setLocation(SourceLocation Loc);
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000174
Eric Christopher5321bc42011-09-29 00:00:41 +0000175 /// EmitLocation - Emit metadata to indicate a change in line/column
176 /// information in the source file.
Eric Christopher73fb3502011-10-13 21:45:18 +0000177 void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc);
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +0000178
179 /// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
Daniel Dunbar2284ac92008-10-18 18:22:23 +0000180 /// start of a new function.
Devang Patel9c6c3a02010-01-14 00:36:21 +0000181 void EmitFunctionStart(GlobalDecl GD, QualType FnType,
Daniel Dunbar45d196b2008-11-01 01:53:16 +0000182 llvm::Function *Fn, CGBuilderTy &Builder);
Mike Stump1eb44332009-09-09 15:08:12 +0000183
Devang Patel5a6fbcf2010-07-22 22:29:16 +0000184 /// EmitFunctionEnd - Constructs the debug code for exiting a function.
185 void EmitFunctionEnd(CGBuilderTy &Builder);
186
Eric Christopheraa2164c2011-09-29 00:00:45 +0000187 /// EmitLexicalBlockStart - Emit metadata to indicate the beginning of a
188 /// new lexical block and push the block onto the stack.
Eric Christopher73fb3502011-10-13 21:45:18 +0000189 void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc);
Mike Stump1eb44332009-09-09 15:08:12 +0000190
Eric Christopheraa2164c2011-09-29 00:00:45 +0000191 /// EmitLexicalBlockEnd - Emit metadata to indicate the end of a new lexical
192 /// block and pop the current block.
Eric Christopher73fb3502011-10-13 21:45:18 +0000193 void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc);
Sanjiv Guptacc9b1632008-05-30 10:30:31 +0000194
Chris Lattner9c85ba32008-11-10 06:08:34 +0000195 /// EmitDeclareOfAutoVariable - Emit call to llvm.dbg.declare for an automatic
196 /// variable declaration.
197 void EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
198 CGBuilderTy &Builder);
Sanjiv Gupta686226b2008-06-05 08:59:10 +0000199
Mike Stumpb1a6e682009-09-30 02:43:10 +0000200 /// EmitDeclareOfBlockDeclRefVariable - Emit call to llvm.dbg.declare for an
201 /// imported variable declaration in a block.
John McCall6b5a61b2011-02-07 10:33:21 +0000202 void EmitDeclareOfBlockDeclRefVariable(const VarDecl *variable,
203 llvm::Value *storage,
Mike Stumpb1a6e682009-09-30 02:43:10 +0000204 CGBuilderTy &Builder,
John McCall6b5a61b2011-02-07 10:33:21 +0000205 const CGBlockInfo &blockInfo);
Mike Stumpb1a6e682009-09-30 02:43:10 +0000206
Chris Lattner9c85ba32008-11-10 06:08:34 +0000207 /// EmitDeclareOfArgVariable - Emit call to llvm.dbg.declare for an argument
208 /// variable declaration.
209 void EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI,
Devang Patel093ac462011-03-03 20:13:15 +0000210 unsigned ArgNo, CGBuilderTy &Builder);
Mike Stump1eb44332009-09-09 15:08:12 +0000211
John McCall8178df32011-02-22 22:38:33 +0000212 /// EmitDeclareOfBlockLiteralArgVariable - Emit call to
213 /// llvm.dbg.declare for the block-literal argument to a block
214 /// invocation function.
215 void EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
216 llvm::Value *addr,
217 CGBuilderTy &Builder);
218
Sanjiv Gupta686226b2008-06-05 08:59:10 +0000219 /// EmitGlobalVariable - Emit information about a global variable.
Chris Lattner9c85ba32008-11-10 06:08:34 +0000220 void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
Devang Patel9ca36b62009-02-26 21:10:26 +0000221
222 /// EmitGlobalVariable - Emit information about an objective-c interface.
223 void EmitGlobalVariable(llvm::GlobalVariable *GV, ObjCInterfaceDecl *Decl);
Mike Stump1eb44332009-09-09 15:08:12 +0000224
Devang Patel25c2c8f2010-08-10 17:53:33 +0000225 /// EmitGlobalVariable - Emit global variable's debug info.
John McCall189d6ef2010-10-09 01:34:31 +0000226 void EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init);
Devang Patel8d308382010-08-10 07:24:25 +0000227
Devang Patelc69e1cf2010-09-30 19:05:55 +0000228 /// getOrCreateRecordType - Emit record type's standalone debug info.
229 llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
Eric Christopherbe6c6862012-04-11 05:56:05 +0000230
231 /// getOrCreateInterfaceType - Emit an objective c interface type standalone
232 /// debug info.
233 llvm::DIType getOrCreateInterfaceType(QualType Ty,
234 SourceLocation Loc);
235
Chris Lattner86cd8af2008-11-03 09:11:11 +0000236private:
Chris Lattner9c85ba32008-11-10 06:08:34 +0000237 /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
238 void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,
Devang Patel093ac462011-03-03 20:13:15 +0000239 unsigned ArgNo, CGBuilderTy &Builder);
Mike Stump1eb44332009-09-09 15:08:12 +0000240
Devang Patel809b9bb2010-02-10 18:49:08 +0000241 // EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
242 // See BuildByRefType.
243 llvm::DIType EmitTypeForVarWithBlocksAttr(const ValueDecl *VD,
244 uint64_t *OffSet);
245
Devang Patel33583052010-01-28 23:15:27 +0000246 /// getContextDescriptor - Get context info for the decl.
Devang Patel170cef32010-12-09 00:33:05 +0000247 llvm::DIDescriptor getContextDescriptor(const Decl *Decl);
Devang Patel979ec2e2009-10-06 00:35:31 +0000248
Eric Christopher5d613b52012-01-25 02:06:59 +0000249 /// createRecordFwdDecl - Create a forward decl for a RecordType in a given
250 /// context.
251 llvm::DIType createRecordFwdDecl(const RecordDecl *, llvm::DIDescriptor);
252
Eric Christophera70e2462012-01-25 02:06:52 +0000253 /// createContextChain - Create a set of decls for the context chain.
Eric Christopher4ddca8a2012-01-20 22:10:15 +0000254 llvm::DIDescriptor createContextChain(const Decl *Decl);
255
Devang Patelac4d13c2010-07-27 15:17:16 +0000256 /// getCurrentDirname - Return current directory name.
Chris Lattner686775d2011-07-20 06:58:45 +0000257 StringRef getCurrentDirname();
Devang Patelac4d13c2010-07-27 15:17:16 +0000258
Devang Patel17800552010-03-09 00:44:50 +0000259 /// CreateCompileUnit - Create new compile unit.
260 void CreateCompileUnit();
261
262 /// getOrCreateFile - Get the file debug info descriptor for the input
263 /// location.
264 llvm::DIFile getOrCreateFile(SourceLocation Loc);
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +0000265
Devang Patel532105f2010-10-28 22:03:20 +0000266 /// getOrCreateMainFile - Get the file info for main compile unit.
267 llvm::DIFile getOrCreateMainFile();
268
Sanjiv Gupta1c6a38b2008-05-25 05:15:42 +0000269 /// getOrCreateType - Get the type from the cache or create a new type if
270 /// necessary.
Devang Patel17800552010-03-09 00:44:50 +0000271 llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile F);
Daniel Dunbar03faac32009-09-19 19:27:14 +0000272
Eric Christopher9965dea2012-02-16 22:54:45 +0000273 /// getOrCreateLimitedType - Get the type from the cache or create a new
274 /// partial type if necessary.
275 llvm::DIType getOrCreateLimitedType(QualType Ty, llvm::DIFile F);
276
Daniel Dunbar03faac32009-09-19 19:27:14 +0000277 /// CreateTypeNode - Create type metadata for a source language type.
Devang Patel17800552010-03-09 00:44:50 +0000278 llvm::DIType CreateTypeNode(QualType Ty, llvm::DIFile F);
Devang Patel9c6c3a02010-01-14 00:36:21 +0000279
Eric Christopher9965dea2012-02-16 22:54:45 +0000280 /// CreateLimitedTypeNode - Create type metadata for a source language
281 /// type, but only partial types for records.
282 llvm::DIType CreateLimitedTypeNode(QualType Ty, llvm::DIFile F);
283
Benjamin Kramerd3651cc2010-04-24 20:26:20 +0000284 /// CreateMemberType - Create new member and increase Offset by FType's size.
Benjamin Kramer48c70f62010-04-24 20:19:58 +0000285 llvm::DIType CreateMemberType(llvm::DIFile Unit, QualType FType,
Chris Lattner686775d2011-07-20 06:58:45 +0000286 StringRef Name, uint64_t *Offset);
Benjamin Kramer48c70f62010-04-24 20:19:58 +0000287
Devang Patel120bf322011-04-23 00:08:01 +0000288 /// getFunctionDeclaration - Return debug info descriptor to describe method
289 /// declaration for the given method definition.
290 llvm::DISubprogram getFunctionDeclaration(const Decl *D);
291
Devang Patel9c6c3a02010-01-14 00:36:21 +0000292 /// getFunctionName - Get function name for the given FunctionDecl. If the
293 /// name is constructred on demand (e.g. C++ destructor) then the name
294 /// is stored on the side.
Chris Lattner686775d2011-07-20 06:58:45 +0000295 StringRef getFunctionName(const FunctionDecl *FD);
Devang Patelcebbedd2010-10-12 23:24:54 +0000296
David Chisnall52044a22010-09-02 18:01:51 +0000297 /// getObjCMethodName - Returns the unmangled name of an Objective-C method.
298 /// This is the display name for the debugging info.
Chris Lattner686775d2011-07-20 06:58:45 +0000299 StringRef getObjCMethodName(const ObjCMethodDecl *FD);
Devang Patel4ce3f202010-01-28 18:11:52 +0000300
Devang Patel1f15c192011-04-18 17:30:25 +0000301 /// getSelectorName - Return selector name. This is used for debugging
Devang Patel90c1eed2011-04-16 00:37:51 +0000302 /// info.
Chris Lattner686775d2011-07-20 06:58:45 +0000303 StringRef getSelectorName(Selector S);
Devang Patel90c1eed2011-04-16 00:37:51 +0000304
Devang Patel700a1cb2010-07-20 20:24:18 +0000305 /// getClassName - Get class name including template argument list.
Eric Christopher9caf4402012-02-08 01:53:14 +0000306 StringRef getClassName(const RecordDecl *RD);
Devang Patel700a1cb2010-07-20 20:24:18 +0000307
Anders Carlsson046c2942010-04-17 20:15:18 +0000308 /// getVTableName - Get vtable name for the given Class.
Chris Lattner686775d2011-07-20 06:58:45 +0000309 StringRef getVTableName(const CXXRecordDecl *Decl);
Devang Patel4ce3f202010-01-28 18:11:52 +0000310
Devang Patel8ab870d2010-05-12 23:46:38 +0000311 /// getLineNumber - Get line number for the location. If location is invalid
312 /// then use current location.
313 unsigned getLineNumber(SourceLocation Loc);
314
315 /// getColumnNumber - Get column number for the location. If location is
316 /// invalid then use current location.
317 unsigned getColumnNumber(SourceLocation Loc);
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000318};
319} // namespace CodeGen
320} // namespace clang
321
Devang Patelbbd9fa42009-10-06 18:36:08 +0000322
Sanjiv Guptae8b9f5b2008-05-08 08:54:20 +0000323#endif