~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to clang/lib/CodeGen/CGDebugInfo.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include "clang/AST/Expr.h"
19
19
#include "clang/AST/Type.h"
20
20
#include "clang/Basic/SourceLocation.h"
 
21
#include "clang/Frontend/CodeGenOptions.h"
21
22
#include "llvm/ADT/DenseMap.h"
22
23
#include "llvm/DIBuilder.h"
23
24
#include "llvm/DebugInfo.h"
35
36
  class ObjCIvarDecl;
36
37
  class ClassTemplateSpecializationDecl;
37
38
  class GlobalDecl;
 
39
  class UsingDecl;
38
40
 
39
41
namespace CodeGen {
40
42
  class CodeGenModule;
46
48
/// the backend.
47
49
class CGDebugInfo {
48
50
  CodeGenModule &CGM;
 
51
  const CodeGenOptions::DebugInfoKind DebugKind;
49
52
  llvm::DIBuilder DBuilder;
50
53
  llvm::DICompileUnit TheCU;
51
54
  SourceLocation CurLoc, PrevLoc;
57
60
  llvm::DIType OCLImage2dDITy, OCLImage2dArrayDITy;
58
61
  llvm::DIType OCLImage3dDITy;
59
62
  llvm::DIType OCLEventDITy;
60
 
  
 
63
 
61
64
  /// TypeCache - Cache of previously constructed Types.
62
65
  llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
63
66
 
94
97
 
95
98
  llvm::DenseMap<const char *, llvm::WeakVH> DIFileCache;
96
99
  llvm::DenseMap<const FunctionDecl *, llvm::WeakVH> SPCache;
 
100
  /// \brief Cache declarations relevant to DW_TAG_imported_declarations (C++
 
101
  /// using declarations) that aren't covered by other more specific caches.
 
102
  llvm::DenseMap<const Decl *, llvm::WeakVH> DeclCache;
97
103
  llvm::DenseMap<const NamespaceDecl *, llvm::WeakVH> NameSpaceCache;
 
104
  llvm::DenseMap<const NamespaceAliasDecl *, llvm::WeakVH> NamespaceAliasCache;
98
105
  llvm::DenseMap<const Decl *, llvm::WeakVH> StaticDataMemberCache;
99
106
 
100
107
  /// Helper functions for getOrCreateType.
122
129
  llvm::DIType CreateSelfType(const QualType &QualTy, llvm::DIType Ty);
123
130
  llvm::DIType getTypeOrNull(const QualType);
124
131
  llvm::DIType getCompletedTypeOrNull(const QualType);
125
 
  llvm::DIType getOrCreateMethodType(const CXXMethodDecl *Method,
126
 
                                     llvm::DIFile F);
127
 
  llvm::DIType getOrCreateInstanceMethodType(
 
132
  llvm::DICompositeType getOrCreateMethodType(const CXXMethodDecl *Method,
 
133
                                              llvm::DIFile F);
 
134
  llvm::DICompositeType getOrCreateInstanceMethodType(
128
135
      QualType ThisPtr, const FunctionProtoType *Func, llvm::DIFile Unit);
129
 
  llvm::DIType getOrCreateFunctionType(const Decl *D, QualType FnType,
130
 
                                       llvm::DIFile F);
 
136
  llvm::DICompositeType getOrCreateFunctionType(const Decl *D, QualType FnType,
 
137
                                                llvm::DIFile F);
131
138
  llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
132
139
  llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
133
 
  llvm::DIType CreatePointeeType(QualType PointeeTy, llvm::DIFile F);
 
140
  llvm::DIType getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile F);
134
141
  llvm::DIType CreatePointerLikeType(unsigned Tag,
135
142
                                     const Type *Ty, QualType PointeeTy,
136
143
                                     llvm::DIFile F);
141
148
  llvm::DISubprogram CreateCXXMemberFunction(const CXXMethodDecl *Method,
142
149
                                             llvm::DIFile F,
143
150
                                             llvm::DIType RecordTy);
144
 
  
 
151
 
145
152
  void CollectCXXMemberFunctions(const CXXRecordDecl *Decl,
146
153
                                 llvm::DIFile F,
147
154
                                 SmallVectorImpl<llvm::Value *> &E,
156
163
                       llvm::DIFile F,
157
164
                       SmallVectorImpl<llvm::Value *> &EltTys,
158
165
                       llvm::DIType RecordTy);
159
 
  
 
166
 
160
167
  llvm::DIArray
161
168
  CollectTemplateParams(const TemplateParameterList *TPList,
162
169
                        const TemplateArgumentList &TAList,
163
170
                        llvm::DIFile Unit);
164
171
  llvm::DIArray
165
172
  CollectFunctionTemplateParams(const FunctionDecl *FD, llvm::DIFile Unit);
166
 
