blob: 99f29e8323e6e067494e54838b76d70d7e858ada [file] [log] [blame]
Daniel Dunbara290ded2008-10-31 03:54:29 +00001//===--- CGDebugInfo.h - DebugInfo for LLVM CodeGen -------------*- C++ -*-===//
Sanjiv Gupta15cb6692008-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 Stump11289f42009-09-09 15:08:12 +000010// This is the source level debug info generator for llvm translation.
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_CODEGEN_CGDEBUGINFO_H
15#define CLANG_CODEGEN_CGDEBUGINFO_H
16
Sanjiv Gupta98070572008-05-25 05:15:42 +000017#include "clang/AST/Type.h"
Mike Stump2e722b92009-09-30 02:43:10 +000018#include "clang/AST/Expr.h"
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000019#include "clang/Basic/SourceLocation.h"
Bill Wendling4adcf782012-06-28 00:30:19 +000020#include "llvm/DebugInfo.h"
Bill Wendling128f8bd2012-06-29 08:32:29 +000021#include "llvm/DIBuilder.h"
Chris Lattneraffb3732008-11-10 06:08:34 +000022#include "llvm/ADT/DenseMap.h"
Daniel Dunbar1cbaae52009-09-19 19:27:24 +000023#include "llvm/Support/ValueHandle.h"
Devang Patel934661e2010-01-14 00:36:21 +000024#include "llvm/Support/Allocator.h"
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000025
Daniel Dunbarcb463852008-11-01 01:53:16 +000026#include "CGBuilder.h"
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000027
Daniel Dunbar1cbaae52009-09-19 19:27:24 +000028namespace llvm {
29 class MDNode;
30}
31
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000032namespace clang {
Benjamin Kramer1ea8e092012-07-04 17:04:04 +000033 class CXXMethodDecl;
Sanjiv Gupta18de6242008-05-30 10:30:31 +000034 class VarDecl;
Devang Patelf4c205b2009-02-26 21:10:26 +000035 class ObjCInterfaceDecl;
Devang Patel7522abd2011-04-05 17:30:54 +000036 class ClassTemplateSpecializationDecl;
Peter Collingbourneee781d52011-06-14 04:02:39 +000037 class GlobalDecl;
Daniel Dunbarcb463852008-11-01 01:53:16 +000038
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000039namespace CodeGen {
40 class CodeGenModule;
Mike Stump2e722b92009-09-30 02:43:10 +000041 class CodeGenFunction;
John McCall351762c2011-02-07 10:33:21 +000042 class CGBlockInfo;
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000043
Mike Stump11289f42009-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 Gupta98070572008-05-25 05:15:42 +000046/// the backend.
Sanjiv Gupta15cb6692008-05-08 08:54:20 +000047class CGDebugInfo {
Anders Carlsson3efc6e62009-12-06 18:00:51 +000048 CodeGenModule &CGM;
Devang Patel00afcbe2010-12-08 22:42:58 +000049 llvm::DIBuilder DBuilder;
Devang Patel408dcf62010-03-09 00:44:50 +000050 llvm::DICompileUnit TheCU;
Chris Lattneraffb3732008-11-10 06:08:34 +000051 SourceLocation CurLoc, PrevLoc;
Devang Patel84033fb2010-01-28 18:11:52 +000052 llvm::DIType VTablePtrType;
Eric Christopher4a903df2012-08-20 23:32:17 +000053 llvm::DIType ClassTy;
54 llvm::DIType ObjTy;
55 llvm::DIType SelTy;
Devang Patel408dcf62010-03-09 00:44:50 +000056
Sanjiv Gupta98070572008-05-25 05:15:42 +000057 /// TypeCache - Cache of previously constructed Types.
Ted Kremenek23c29f02010-03-29 18:29:57 +000058 llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
Mike Stump11289f42009-09-09 15:08:12 +000059
Eric Christopher4c006e52012-02-16 22:54:45 +000060 /// CompleteTypeCache - Cache of previously constructed complete RecordTypes.
61 llvm::DenseMap<void *, llvm::WeakVH> CompletedTypeCache;
62
Eric Christopher1c3785a2012-02-18 00:50:17 +000063 /// ReplaceMap - Cache of forward declared types to RAUW at the end of
64 /// compilation.
65 std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap;
66
Mike Stump31f099c2009-05-14 02:03:51 +000067 bool BlockLiteralGenericSet;
68 llvm::DIType BlockLiteralGeneric;
69
Eric Christopher2f45aaa2011-09-29 00:00:45 +000070 // LexicalBlockStack - Keep track of our current nested lexical block.
71 std::vector<llvm::TrackingVH<llvm::MDNode> > LexicalBlockStack;
Devang Patel92e25412010-01-29 18:11:03 +000072 llvm::DenseMap<const Decl *, llvm::WeakVH> RegionMap;
Eric Christopher2f45aaa2011-09-29 00:00:45 +000073 // FnBeginRegionCount - Keep track of LexicalBlockStack counter at the
74 // beginning of a function. This is used to pop unbalanced regions at
75 // the end of a function.
Devang Patel0884a602010-07-22 22:29:16 +000076 std::vector<unsigned> FnBeginRegionCount;
77
Devang Patel0d61eeb2010-01-28 18:21:00 +000078 /// DebugInfoNames - This is a storage for names that are
Devang Patel934661e2010-01-14 00:36:21 +000079 /// constructed on demand. For example, C++ destructors, C++ operators etc..
Devang Patel0d61eeb2010-01-28 18:21:00 +000080 llvm::BumpPtrAllocator DebugInfoNames;
Chris Lattner01cf8db2011-07-20 06:58:45 +000081 StringRef CWDName;
Devang Patel934661e2010-01-14 00:36:21 +000082
Ted Kremenekdbb8cd12010-03-30 00:27:51 +000083 llvm::DenseMap<const char *, llvm::WeakVH> DIFileCache;
Devang Patel7a12ad02010-01-19 01:54:44 +000084 llvm::DenseMap<const FunctionDecl *, llvm::WeakVH> SPCache;
Devang Patel973f2eb2010-02-01 19:16:32 +000085 llvm::DenseMap<const NamespaceDecl *, llvm::WeakVH> NameSpaceCache;
Devang Patel7a12ad02010-01-19 01:54:44 +000086
Sanjiv Gupta98070572008-05-25 05:15:42 +000087 /// Helper functions for getOrCreateType.
Devang Patel86f30f52010-11-01 16:52:40 +000088 llvm::DIType CreateType(const BuiltinType *Ty);
Devang Patel4591f772010-12-09 00:25:29 +000089 llvm::DIType CreateType(const ComplexType *Ty);
Devang Patel408dcf62010-03-09 00:44:50 +000090 llvm::DIType CreateQualifiedType(QualType Ty, llvm::DIFile F);
91 llvm::DIType CreateType(const TypedefType *Ty, llvm::DIFile F);
Mike Stump11289f42009-09-09 15:08:12 +000092 llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
Devang Patel408dcf62010-03-09 00:44:50 +000093 llvm::DIFile F);
94 llvm::DIType CreateType(const PointerType *Ty, llvm::DIFile F);
95 llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DIFile F);
96 llvm::DIType CreateType(const FunctionType *Ty, llvm::DIFile F);
Devang Patel283e89d2011-01-17 22:23:07 +000097 llvm::DIType CreateType(const RecordType *Ty);
Eric Christopher4c006e52012-02-16 22:54:45 +000098 llvm::DIType CreateLimitedType(const RecordType *Ty);
Devang Patel408dcf62010-03-09 00:44:50 +000099 llvm::DIType CreateType(const ObjCInterfaceType *Ty, llvm::DIFile F);
John McCall8b07ec22010-05-15 11:32:37 +0000100 llvm::DIType CreateType(const ObjCObjectType *Ty, llvm::DIFile F);
Devang Patel408dcf62010-03-09 00:44:50 +0000101 llvm::DIType CreateType(const VectorType *Ty, llvm::DIFile F);
102 llvm::DIType CreateType(const ArrayType *Ty, llvm::DIFile F);
103 llvm::DIType CreateType(const LValueReferenceType *Ty, llvm::DIFile F);
Douglas Gregorb8c7fe92011-01-22 01:58:15 +0000104 llvm::DIType CreateType(const RValueReferenceType *Ty, llvm::DIFile Unit);
Devang Patel408dcf62010-03-09 00:44:50 +0000105 llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F);
Eli Friedman0dfb8892011-10-06 23:00:33 +0000106 llvm::DIType CreateType(const AtomicType *Ty, llvm::DIFile F);
Devang Patel283e89d2011-01-17 22:23:07 +0000107 llvm::DIType CreateEnumType(const EnumDecl *ED);
Eric Christophercd888132011-12-16 23:40:18 +0000108 llvm::DIType getTypeOrNull(const QualType);
Eric Christopher4c006e52012-02-16 22:54:45 +0000109 llvm::DIType getCompletedTypeOrNull(const QualType);
Devang Patel3d4e6d92010-01-28 00:28:01 +0000110 llvm::DIType getOrCreateMethodType(const CXXMethodDecl *Method,
Devang Patel408dcf62010-03-09 00:44:50 +0000111 llvm::DIFile F);
Devang Patel2780e452011-05-31 20:46:46 +0000112 llvm::DIType getOrCreateFunctionType(const Decl *D, QualType FnType,
113 llvm::DIFile F);
Devang Patel408dcf62010-03-09 00:44:50 +0000114 llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
Devang Patel8c445292010-12-09 00:33:05 +0000115 llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
Devang Patel91bbb552010-09-30 19:05:55 +0000116 llvm::DIType CreatePointeeType(QualType PointeeTy, llvm::DIFile F);
Anders Carlsson443f6772009-11-06 19:19:55 +0000117 llvm::DIType CreatePointerLikeType(unsigned Tag,
118 const Type *Ty, QualType PointeeTy,
Devang Patel408dcf62010-03-09 00:44:50 +0000119 llvm::DIFile F);
Anders Carlssonb85f0ab2010-01-26 04:49:33 +0000120
Anders Carlsson17ed0492010-01-26 05:19:50 +0000121 llvm::DISubprogram CreateCXXMemberFunction(const CXXMethodDecl *Method,
Devang Patel408dcf62010-03-09 00:44:50 +0000122 llvm::DIFile F,
Dan Gohman196f7102010-08-20 22:02:57 +0000123 llvm::DIType RecordTy);
Anders Carlssonb85f0ab2010-01-26 04:49:33 +0000124
Devang Patel7a12ad02010-01-19 01:54:44 +0000125 void CollectCXXMemberFunctions(const CXXRecordDecl *Decl,
Devang Patel408dcf62010-03-09 00:44:50 +0000126 llvm::DIFile F,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000127 SmallVectorImpl<llvm::Value *> &E,
Dan Gohman196f7102010-08-20 22:02:57 +0000128 llvm::DIType T);
Devang Patel96b7f552010-08-27 17:47:47 +0000129
130 void CollectCXXFriends(const CXXRecordDecl *Decl,
131 llvm::DIFile F,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000132 SmallVectorImpl<llvm::Value *> &EltTys,
Devang Patel96b7f552010-08-27 17:47:47 +0000133 llvm::DIType RecordTy);
134
Devang Patelc54353d2010-01-25 23:32:18 +0000135 void CollectCXXBases(const CXXRecordDecl *Decl,
Devang Patel408dcf62010-03-09 00:44:50 +0000136 llvm::DIFile F,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000137 SmallVectorImpl<llvm::Value *> &EltTys,
Dan Gohman196f7102010-08-20 22:02:57 +0000138 llvm::DIType RecordTy);
Devang Patelb87c4282011-04-05 22:54:11 +0000139
140 llvm::DIArray
141 CollectTemplateParams(const TemplateParameterList *TPList,
142 const TemplateArgumentList &TAList,
143 llvm::DIFile Unit);
144 llvm::DIArray
145 CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile Unit);
Devang Patel7522abd2011-04-05 17:30:54 +0000146 llvm::DIArray
147 CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS,
148 llvm::DIFile F);
149
Chris Lattner01cf8db2011-07-20 06:58:45 +0000150 llvm::DIType createFieldType(StringRef name, QualType type,
Richard Smithcaf33902011-10-10 18:28:20 +0000151 uint64_t sizeInBitsOverride, SourceLocation loc,
John McCall147d0212011-02-22 22:38:33 +0000152 AccessSpecifier AS, uint64_t offsetInBits,
Devang Patel15013e72011-06-24 22:00:59 +0000153 llvm::DIFile tunit,
154 llvm::DIDescriptor scope);
Eric Christophera15e6352012-01-26 01:57:13 +0000155 void CollectRecordStaticVars(const RecordDecl *, llvm::DIType);
Devang Patel408dcf62010-03-09 00:44:50 +0000156 void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile F,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000157 SmallVectorImpl<llvm::Value *> &E,
Devang Patel15013e72011-06-24 22:00:59 +0000158 llvm::DIType RecordTy);
Devang Patel84033fb2010-01-28 18:11:52 +0000159
Anders Carlsson11e51402010-04-17 20:15:18 +0000160 void CollectVTableInfo(const CXXRecordDecl *Decl,
Devang Patel408dcf62010-03-09 00:44:50 +0000161 llvm::DIFile F,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000162 SmallVectorImpl<llvm::Value *> &EltTys);
Devang Patel84033fb2010-01-28 18:11:52 +0000163
Eric Christopher7cdf9482011-10-13 21:45:18 +0000164 // CreateLexicalBlock - Create a new lexical block node and push it on
165 // the stack.
166 void CreateLexicalBlock(SourceLocation Loc);
167
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000168public:
Anders Carlsson3efc6e62009-12-06 18:00:51 +0000169 CGDebugInfo(CodeGenModule &CGM);
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000170 ~CGDebugInfo();
Eric Christopher1c3785a2012-02-18 00:50:17 +0000171
Dmitri Gribenkob2aa9232012-11-15 14:28:07 +0000172 void finalize();
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000173
Daniel Dunbarb9fd9022008-10-17 16:15:48 +0000174 /// setLocation - Update the current source location. If \arg loc is
175 /// invalid it is ignored.
Chris Lattneraffb3732008-11-10 06:08:34 +0000176 void setLocation(SourceLocation Loc);
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000177
Eric Christopherbfa4dc52011-09-29 00:00:41 +0000178 /// EmitLocation - Emit metadata to indicate a change in line/column
179 /// information in the source file.
Eric Christopher7cdf9482011-10-13 21:45:18 +0000180 void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc);
Sanjiv Gupta98070572008-05-25 05:15:42 +0000181
182 /// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
Daniel Dunbar354d2782008-10-18 18:22:23 +0000183 /// start of a new function.
Devang Patel934661e2010-01-14 00:36:21 +0000184 void EmitFunctionStart(GlobalDecl GD, QualType FnType,
Daniel Dunbarcb463852008-11-01 01:53:16 +0000185 llvm::Function *Fn, CGBuilderTy &Builder);
Mike Stump11289f42009-09-09 15:08:12 +0000186
Devang Patel0884a602010-07-22 22:29:16 +0000187 /// EmitFunctionEnd - Constructs the debug code for exiting a function.
188 void EmitFunctionEnd(CGBuilderTy &Builder);
189
Eric Christopher2f45aaa2011-09-29 00:00:45 +0000190 /// EmitLexicalBlockStart - Emit metadata to indicate the beginning of a
191 /// new lexical block and push the block onto the stack.
Eric Christopher7cdf9482011-10-13 21:45:18 +0000192 void EmitLexicalBlockStart(CGBuilderTy &Builder, SourceLocation Loc);
Mike Stump11289f42009-09-09 15:08:12 +0000193
Eric Christopher2f45aaa2011-09-29 00:00:45 +0000194 /// EmitLexicalBlockEnd - Emit metadata to indicate the end of a new lexical
195 /// block and pop the current block.
Eric Christopher7cdf9482011-10-13 21:45:18 +0000196 void EmitLexicalBlockEnd(CGBuilderTy &Builder, SourceLocation Loc);
Sanjiv Gupta18de6242008-05-30 10:30:31 +0000197
Chris Lattneraffb3732008-11-10 06:08:34 +0000198 /// EmitDeclareOfAutoVariable - Emit call to llvm.dbg.declare for an automatic
199 /// variable declaration.
200 void EmitDeclareOfAutoVariable(const VarDecl *Decl, llvm::Value *AI,
201 CGBuilderTy &Builder);
Sanjiv Gupta158143a2008-06-05 08:59:10 +0000202
Mike Stump2e722b92009-09-30 02:43:10 +0000203 /// EmitDeclareOfBlockDeclRefVariable - Emit call to llvm.dbg.declare for an
204 /// imported variable declaration in a block.
John McCall351762c2011-02-07 10:33:21 +0000205 void EmitDeclareOfBlockDeclRefVariable(const VarDecl *variable,
206 llvm::Value *storage,
Mike Stump2e722b92009-09-30 02:43:10 +0000207 CGBuilderTy &Builder,
John McCall351762c2011-02-07 10:33:21 +0000208 const CGBlockInfo &blockInfo);
Mike Stump2e722b92009-09-30 02:43:10 +0000209
Chris Lattneraffb3732008-11-10 06:08:34 +0000210 /// EmitDeclareOfArgVariable - Emit call to llvm.dbg.declare for an argument
211 /// variable declaration.
212 void EmitDeclareOfArgVariable(const VarDecl *Decl, llvm::Value *AI,
Devang Patel68a15252011-03-03 20:13:15 +0000213 unsigned ArgNo, CGBuilderTy &Builder);
Mike Stump11289f42009-09-09 15:08:12 +0000214
John McCall147d0212011-02-22 22:38:33 +0000215 /// EmitDeclareOfBlockLiteralArgVariable - Emit call to
216 /// llvm.dbg.declare for the block-literal argument to a block
217 /// invocation function.
218 void EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
219 llvm::Value *addr,
220 CGBuilderTy &Builder);
221
Sanjiv Gupta158143a2008-06-05 08:59:10 +0000222 /// EmitGlobalVariable - Emit information about a global variable.
Chris Lattneraffb3732008-11-10 06:08:34 +0000223 void EmitGlobalVariable(llvm::GlobalVariable *GV, const VarDecl *Decl);
Devang Patelf4c205b2009-02-26 21:10:26 +0000224
225 /// EmitGlobalVariable - Emit information about an objective-c interface.
226 void EmitGlobalVariable(llvm::GlobalVariable *GV, ObjCInterfaceDecl *Decl);
Mike Stump11289f42009-09-09 15:08:12 +0000227
Devang Pateldc866e12010-08-10 17:53:33 +0000228 /// EmitGlobalVariable - Emit global variable's debug info.
John McCalla2fabff2010-10-09 01:34:31 +0000229 void EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init);
Devang Patele03edfd2010-08-10 07:24:25 +0000230
Devang Patel91bbb552010-09-30 19:05:55 +0000231 /// getOrCreateRecordType - Emit record type's standalone debug info.
232 llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
Eric Christopher3d19de92012-04-11 05:56:05 +0000233
234 /// getOrCreateInterfaceType - Emit an objective c interface type standalone
235 /// debug info.
236 llvm::DIType getOrCreateInterfaceType(QualType Ty,
237 SourceLocation Loc);
238
Chris Lattner7d7fff22008-11-03 09:11:11 +0000239private:
Chris Lattneraffb3732008-11-10 06:08:34 +0000240 /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
241 void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,
Devang Patel68a15252011-03-03 20:13:15 +0000242 unsigned ArgNo, CGBuilderTy &Builder);
Mike Stump11289f42009-09-09 15:08:12 +0000243
Devang Patel535fdaf2010-02-10 18:49:08 +0000244 // EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
245 // See BuildByRefType.
Fariborz Jahanian998f0a32012-11-28 23:12:17 +0000246 llvm::DIType EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
Devang Patel535fdaf2010-02-10 18:49:08 +0000247 uint64_t *OffSet);
248
Devang Patel7bfc5962010-01-28 23:15:27 +0000249 /// getContextDescriptor - Get context info for the decl.
Devang Patel8c445292010-12-09 00:33:05 +0000250 llvm::DIDescriptor getContextDescriptor(const Decl *Decl);
Devang Patelfaf7e9a2009-10-06 00:35:31 +0000251
Eric Christopher000b14e2012-01-25 02:06:59 +0000252 /// createRecordFwdDecl - Create a forward decl for a RecordType in a given
253 /// context.
254 llvm::DIType createRecordFwdDecl(const RecordDecl *, llvm::DIDescriptor);
255
Eric Christopher980df5d2012-01-25 02:06:52 +0000256 /// createContextChain - Create a set of decls for the context chain.
Eric Christopher45c4d472012-01-20 22:10:15 +0000257 llvm::DIDescriptor createContextChain(const Decl *Decl);
258
Devang Patel6014edd2010-07-27 15:17:16 +0000259 /// getCurrentDirname - Return current directory name.
Chris Lattner01cf8db2011-07-20 06:58:45 +0000260 StringRef getCurrentDirname();
Devang Patel6014edd2010-07-27 15:17:16 +0000261
Devang Patel408dcf62010-03-09 00:44:50 +0000262 /// CreateCompileUnit - Create new compile unit.
263 void CreateCompileUnit();
264
265 /// getOrCreateFile - Get the file debug info descriptor for the input
266 /// location.
267 llvm::DIFile getOrCreateFile(SourceLocation Loc);
Sanjiv Gupta98070572008-05-25 05:15:42 +0000268
Devang Pateled23f182010-10-28 22:03:20 +0000269 /// getOrCreateMainFile - Get the file info for main compile unit.
270 llvm::DIFile getOrCreateMainFile();
271
Sanjiv Gupta98070572008-05-25 05:15:42 +0000272 /// getOrCreateType - Get the type from the cache or create a new type if
273 /// necessary.
Devang Patel408dcf62010-03-09 00:44:50 +0000274 llvm::DIType getOrCreateType(QualType Ty, llvm::DIFile F);
Daniel Dunbarde870bd2009-09-19 19:27:14 +0000275
Eric Christopher4c006e52012-02-16 22:54:45 +0000276 /// getOrCreateLimitedType - Get the type from the cache or create a new
277 /// partial type if necessary.
278 llvm::DIType getOrCreateLimitedType(QualType Ty, llvm::DIFile F);
279
Daniel Dunbarde870bd2009-09-19 19:27:14 +0000280 /// CreateTypeNode - Create type metadata for a source language type.
Devang Patel408dcf62010-03-09 00:44:50 +0000281 llvm::DIType CreateTypeNode(QualType Ty, llvm::DIFile F);
Devang Patel934661e2010-01-14 00:36:21 +0000282
Eric Christopher4c006e52012-02-16 22:54:45 +0000283 /// CreateLimitedTypeNode - Create type metadata for a source language
284 /// type, but only partial types for records.
285 llvm::DIType CreateLimitedTypeNode(QualType Ty, llvm::DIFile F);
286
Benjamin Kramer20f2d432010-04-24 20:26:20 +0000287 /// CreateMemberType - Create new member and increase Offset by FType's size.
Benjamin Kramerbbb5dea2010-04-24 20:19:58 +0000288 llvm::DIType CreateMemberType(llvm::DIFile Unit, QualType FType,
Chris Lattner01cf8db2011-07-20 06:58:45 +0000289 StringRef Name, uint64_t *Offset);
Benjamin Kramerbbb5dea2010-04-24 20:19:58 +0000290
Devang Patela6cb0642011-04-23 00:08:01 +0000291 /// getFunctionDeclaration - Return debug info descriptor to describe method
292 /// declaration for the given method definition.
293 llvm::DISubprogram getFunctionDeclaration(const Decl *D);
294
Devang Patel934661e2010-01-14 00:36:21 +0000295 /// getFunctionName - Get function name for the given FunctionDecl. If the
296 /// name is constructred on demand (e.g. C++ destructor) then the name
297 /// is stored on the side.
Chris Lattner01cf8db2011-07-20 06:58:45 +0000298 StringRef getFunctionName(const FunctionDecl *FD);
Devang Patel67f70aa2010-10-12 23:24:54 +0000299
David Chisnallcf607442010-09-02 18:01:51 +0000300 /// getObjCMethodName - Returns the unmangled name of an Objective-C method.
301 /// This is the display name for the debugging info.
Chris Lattner01cf8db2011-07-20 06:58:45 +0000302 StringRef getObjCMethodName(const ObjCMethodDecl *FD);
Devang Patel84033fb2010-01-28 18:11:52 +0000303
Devang Patel43cfa5d2011-04-18 17:30:25 +0000304 /// getSelectorName - Return selector name. This is used for debugging
Devang Patel7294d742011-04-16 00:37:51 +0000305 /// info.
Chris Lattner01cf8db2011-07-20 06:58:45 +0000306 StringRef getSelectorName(Selector S);
Devang Patel7294d742011-04-16 00:37:51 +0000307
Devang Patel6c018202010-07-20 20:24:18 +0000308 /// getClassName - Get class name including template argument list.
Eric Christopherb2db8e42012-02-08 01:53:14 +0000309 StringRef getClassName(const RecordDecl *RD);
Devang Patel6c018202010-07-20 20:24:18 +0000310
Anders Carlsson11e51402010-04-17 20:15:18 +0000311 /// getVTableName - Get vtable name for the given Class.
Chris Lattner01cf8db2011-07-20 06:58:45 +0000312 StringRef getVTableName(const CXXRecordDecl *Decl);
Devang Patel84033fb2010-01-28 18:11:52 +0000313
Devang Patelc5ffabc2010-05-12 23:46:38 +0000314 /// getLineNumber - Get line number for the location. If location is invalid
315 /// then use current location.
316 unsigned getLineNumber(SourceLocation Loc);
317
318 /// getColumnNumber - Get column number for the location. If location is
319 /// invalid then use current location.
320 unsigned getColumnNumber(SourceLocation Loc);
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000321};
322} // namespace CodeGen
323} // namespace clang
324
Devang Patel5d90d622009-10-06 18:36:08 +0000325
Sanjiv Gupta15cb6692008-05-08 08:54:20 +0000326#endif