  llvm::DIArray 
 
173
  llvm::DIArray
167
174
  CollectCXXTemplateParams(const ClassTemplateSpecializationDecl *TS,
168
175
                           llvm::DIFile F);
169
176
 
195
202
  // CreateLexicalBlock - Create a new lexical block node and push it on
196
203
  // the stack.
197
204
  void CreateLexicalBlock(SourceLocation Loc);
198
 
  
 
205
 
199
206
public:
200
207
  CGDebugInfo(CodeGenModule &CGM);
201
208
  ~CGDebugInfo();
206
213
  /// invalid it is ignored.
207
214
  void setLocation(SourceLocation Loc);
208
215
 
 
216
  /// getLocation - Return the current source location.
 
217
  SourceLocation getLocation() const { return CurLoc; }
 
218
 
209
219
  /// EmitLocation - Emit metadata to indicate a change in line/column
210
220
  /// information in the source file.
211
221
  /// \param ForceColumnInfo  Assume DebugColumnInfo option is true.
262
272
  /// EmitGlobalVariable - Emit global variable's debug info.
263
273
  void EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init);
264
274
 
265
 
  /// getOrCreateRecordType - Emit record type's standalone debug info. 
 
275
  /// \brief - Emit C++ using directive.
 
276
  void EmitUsingDirective(const UsingDirectiveDecl &UD);
 
277
 
 
278
  /// \brief - Emit C++ using declaration.
 
279
  void EmitUsingDecl(const UsingDecl &UD);
 
280
 
 
281
  /// \brief - Emit C++ namespace alias.
 
282
  llvm::DIImportedEntity EmitNamespaceAlias(const NamespaceAliasDecl &NA);
 
283
 
 
284
  /// getOrCreateRecordType - Emit record type's standalone debug info.
266
285
  llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
267
286
 
268
287
  /// getOrCreateInterfaceType - Emit an objective c interface type standalone
269
288
  /// debug info.
270
289
  llvm::DIType getOrCreateInterfaceType(QualType Ty,
271
 
                                        SourceLocation Loc);
 
290
                                        SourceLocation Loc);
272
291
 
273
292
private:
274
293
  /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
275
294
  void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI,
276
295
                   unsigned ArgNo, CGBuilderTy &Builder);
277
296
 
278
 
  // EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.  
 
297
  // EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
279
298
  // See BuildByRefType.
280
299
  llvm::DIType EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
281
300
                                            uint64_t *OffSet);
283
302
  /// getContextDescriptor - Get context info for the decl.
284
303
  llvm::DIScope getContextDescriptor(const Decl *Decl);
285
304
 
 
305
  llvm::DIScope getCurrentContextDescriptor(const Decl *Decl);
 
306
 
286
307
  /// createRecordFwdDecl - Create a forward decl for a RecordType in a given
287
308
  /// context.
288
309
  llvm::DIType createRecordFwdDecl(const RecordDecl *, llvm::DIDescriptor);
289
 
  
 
310
 
290
311
  /// createContextChain - Create a set of decls for the context chain.
291
312
  llvm::DIDescriptor createContextChain(const Decl *Decl);
292
313
 
296
317
  /// CreateCompileUnit - Create new compile unit.
297
318
  void CreateCompileUnit();
298
319
 
299
 
  /// getOrCreateFile - Get the file debug info descriptor for the input 
 
320
  /// getOrCreateFile - Get the file debug info descriptor for the input
300
321
  /// location.
301
322
  llvm::DIFile getOrCreateFile(SourceLocation Loc);
302
323
 
326
347
  llvm::DIType CreateMemberType(llvm::DIFile Unit, QualType FType,
327
348
                                StringRef Name, uint64_t *Offset);
328
349
 
 
350
  /// \brief Retrieve the DIDescriptor, if any, for the canonical form of this
 
351
  /// declaration.
 
352
  llvm::DIDescriptor getDeclarationOrDefinition(const Decl *D);
 
353
 
329
354
  /// getFunctionDeclaration - Return debug info descriptor to describe method
330
355
  /// declaration for the given method definition.
331
356
  llvm::DISubprogram getFunctionDeclaration(const Decl *D);
341
366
  StringRef getFunctionName(const FunctionDecl *FD);
342
367
 
343
368
  /// getObjCMethodName - Returns the unmangled name of an Objective-C method.
344
 
  /// This is the display name for the debugging info.  
 
369
  /// This is the display name for the debugging info.
345
370
  StringRef getObjCMethodName(const ObjCMethodDecl *FD);
346
371
 
347
372
  /// getSelectorName - Return selector name. This is used for debugging
358
383
  /// then use current location.
359
384
  unsigned getLineNumber(SourceLocation Loc);
360
385
 
361
 
  /// getColumnNumber - Get column number for the location. If location is 
 
386
  /// getColumnNumber - Get column number for the location. If location is
362
387
  /// invalid then use current location.
363
388
  /// \param Force  Assume DebugColumnInfo option is true.
364
389
  unsigned getColumnNumber(SourceLocation Loc, bool Force=false);