LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DebugInfo.h
Go to the documentation of this file.
1 //===--- llvm/Analysis/DebugInfo.h - Debug Information Helpers --*- C++ -*-===//
2 //
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 //
10 // This file defines a bunch of datatypes that are useful for creating and
11 // walking debug info in LLVM IR form. They essentially provide wrappers around
12 // the information in the global variables that's needed when constructing the
13 // DWARF information.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_DEBUGINFO_H
18 #define LLVM_DEBUGINFO_H
19 
20 #include "llvm/Support/Casting.h"
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/SmallPtrSet.h"
23 #include "llvm/ADT/SmallVector.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/IR/Metadata.h"
26 #include "llvm/Support/Dwarf.h"
27 
28 namespace llvm {
29 class BasicBlock;
30 class Constant;
31 class Function;
32 class GlobalVariable;
33 class Module;
34 class Type;
35 class Value;
36 class DbgDeclareInst;
37 class DbgValueInst;
38 class Instruction;
39 class MDNode;
40 class MDString;
41 class NamedMDNode;
42 class LLVMContext;
43 class raw_ostream;
44 
45 class DIFile;
46 class DISubprogram;
47 class DILexicalBlock;
48 class DILexicalBlockFile;
49 class DIVariable;
50 class DIType;
51 class DIScope;
53 
54 /// Maps from type identifier to the actual MDNode.
56 
57 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
58 /// This should not be stored in a container, because the underlying MDNode
59 /// may change in certain situations.
60 class DIDescriptor {
61  // Befriends DIRef so DIRef can befriend the protected member
62  // function: getFieldAs<DIRef>.
63  template <typename T> friend class DIRef;
64 
65 public:
66  enum {
67  FlagPrivate = 1 << 0,
68  FlagProtected = 1 << 1,
69  FlagFwdDecl = 1 << 2,
70  FlagAppleBlock = 1 << 3,
72  FlagVirtual = 1 << 5,
73  FlagArtificial = 1 << 6,
74  FlagExplicit = 1 << 7,
75  FlagPrototyped = 1 << 8,
77  FlagObjectPointer = 1 << 10,
78  FlagVector = 1 << 11,
79  FlagStaticMember = 1 << 12,
81  };
82 
83 protected:
84  const MDNode *DbgNode;
85 
86  StringRef getStringField(unsigned Elt) const;
87  unsigned getUnsignedField(unsigned Elt) const {
88  return (unsigned)getUInt64Field(Elt);
89  }
90  uint64_t getUInt64Field(unsigned Elt) const;
91  int64_t getInt64Field(unsigned Elt) const;
92  DIDescriptor getDescriptorField(unsigned Elt) const;
93 
94  template <typename DescTy> DescTy getFieldAs(unsigned Elt) const {
95  return DescTy(getDescriptorField(Elt));
96  }
97 
98  GlobalVariable *getGlobalVariableField(unsigned Elt) const;
99  Constant *getConstantField(unsigned Elt) const;
100  Function *getFunctionField(unsigned Elt) const;
101  void replaceFunctionField(unsigned Elt, Function *F);
102 
103 public:
104  explicit DIDescriptor(const MDNode *N = 0) : DbgNode(N) {}
105 
106  bool Verify() const;
107 
108  operator MDNode *() const { return const_cast<MDNode *>(DbgNode); }
109  MDNode *operator->() const { return const_cast<MDNode *>(DbgNode); }
110 
111  // An explicit operator bool so that we can do testing of DI values
112  // easily.
113  // FIXME: This operator bool isn't actually protecting anything at the
114  // moment due to the conversion operator above making DIDescriptor nodes
115  // implicitly convertable to bool.
116  LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
117 
118  bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
119  bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
120 
121  uint16_t getTag() const {
122  return getUnsignedField(0) & ~LLVMDebugVersionMask;
123  }
124 
125  bool isDerivedType() const;
126  bool isCompositeType() const;
127  bool isBasicType() const;
128  bool isVariable() const;
129  bool isSubprogram() const;
130  bool isGlobalVariable() const;
131  bool isScope() const;
132  bool isFile() const;
133  bool isCompileUnit() const;
134  bool isNameSpace() const;
135  bool isLexicalBlockFile() const;
136  bool isLexicalBlock() const;
137  bool isSubrange() const;
138  bool isEnumerator() const;
139  bool isType() const;
140  bool isUnspecifiedParameter() const;
141  bool isTemplateTypeParameter() const;
142  bool isTemplateValueParameter() const;
143  bool isObjCProperty() const;
144  bool isImportedEntity() const;
145 
146  /// print - print descriptor.
147  void print(raw_ostream &OS) const;
148 
149  /// dump - print descriptor to dbgs() with a newline.
150  void dump() const;
151 };
152 
153 /// DISubrange - This is used to represent ranges, for array bounds.
154 class DISubrange : public DIDescriptor {
155  friend class DIDescriptor;
156  void printInternal(raw_ostream &OS) const;
157 
158 public:
159  explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
160 
161  int64_t getLo() const { return getInt64Field(1); }
162  int64_t getCount() const { return getInt64Field(2); }
163  bool Verify() const;
164 };
165 
166 /// DIArray - This descriptor holds an array of descriptors.
167 class DIArray : public DIDescriptor {
168 public:
169  explicit DIArray(const MDNode *N = 0) : DIDescriptor(N) {}
170 
171  unsigned getNumElements() const;
172  DIDescriptor getElement(unsigned Idx) const {
173  return getDescriptorField(Idx);
174  }
175 };
176 
177 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
178 /// FIXME: it seems strange that this doesn't have either a reference to the
179 /// type/precision or a file/line pair for location info.
180 class DIEnumerator : public DIDescriptor {
181  friend class DIDescriptor;
182  void printInternal(raw_ostream &OS) const;
183 
184 public:
185  explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
186 
187  StringRef getName() const { return getStringField(1); }
188  int64_t getEnumValue() const { return getInt64Field(2); }
189  bool Verify() const;
190 };
191 
192 template <typename T> class DIRef;
193 typedef DIRef<DIScope> DIScopeRef;
195 
196 /// DIScope - A base class for various scopes.
197 class DIScope : public DIDescriptor {
198 protected:
199  friend class DIDescriptor;
200  void printInternal(raw_ostream &OS) const;
201 
202 public:
203  explicit DIScope(const MDNode *N = 0) : DIDescriptor(N) {}
204 
205  /// Gets the parent scope for this scope node or returns a
206  /// default constructed scope.
207  DIScopeRef getContext() const;
208  /// If the scope node has a name, return that, else return an empty string.
209  StringRef getName() const;
210  StringRef getFilename() const;
211  StringRef getDirectory() const;
212 
213  /// Generate a reference to this DIScope. Uses the type identifier instead
214  /// of the actual MDNode if possible, to help type uniquing.
215  DIScopeRef getRef() const;
216 };
217 
218 /// Represents reference to a DIDescriptor, abstracts over direct and
219 /// identifier-based metadata references.
220 template <typename T> class DIRef {
221  template <typename DescTy>
222  friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
223  friend DIScopeRef DIScope::getContext() const;
224  friend DIScopeRef DIScope::getRef() const;
225 
226  /// Val can be either a MDNode or a MDString, in the latter,
227  /// MDString specifies the type identifier.
228  const Value *Val;
229  explicit DIRef(const Value *V);
230 
231 public:
232  T resolve(const DITypeIdentifierMap &Map) const;
233  StringRef getName() const;
234  operator Value *() const { return const_cast<Value *>(Val); }
235 };
236 
237 template <typename T>
239  if (!Val)
240  return T();
241 
242  if (const MDNode *MD = dyn_cast<MDNode>(Val))
243  return T(MD);
244 
245  const MDString *MS = cast<MDString>(Val);
246  // Find the corresponding MDNode.
248  assert(Iter != Map.end() && "Identifier not in the type map?");
249  assert(DIDescriptor(Iter->second).isType() &&
250  "MDNode in DITypeIdentifierMap should be a DIType.");
251  return T(Iter->second);
252 }
253 
254 template <typename T> StringRef DIRef<T>::getName() const {
255  if (!Val)
256  return StringRef();
257 
258  if (const MDNode *MD = dyn_cast<MDNode>(Val))
259  return T(MD).getName();
260 
261  const MDString *MS = cast<MDString>(Val);
262  return MS->getString();
263 }
264 
265 /// Specialize getFieldAs to handle fields that are references to DIScopes.
266 template <> DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const;
267 /// Specialize DIRef constructor for DIScopeRef.
268 template <> DIRef<DIScope>::DIRef(const Value *V);
269 
270 /// Specialize getFieldAs to handle fields that are references to DITypes.
271 template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const;
272 /// Specialize DIRef constructor for DITypeRef.
273 template <> DIRef<DIType>::DIRef(const Value *V);
274 
275 /// DIType - This is a wrapper for a type.
276 /// FIXME: Types should be factored much better so that CV qualifiers and
277 /// others do not require a huge and empty descriptor full of zeros.
278 class DIType : public DIScope {
279 protected:
280  friend class DIDescriptor;
281  void printInternal(raw_ostream &OS) const;
282 
283 public:
284  explicit DIType(const MDNode *N = 0) : DIScope(N) {}
285 
286  /// Verify - Verify that a type descriptor is well formed.
287  bool Verify() const;
288 
289  DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(2); }
290  StringRef getName() const { return getStringField(3); }
291  unsigned getLineNumber() const { return getUnsignedField(4); }
292  uint64_t getSizeInBits() const { return getUInt64Field(5); }
293  uint64_t getAlignInBits() const { return getUInt64Field(6); }
294  // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
295  // carry this is just plain insane.
296  uint64_t getOffsetInBits() const { return getUInt64Field(7); }
297  unsigned getFlags() const { return getUnsignedField(8); }
298  bool isPrivate() const { return (getFlags() & FlagPrivate) != 0; }
299  bool isProtected() const { return (getFlags() & FlagProtected) != 0; }
300  bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
301  // isAppleBlock - Return true if this is the Apple Blocks extension.
302  bool isAppleBlockExtension() const {
303  return (getFlags() & FlagAppleBlock) != 0;
304  }
305  bool isBlockByrefStruct() const {
306  return (getFlags() & FlagBlockByrefStruct) != 0;
307  }
308  bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; }
309  bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
310  bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; }
311  bool isObjcClassComplete() const {
312  return (getFlags() & FlagObjcClassComplete) != 0;
313  }
314  bool isVector() const { return (getFlags() & FlagVector) != 0; }
315  bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
316  bool isValid() const { return DbgNode && isType(); }
317 
318  /// replaceAllUsesWith - Replace all uses of debug info referenced by
319  /// this descriptor.
321  void replaceAllUsesWith(MDNode *D);
322 };
323 
324 /// DIBasicType - A basic type, like 'int' or 'float'.
325 class DIBasicType : public DIType {
326 public:
327  explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
328 
329  unsigned getEncoding() const { return getUnsignedField(9); }
330 
331  /// Verify - Verify that a basic type descriptor is well formed.
332  bool Verify() const;
333 };
334 
335 /// DIDerivedType - A simple derived type, like a const qualified type,
336 /// a typedef, a pointer or reference, et cetera. Or, a data member of
337 /// a class/struct/union.
338 class DIDerivedType : public DIType {
339  friend class DIDescriptor;
340  void printInternal(raw_ostream &OS) const;
341 
342 public:
343  explicit DIDerivedType(const MDNode *N = 0) : DIType(N) {}
344 
345  DITypeRef getTypeDerivedFrom() const { return getFieldAs<DITypeRef>(9); }
346 
347  /// getObjCProperty - Return property node, if this ivar is
348  /// associated with one.
349  MDNode *getObjCProperty() const;
350 
352  assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
353  return getFieldAs<DITypeRef>(10);
354  }
355 
357  assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
358  return getConstantField(10);
359  }
360 
361  /// Verify - Verify that a derived type descriptor is well formed.
362  bool Verify() const;
363 };
364 
365 /// DICompositeType - This descriptor holds a type that can refer to multiple
366 /// other types, like a function or struct.
367 /// DICompositeType is derived from DIDerivedType because some
368 /// composite types (such as enums) can be derived from basic types
369 // FIXME: Make this derive from DIType directly & just store the
370 // base type in a single DIType field.
372  friend class DIDescriptor;
373  void printInternal(raw_ostream &OS) const;
374 
375 public:
376  explicit DICompositeType(const MDNode *N = 0) : DIDerivedType(N) {}
377 
378  DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
379  void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
380  void addMember(DIDescriptor D);
381  unsigned getRunTimeLang() const { return getUnsignedField(11); }
382  DITypeRef getContainingType() const { return getFieldAs<DITypeRef>(12); }
383  void setContainingType(DICompositeType ContainingType);
384  DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
385  MDString *getIdentifier() const;
386 
387  /// Verify - Verify that a composite type descriptor is well formed.
388  bool Verify() const;
389 };
390 
391 /// DIFile - This is a wrapper for a file.
392 class DIFile : public DIScope {
393  friend class DIDescriptor;
394 
395 public:
396  explicit DIFile(const MDNode *N = 0) : DIScope(N) {}
397  MDNode *getFileNode() const;
398  bool Verify() const;
399 };
400 
401 /// DICompileUnit - A wrapper for a compile unit.
402 class DICompileUnit : public DIScope {
403  friend class DIDescriptor;
404  void printInternal(raw_ostream &OS) const;
405 
406 public:
407  explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
408 
409  unsigned getLanguage() const { return getUnsignedField(2); }
410  StringRef getProducer() const { return getStringField(3); }
411 
412  bool isOptimized() const { return getUnsignedField(4) != 0; }
413  StringRef getFlags() const { return getStringField(5); }
414  unsigned getRunTimeVersion() const { return getUnsignedField(6); }
415 
416  DIArray getEnumTypes() const;
417  DIArray getRetainedTypes() const;
418  DIArray getSubprograms() const;
419  DIArray getGlobalVariables() const;
421 
423 
424  /// Verify - Verify that a compile unit is well formed.
425  bool Verify() const;
426 };
427 
428 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
429 class DISubprogram : public DIScope {
430  friend class DIDescriptor;
431  void printInternal(raw_ostream &OS) const;
432 
433 public:
434  explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
435 
436  DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(2); }
437  StringRef getName() const { return getStringField(3); }
438  StringRef getDisplayName() const { return getStringField(4); }
439  StringRef getLinkageName() const { return getStringField(5); }
440  unsigned getLineNumber() const { return getUnsignedField(6); }
441  DICompositeType getType() const { return getFieldAs<DICompositeType>(7); }
442 
443  /// isLocalToUnit - Return true if this subprogram is local to the current
444  /// compile unit, like 'static' in C.
445  unsigned isLocalToUnit() const { return getUnsignedField(8); }
446  unsigned isDefinition() const { return getUnsignedField(9); }
447 
448  unsigned getVirtuality() const { return getUnsignedField(10); }
449  unsigned getVirtualIndex() const { return getUnsignedField(11); }
450 
451  DITypeRef getContainingType() const { return getFieldAs<DITypeRef>(12); }
452 
453  unsigned getFlags() const { return getUnsignedField(13); }
454 
455  unsigned isArtificial() const {
456  return (getUnsignedField(13) & FlagArtificial) != 0;
457  }
458  /// isPrivate - Return true if this subprogram has "private"
459  /// access specifier.
460  bool isPrivate() const { return (getUnsignedField(13) & FlagPrivate) != 0; }
461  /// isProtected - Return true if this subprogram has "protected"
462  /// access specifier.
463  bool isProtected() const {
464  return (getUnsignedField(13) & FlagProtected) != 0;
465  }
466  /// isExplicit - Return true if this subprogram is marked as explicit.
467  bool isExplicit() const { return (getUnsignedField(13) & FlagExplicit) != 0; }
468  /// isPrototyped - Return true if this subprogram is prototyped.
469  bool isPrototyped() const {
470  return (getUnsignedField(13) & FlagPrototyped) != 0;
471  }
472 
473  unsigned isOptimized() const;
474 
475  /// Verify - Verify that a subprogram descriptor is well formed.
476  bool Verify() const;
477 
478  /// describes - Return true if this subprogram provides debugging
479  /// information for the function F.
480  bool describes(const Function *F);
481 
482  Function *getFunction() const { return getFunctionField(15); }
484  DIArray getTemplateParams() const { return getFieldAs<DIArray>(16); }
486  return getFieldAs<DISubprogram>(17);
487  }
488  MDNode *getVariablesNodes() const;
489  DIArray getVariables() const;
490 
491  /// getScopeLineNumber - Get the beginning of the scope of the
492  /// function, not necessarily where the name of the program
493  /// starts.
494  unsigned getScopeLineNumber() const { return getUnsignedField(19); }
495 };
496 
497 /// DILexicalBlock - This is a wrapper for a lexical block.
498 class DILexicalBlock : public DIScope {
499 public:
500  explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
501  DIScope getContext() const { return getFieldAs<DIScope>(2); }
502  unsigned getLineNumber() const { return getUnsignedField(3); }
503  unsigned getColumnNumber() const { return getUnsignedField(4); }
504  bool Verify() const;
505 };
506 
507 /// DILexicalBlockFile - This is a wrapper for a lexical block with
508 /// a filename change.
509 class DILexicalBlockFile : public DIScope {
510 public:
511  explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
512  DIScope getContext() const {
513  if (getScope().isSubprogram())
514  return getScope();
515  return getScope().getContext();
516  }
517  unsigned getLineNumber() const { return getScope().getLineNumber(); }
518  unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
519  DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(2); }
520  bool Verify() const;
521 };
522 
523 /// DINameSpace - A wrapper for a C++ style name space.
524 class DINameSpace : public DIScope {
525  friend class DIDescriptor;
526  void printInternal(raw_ostream &OS) const;
527 
528 public:
529  explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
530  DIScope getContext() const { return getFieldAs<DIScope>(2); }
531  StringRef getName() const { return getStringField(3); }
532  unsigned getLineNumber() const { return getUnsignedField(4); }
533  bool Verify() const;
534 };
535 
536 /// DITemplateTypeParameter - This is a wrapper for template type parameter.
538 public:
539  explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
540 
541  DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
542  StringRef getName() const { return getStringField(2); }
543  DITypeRef getType() const { return getFieldAs<DITypeRef>(3); }
544  StringRef getFilename() const { return getFieldAs<DIFile>(4).getFilename(); }
546  return getFieldAs<DIFile>(4).getDirectory();
547  }
548  unsigned getLineNumber() const { return getUnsignedField(5); }
549  unsigned getColumnNumber() const { return getUnsignedField(6); }
550  bool Verify() const;
551 };
552 
553 /// DITemplateValueParameter - This is a wrapper for template value parameter.
555 public:
556  explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
557 
558  DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
559  StringRef getName() const { return getStringField(2); }
560  DITypeRef getType() const { return getFieldAs<DITypeRef>(3); }
561  Value *getValue() const;
562  StringRef getFilename() const { return getFieldAs<DIFile>(5).getFilename(); }
564  return getFieldAs<DIFile>(5).getDirectory();
565  }
566  unsigned getLineNumber() const { return getUnsignedField(6); }
567  unsigned getColumnNumber() const { return getUnsignedField(7); }
568  bool Verify() const;
569 };
570 
571 /// DIGlobalVariable - This is a wrapper for a global variable.
573  friend class DIDescriptor;
574  void printInternal(raw_ostream &OS) const;
575 
576 public:
577  explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
578 
579  DIScope getContext() const { return getFieldAs<DIScope>(2); }
580  StringRef getName() const { return getStringField(3); }
581  StringRef getDisplayName() const { return getStringField(4); }
582  StringRef getLinkageName() const { return getStringField(5); }
583  StringRef getFilename() const { return getFieldAs<DIFile>(6).getFilename(); }
585  return getFieldAs<DIFile>(6).getDirectory();
586  }
587 
588  unsigned getLineNumber() const { return getUnsignedField(7); }
589  DIType getType() const { return getFieldAs<DIType>(8); }
590  unsigned isLocalToUnit() const { return getUnsignedField(9); }
591  unsigned isDefinition() const { return getUnsignedField(10); }
592 
594  Constant *getConstant() const { return getConstantField(11); }
596  return getFieldAs<DIDerivedType>(12);
597  }
598 
599  /// Verify - Verify that a global variable descriptor is well formed.
600  bool Verify() const;
601 };
602 
603 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
604 /// global etc).
605 class DIVariable : public DIDescriptor {
606  friend class DIDescriptor;
607  void printInternal(raw_ostream &OS) const;
608 
609 public:
610  explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
611 
612  DIScope getContext() const { return getFieldAs<DIScope>(1); }
613  StringRef getName() const { return getStringField(2); }
614  DIFile getFile() const { return getFieldAs<DIFile>(3); }
615  unsigned getLineNumber() const { return (getUnsignedField(4) << 8) >> 8; }
616  unsigned getArgNumber() const {
617  unsigned L = getUnsignedField(4);
618  return L >> 24;
619  }
620  DIType getType() const { return getFieldAs<DIType>(5); }
621 
622  /// isArtificial - Return true if this variable is marked as "artificial".
623  bool isArtificial() const {
624  return (getUnsignedField(6) & FlagArtificial) != 0;
625  }
626 
627  bool isObjectPointer() const {
628  return (getUnsignedField(6) & FlagObjectPointer) != 0;
629  }
630 
631  /// \brief Return true if this variable is represented as a pointer.
632  bool isIndirect() const {
633  return (getUnsignedField(6) & FlagIndirectVariable) != 0;
634  }
635 
636  /// getInlinedAt - If this variable is inlined then return inline location.
637  MDNode *getInlinedAt() const;
638 
639  /// Verify - Verify that a variable descriptor is well formed.
640  bool Verify() const;
641 
642  /// HasComplexAddr - Return true if the variable has a complex address.
643  bool hasComplexAddress() const { return getNumAddrElements() > 0; }
644 
645  unsigned getNumAddrElements() const;
646 
647  uint64_t getAddrElement(unsigned Idx) const {
648  return getUInt64Field(Idx + 8);
649  }
650 
651  /// isBlockByrefVariable - Return true if the variable was declared as
652  /// a "__block" variable (Apple Blocks).
653  bool isBlockByrefVariable() const { return getType().isBlockByrefStruct(); }
654 
655  /// isInlinedFnArgument - Return true if this variable provides debugging
656  /// information for an inlined function arguments.
657  bool isInlinedFnArgument(const Function *CurFn);
658 
659  void printExtendedName(raw_ostream &OS) const;
660 };
661 
662 /// DILocation - This object holds location information. This object
663 /// is not associated with any DWARF tag.
664 class DILocation : public DIDescriptor {
665 public:
666  explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
667 
668  unsigned getLineNumber() const { return getUnsignedField(0); }
669  unsigned getColumnNumber() const { return getUnsignedField(1); }
670  DIScope getScope() const { return getFieldAs<DIScope>(2); }
671  DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
672  StringRef getFilename() const { return getScope().getFilename(); }
673  StringRef getDirectory() const { return getScope().getDirectory(); }
674  bool Verify() const;
675 };
676 
677 class DIObjCProperty : public DIDescriptor {
678  friend class DIDescriptor;
679  void printInternal(raw_ostream &OS) const;
680 
681 public:
682  explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
683 
685  DIFile getFile() const { return getFieldAs<DIFile>(2); }
686  unsigned getLineNumber() const { return getUnsignedField(3); }
687 
690  bool isReadOnlyObjCProperty() const {
692  }
693  bool isReadWriteObjCProperty() const {
695  }
696  bool isAssignObjCProperty() const {
698  }
699  bool isRetainObjCProperty() const {
701  }
702  bool isCopyObjCProperty() const {
704  }
705  bool isNonAtomicObjCProperty() const {
707  }
708 
709  DIType getType() const { return getFieldAs<DIType>(7); }
710 
711  /// Verify - Verify that a derived type descriptor is well formed.
712  bool Verify() const;
713 };
714 
715 /// \brief An imported module (C++ using directive or similar).
717  friend class DIDescriptor;
718  void printInternal(raw_ostream &OS) const;
719 
720 public:
721  explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
722  DIScope getContext() const { return getFieldAs<DIScope>(1); }
723  DIDescriptor getEntity() const { return getFieldAs<DIDescriptor>(2); }
724  unsigned getLineNumber() const { return getUnsignedField(3); }
725  StringRef getName() const { return getStringField(4); }
726  bool Verify() const;
727 };
728 
729 /// getDISubprogram - Find subprogram that is enclosing this scope.
730 DISubprogram getDISubprogram(const MDNode *Scope);
731 
732 /// getDICompositeType - Find underlying composite type.
733 DICompositeType getDICompositeType(DIType T);
734 
735 /// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
736 /// to hold function specific information.
737 NamedMDNode *getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP);
738 
739 /// getFnSpecificMDNode - Return a NameMDNode, if available, that is
740 /// suitable to hold function specific information.
741 NamedMDNode *getFnSpecificMDNode(const Module &M, DISubprogram SP);
742 
743 /// createInlinedVariable - Create a new inlined variable based on current
744 /// variable.
745 /// @param DV Current Variable.
746 /// @param InlinedScope Location at current variable is inlined.
747 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
748  LLVMContext &VMContext);
749 
750 /// cleanseInlinedVariable - Remove inlined scope from the variable.
751 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
752 
753 /// Construct DITypeIdentifierMap by going through retained types of each CU.
754 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
755 
756 /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
757 /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
758 /// processDeclare, processValue and processLocation to handle DbgDeclareInst,
759 /// DbgValueInst and DbgLoc attached to instructions. processModule will go
760 /// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
761 /// used by the CUs.
763 public:
764  DebugInfoFinder() : TypeMapInitialized(false) {}
765 
766  /// processModule - Process entire module and collect debug info
767  /// anchors.
768  void processModule(const Module &M);
769 
770  /// processDeclare - Process DbgDeclareInst.
771  void processDeclare(const Module &M, const DbgDeclareInst *DDI);
772  /// Process DbgValueInst.
773  void processValue(const Module &M, const DbgValueInst *DVI);
774  /// processLocation - Process DILocation.
775  void processLocation(const Module &M, DILocation Loc);
776 
777  /// Clear all lists.
778  void reset();
779 
780 private:
781  /// Initialize TypeIdentifierMap.
782  void InitializeTypeMap(const Module &M);
783 
784  /// processType - Process DIType.
785  void processType(DIType DT);
786 
787  /// processLexicalBlock - Process DILexicalBlock.
788  void processLexicalBlock(DILexicalBlock LB);
789 
790  /// processSubprogram - Process DISubprogram.
791  void processSubprogram(DISubprogram SP);
792 
793  void processScope(DIScope Scope);
794 
795  /// addCompileUnit - Add compile unit into CUs.
796  bool addCompileUnit(DICompileUnit CU);
797 
798  /// addGlobalVariable - Add global variable into GVs.
799  bool addGlobalVariable(DIGlobalVariable DIG);
800 
801  // addSubprogram - Add subprogram into SPs.
802  bool addSubprogram(DISubprogram SP);
803 
804  /// addType - Add type into Tys.
805  bool addType(DIType DT);
806 
807  bool addScope(DIScope Scope);
808 
809 public:
811  iterator compile_unit_begin() const { return CUs.begin(); }
812  iterator compile_unit_end() const { return CUs.end(); }
813  iterator subprogram_begin() const { return SPs.begin(); }
814  iterator subprogram_end() const { return SPs.end(); }
815  iterator global_variable_begin() const { return GVs.begin(); }
816  iterator global_variable_end() const { return GVs.end(); }
817  iterator type_begin() const { return TYs.begin(); }
818  iterator type_end() const { return TYs.end(); }
819  iterator scope_begin() const { return Scopes.begin(); }
820  iterator scope_end() const { return Scopes.end(); }
821 
822  unsigned compile_unit_count() const { return CUs.size(); }
823  unsigned global_variable_count() const { return GVs.size(); }
824  unsigned subprogram_count() const { return SPs.size(); }
825  unsigned type_count() const { return TYs.size(); }
826  unsigned scope_count() const { return Scopes.size(); }
827 
828 private:
829  SmallVector<MDNode *, 8> CUs; // Compile Units
830  SmallVector<MDNode *, 8> SPs; // Subprograms
831  SmallVector<MDNode *, 8> GVs; // Global Variables;
832  SmallVector<MDNode *, 8> TYs; // Types
833  SmallVector<MDNode *, 8> Scopes; // Scopes
834  SmallPtrSet<MDNode *, 64> NodesSeen;
835  DITypeIdentifierMap TypeIdentifierMap;
836  /// Specify if TypeIdentifierMap is initialized.
837  bool TypeMapInitialized;
838 };
839 } // end namespace llvm
840 
841 #endif
bool isBlockByrefVariable() const
Definition: DebugInfo.h:653
unsigned isLocalToUnit() const
Definition: DebugInfo.h:445
StringRef getName() const
Definition: DebugInfo.h:290
iterator subprogram_begin() const
Definition: DebugInfo.h:813
unsigned isLocalToUnit() const
Definition: DebugInfo.h:590
bool Verify() const
Verify that the file descriptor is well formed.
Definition: DebugInfo.cpp:578
COFF::RelocationTypeX86 Type
Definition: COFFYAML.cpp:227
DITemplateTypeParameter - This is a wrapper for template type parameter.
Definition: DebugInfo.h:537
bool Verify() const
Verify - Verify that a composite type descriptor is well formed.
Definition: DebugInfo.cpp:494
bool isVector() const
Definition: DebugInfo.h:314
DICompositeType getDICompositeType(DIType T)
getDICompositeType - Find underlying composite type.
Definition: DebugInfo.cpp:900
StringRef getString() const
Definition: Metadata.h:46
GlobalVariable * getGlobal() const
Definition: DebugInfo.h:593
void printInternal(raw_ostream &OS) const
Definition: DebugInfo.cpp:1264
DILocation getOrigLocation() const
Definition: DebugInfo.h:671
bool isArtificial() const
Definition: DebugInfo.h:309
DIGlobalVariable(const MDNode *N=0)
Definition: DebugInfo.h:577
Constant * getConstantField(unsigned Elt) const
Definition: DebugInfo.cpp:111
DINameSpace(const MDNode *N=0)
Definition: DebugInfo.h:529
bool isNonAtomicObjCProperty() const
Definition: DebugInfo.h:705
DIImportedEntity(const MDNode *N)
Definition: DebugInfo.h:721
DescTy getFieldAs(unsigned Elt) const
Definition: DebugInfo.h:94
StringRef getDirectory() const
Definition: DebugInfo.h:584
bool isVariable() const
isVariable - Return true if the specified tag is legal for DIVariable.
Definition: DebugInfo.cpp:206
void replaceAllUsesWith(DIDescriptor &D)
Definition: DebugInfo.cpp:336
bool isSubprogram() const
Definition: DebugInfo.cpp:225
Various leaf nodes.
Definition: ISDOpcodes.h:60
uint16_t getTag() const
Definition: DebugInfo.h:121
The main container class for the LLVM Intermediate Representation.
Definition: Module.h:112
DIEnumerator(const MDNode *N=0)
Definition: DebugInfo.h:185
StringRef getFlags() const
Definition: DebugInfo.h:413
DIScope getScope() const
Definition: DebugInfo.h:670
bool operator==(DIDescriptor Other) const
Definition: DebugInfo.h:118
DIScopeRef getContext() const
Definition: DebugInfo.h:289
DIType getType() const
Definition: DebugInfo.h:709
unsigned getLineNumber() const
Definition: DebugInfo.h:686
unsigned global_variable_count() const
Definition: DebugInfo.h:823
unsigned getLineNumber() const
Definition: DebugInfo.h:668
bool Verify() const
Verify that the imported module descriptor is well formed.
Definition: DebugInfo.cpp:613
DILocation(const MDNode *N)
Definition: DebugInfo.h:666
bool Verify() const
Verify that the template type parameter descriptor is well formed.
Definition: DebugInfo.cpp:603
DITypeRef getType() const
Definition: DebugInfo.h:560
uint64_t getAlignInBits() const
Definition: DebugInfo.h:293
int64_t getCount() const
Definition: DebugInfo.h:162
unsigned isDefinition() const
Definition: DebugInfo.h:591
iterator type_begin() const
Definition: DebugInfo.h:817
uint64_t getUInt64Field(unsigned Elt) const
Definition: DebugInfo.cpp:73
bool isValid() const
Definition: DebugInfo.h:316
MDNode * getInlinedAt() const
getInlinedAt - If this variable is inlined then return inline location.
Definition: DebugInfo.cpp:144
DIScope getContext() const
Definition: DebugInfo.h:501
bool isUnspecifiedParameter() const
Definition: DebugInfo.cpp:238
void reset()
Clear all lists.
Definition: DebugInfo.cpp:946
DIArray getTemplateParams() const
Definition: DebugInfo.h:384
MDNode * getObjCProperty() const
getObjCProperty - Return property node, if this ivar is associated with one.
Definition: DebugInfo.cpp:619
StringRef getObjCPropertyGetterName() const
Definition: DebugInfo.h:688
MDNode - a tuple of other values.
Definition: Metadata.h:69
unsigned getRunTimeLang() const
Definition: DebugInfo.h:381
F(f)
unsigned scope_count() const
Definition: DebugInfo.h:826
DIScope getContext() const
Definition: DebugInfo.h:722
bool isObjectPointer() const
Definition: DebugInfo.h:627
DIScope getContext() const
Definition: DebugInfo.h:512
DIFile(const MDNode *N=0)
Definition: DebugInfo.h:396
DICompositeType getType() const
Definition: DebugInfo.h:441
bool isObjCProperty() const
isObjCProperty - Return true if the specified tag is DW_TAG_APPLE_property.
Definition: DebugInfo.cpp:313
StringRef getObjCPropertyName() const
Definition: DebugInfo.h:684
Constant * getConstant() const
Definition: DebugInfo.h:594
void processModule(const Module &M)
processModule - Process entire module and collect debug info.
Definition: DebugInfo.cpp:966
MDNode * operator->() const
Definition: DebugInfo.h:109
SmallVectorImpl< MDNode * >::const_iterator iterator
Definition: DebugInfo.h:810
unsigned getLineNumber() const
Definition: DebugInfo.h:588
iterator compile_unit_begin() const
Definition: DebugInfo.h:811
DITemplateTypeParameter(const MDNode *N=0)
Definition: DebugInfo.h:539
DIArray - This descriptor holds an array of descriptors.
Definition: DebugInfo.h:167
bool Verify() const
Verify - Verify that a compile unit is well formed.
Definition: DebugInfo.cpp:375
unsigned isArtificial() const
Definition: DebugInfo.h:455
void setTypeArray(DIArray Elements, DIArray TParams=DIArray())
Set the array of member DITypes.
Definition: DebugInfo.cpp:643
DIScopeRef getContext() const
Definition: DebugInfo.h:436
uint64_t getAddrElement(unsigned Idx) const
Definition: DebugInfo.h:647
DIScope(const MDNode *N=0)
Definition: DebugInfo.h:203
unsigned getNumAddrElements() const
Definition: DebugInfo.cpp:139
DIScope getContext() const
Definition: DebugInfo.h:530
bool Verify() const
Verify that the lexical block descriptor is well formed.
Definition: DebugInfo.cpp:593
bool Verify() const
Definition: DebugInfo.cpp:37
StringRef getObjCPropertySetterName() const
Definition: DebugInfo.h:689
DISubrange - This is used to represent ranges, for array bounds.
Definition: DebugInfo.h:154
StringRef getDirectory() const
Definition: DebugInfo.h:563
StringRef getName() const
Definition: DebugInfo.h:187
bool Verify() const
Verify - Verify that a location descriptor is well formed.
Definition: DebugInfo.cpp:560
void addMember(DIDescriptor D)
Definition: DebugInfo.cpp:661
StringRef getFilename() const
Definition: DebugInfo.h:544
DIBasicType(const MDNode *N=0)
Definition: DebugInfo.h:327
bool Verify() const
Verify - Verify that a global variable descriptor is well formed.
Definition: DebugInfo.cpp:528
bool isPrivate() const
Definition: DebugInfo.h:460
bool isPrivate() const
Definition: DebugInfo.h:298
bool isIndirect() const
Return true if this variable is represented as a pointer.
Definition: DebugInfo.h:632
DIScopeRef getRef() const
Definition: DebugInfo.cpp:676
bool isAppleBlockExtension() const
Definition: DebugInfo.h:302
DIDescriptor(const MDNode *N=0)
Definition: DebugInfo.h:104
StringRef getName() const
Definition: DebugInfo.h:613
DIScopeRef getContext() const
Definition: DebugInfo.h:558
#define false
Definition: ConvertUTF.c:64
unsigned getColumnNumber() const
Definition: DebugInfo.h:669
iterator scope_begin() const
Definition: DebugInfo.h:819
bool Verify() const
Verify - Verify that a derived type descriptor is well formed.
Definition: DebugInfo.cpp:480
DIDescriptor getEntity() const
Definition: DebugInfo.h:723
DISubprogram - This is a wrapper for a subprogram (e.g. a function).
Definition: DebugInfo.h:429
bool isScope() const
Definition: DebugInfo.cpp:244
DIArray getEnumTypes() const
Definition: DebugInfo.cpp:785
StringRef getDirectory() const
Definition: DebugInfo.cpp:779
bool operator!=(DIDescriptor Other) const
Definition: DebugInfo.h:119
#define T
bool isPrototyped() const
isPrototyped - Return true if this subprogram is prototyped.
Definition: DebugInfo.h:469
void setContainingType(DICompositeType ContainingType)
Set the containing type.
Definition: DebugInfo.cpp:686
unsigned getLineNumber() const
Definition: DebugInfo.h:440
unsigned subprogram_count() const
Definition: DebugInfo.h:824
bool isArtificial() const
isArtificial - Return true if this variable is marked as "artificial".
Definition: DebugInfo.h:623
DIFile getFile() const
Definition: DebugInfo.h:685
bool hasComplexAddress() const
HasComplexAddr - Return true if the variable has a complex address.
Definition: DebugInfo.h:643
bool isRetainObjCProperty() const
Definition: DebugInfo.h:699
StringRef getName() const
Definition: DebugInfo.h:437
unsigned getLineNumber() const
Definition: DebugInfo.h:724
unsigned isOptimized() const
Definition: DebugInfo.cpp:717
DIFile - This is a wrapper for a file.
Definition: DebugInfo.h:392
DIScopeRef getContext() const
Definition: DebugInfo.cpp:738
bool isTemplateTypeParameter() const
Definition: DebugInfo.cpp:262
DILexicalBlock(const MDNode *N=0)
Definition: DebugInfo.h:500
DISubrange(const MDNode *N=0)
Definition: DebugInfo.h:159
bool isType() const
isType - Return true if the specified tag is legal for DIType.
Definition: DebugInfo.cpp:219
StringRef getName() const
Definition: DebugInfo.h:254
DILexicalBlock - This is a wrapper for a lexical block.
Definition: DebugInfo.h:498
DISubprogram getDISubprogram(const MDNode *Scope)
getDISubprogram - Find subprogram that is enclosing this scope.
Definition: DebugInfo.cpp:885
bool Verify() const
Verify - Verify that a variable descriptor is well formed.
Definition: DebugInfo.cpp:547
bool isVirtual() const
Definition: DebugInfo.h:308
Function * getFunction() const
Definition: DebugInfo.h:482
unsigned isDefinition() const
Definition: DebugInfo.h:446
DITemplateValueParameter(const MDNode *N=0)
Definition: DebugInfo.h:556
bool isReadOnlyObjCProperty() const
Definition: DebugInfo.h:690
DITypeRef getContainingType() const
Definition: DebugInfo.h:382
DITemplateValueParameter - This is a wrapper for template value parameter.
Definition: DebugInfo.h:554
DIArray getRetainedTypes() const
Definition: DebugInfo.cpp:792
DITypeRef getContainingType() const
Definition: DebugInfo.h:451
bool isTemplateValueParameter() const
Definition: DebugInfo.cpp:268
StringRef getFilename() const
Definition: DebugInfo.cpp:773
StringRef getName() const
If the scope node has a name, return that, else return an empty string.
Definition: DebugInfo.cpp:760
MDNode * getVariablesNodes() const
Definition: DebugInfo.cpp:724
MDString * getIdentifier() const
Definition: DebugInfo.cpp:623
unsigned getLineNumber() const
Definition: DebugInfo.h:502
DIDescriptor getElement(unsigned Idx) const
Definition: DebugInfo.h:172
DIArray getGlobalVariables() const
Definition: DebugInfo.cpp:806
bool describes(const Function *F)
Definition: DebugInfo.cpp:705
LLVM Constant Representation.
Definition: Constant.h:41
DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext)
cleanseInlinedVariable - Remove inlined scope from the variable.
Definition: DebugInfo.cpp:875
void replaceFunctionField(unsigned Elt, Function *F)
Definition: DebugInfo.cpp:129
bool isInlinedFnArgument(const Function *CurFn)
Definition: DebugInfo.cpp:694
DILexicalBlock getScope() const
Definition: DebugInfo.h:519
StringRef getFilename() const
Definition: DebugInfo.h:672
iterator subprogram_end() const
Definition: DebugInfo.h:814
void printInternal(raw_ostream &OS) const
Definition: DebugInfo.cpp:1245
DIGlobalVariable - This is a wrapper for a global variable.
Definition: DebugInfo.h:572
int64_t getLo() const
Definition: DebugInfo.h:161
iterator end()
Definition: DenseMap.h:57
StringRef getLinkageName() const
Definition: DebugInfo.h:439
unsigned getLineNumber() const
Definition: DebugInfo.h:548
DIScopeRef getContext() const
Definition: DebugInfo.h:541
unsigned getEncoding() const
Definition: DebugInfo.h:329
bool Verify() const
Verify that the file-scoped lexical block descriptor is well formed.
Definition: DebugInfo.cpp:598
void processValue(const Module &M, const DbgValueInst *DVI)
Process DbgValueInst.
Definition: DebugInfo.cpp:1114
uint64_t getOffsetInBits() const
Definition: DebugInfo.h:296
StringRef getDirectory() const
Definition: DebugInfo.h:673
unsigned getNumElements() const
Definition: DebugInfo.cpp:328
bool isObjectPointer() const
Definition: DebugInfo.h:310
unsigned compile_unit_count() const
Definition: DebugInfo.h:822
iterator global_variable_begin() const
Definition: DebugInfo.h:815
DIType getType() const
Definition: DebugInfo.h:620
bool isBasicType() const
Definition: DebugInfo.cpp:152
bool isImportedEntity() const
Return true if the specified tag is DW_TAG_imported_module or DW_TAG_imported_declaration.
Definition: DebugInfo.cpp:319
DIArray getTemplateParams() const
Definition: DebugInfo.h:484
bool Verify() const
Verify that the subrange descriptor is well formed.
Definition: DebugInfo.cpp:588
unsigned getLineNumber() const
Definition: DebugInfo.h:532
bool Verify() const
Verify that the enumerator descriptor is well formed.
Definition: DebugInfo.cpp:583
An imported module (C++ using directive or similar).
Definition: DebugInfo.h:716
bool isProtected() const
Definition: DebugInfo.h:299
DIScope - A base class for various scopes.
Definition: DebugInfo.h:197
DISubprogram(const MDNode *N=0)
Definition: DebugInfo.h:434
StringRef getName() const
Definition: DebugInfo.h:580
StringRef getDisplayName() const
Definition: DebugInfo.h:581
int64_t getEnumValue() const
Definition: DebugInfo.h:188
T resolve(const DITypeIdentifierMap &Map) const
Definition: DebugInfo.h:238
void processLocation(const Module &M, DILocation Loc)
processLocation - Process DILocation.
Definition: DebugInfo.cpp:1005
DIDescriptor getDescriptorField(unsigned Elt) const
Definition: DebugInfo.cpp:97
unsigned getLineNumber() const
Definition: DebugInfo.h:566
unsigned getLineNumber() const
Definition: DebugInfo.h:291
bool Verify() const
Verify - Verify that a derived type descriptor is well formed.
Definition: DebugInfo.cpp:388
iterator type_end() const
Definition: DebugInfo.h:818
DINameSpace - A wrapper for a C++ style name space.
Definition: DebugInfo.h:524
StringRef getName() const
Definition: DebugInfo.h:559
unsigned getColumnNumber() const
Definition: DebugInfo.h:549
DICompileUnit(const MDNode *N=0)
Definition: DebugInfo.h:407
int64_t getInt64Field(unsigned Elt) const
Definition: DebugInfo.cpp:85
bool isLexicalBlockFile() const
Definition: DebugInfo.cpp:291
bool isGlobalVariable() const
Definition: DebugInfo.cpp:231
bool isAssignObjCProperty() const
Definition: DebugInfo.h:696
NamedMDNode * getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP)
Definition: DebugInfo.cpp:855
StringRef getName() const
Definition: DebugInfo.h:531
unsigned getUnsignedField(unsigned Elt) const
Definition: DebugInfo.h:87
DIArray getTypeArray() const
Definition: DebugInfo.h:378
iterator compile_unit_end() const
Definition: DebugInfo.h:812
unsigned getColumnNumber() const
Definition: DebugInfo.h:567
DIDerivedType getStaticDataMemberDeclaration() const
Definition: DebugInfo.h:595
DIType(const MDNode *N=0)
Definition: DebugInfo.h:284
DISubprogram getFunctionDeclaration() const
Definition: DebugInfo.h:485
bool isBlockByrefStruct() const
Definition: DebugInfo.h:305
DIScope getContext() const
Definition: DebugInfo.h:612
StringRef getStringField(unsigned Elt) const
Definition: DebugInfo.cpp:69
bool isForwardDecl() const
Definition: DebugInfo.h:300
bool isStaticMember() const
Definition: DebugInfo.h:315
DIFile getFile() const
Definition: DebugInfo.h:614
unsigned getLineNumber() const
Definition: DebugInfo.h:517
iterator global_variable_end() const
Definition: DebugInfo.h:816
StringRef getName() const
Definition: DebugInfo.h:542
StringRef getFilename() const
Definition: DebugInfo.h:562
DIObjCProperty(const MDNode *N)
Definition: DebugInfo.h:682
const MDNode * DbgNode
Definition: DebugInfo.h:84
unsigned getColumnNumber() const
Definition: DebugInfo.h:503
unsigned getVirtualIndex() const
Definition: DebugInfo.h:449
bool isNameSpace() const
isNameSpace - Return true if the specified tag is DW_TAG_namespace.
Definition: DebugInfo.cpp:285
bool isEnumerator() const
isEnumerator - Return true if the specified tag is DW_TAG_enumerator.
Definition: DebugInfo.cpp:308
DIArray(const MDNode *N=0)
Definition: DebugInfo.h:169
unsigned getFlags() const
Definition: DebugInfo.h:453
DITypeRef getClassType() const
Definition: DebugInfo.h:351
DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope, LLVMContext &VMContext)
Definition: DebugInfo.cpp:865
bool isReadWriteObjCProperty() const
Definition: DebugInfo.h:693
DICompositeType(const MDNode *N=0)
Definition: DebugInfo.h:376
Function * getFunctionField(unsigned Elt) const
Definition: DebugInfo.cpp:120
bool Verify() const
Verify - Verify that a basic type descriptor is well formed.
Definition: DebugInfo.cpp:475
bool Verify() const
Verify - Verify that a type descriptor is well formed.
Definition: DebugInfo.cpp:441
unsigned getArgNumber() const
Definition: DebugInfo.h:616
#define LLVM_EXPLICIT
Expands to explicit on compilers which support explicit conversion operators. Otherwise expands to no...
Definition: Compiler.h:381
void print(raw_ostream &OS) const
print - print descriptor.
Definition: DebugInfo.cpp:1201
bool isCopyObjCProperty() const
Definition: DebugInfo.h:702
DIRef< DIType > DITypeRef
Definition: DebugInfo.h:194
void processDeclare(const Module &M, const DbgDeclareInst *DDI)
processDeclare - Process DbgDeclareInst.
Definition: DebugInfo.cpp:1097
#define N
bool Verify() const
Verify - Verify that a subprogram descriptor is well formed.
Definition: DebugInfo.cpp:512
unsigned getRunTimeVersion() const
Definition: DebugInfo.h:414
void dump() const
dump - print descriptor to dbgs() with a newline.
Definition: DebugInfo.cpp:1195
GlobalVariable * getGlobalVariableField(unsigned Elt) const
Definition: DebugInfo.cpp:102
uint64_t getSizeInBits() const
Definition: DebugInfo.h:292
DenseMap< const MDString *, MDNode * > DITypeIdentifierMap
Maps from type identifier to the actual MDNode.
Definition: DebugInfo.h:52
bool isCompositeType() const
Definition: DebugInfo.cpp:189
DIVariable(const MDNode *N=0)
Definition: DebugInfo.h:610
bool isProtected() const
Definition: DebugInfo.h:463
bool isObjcClassComplete() const
Definition: DebugInfo.h:311
unsigned type_count() const
Definition: DebugInfo.h:825
iterator scope_end() const
Definition: DebugInfo.h:820
unsigned getFlags() const
Definition: DebugInfo.h:297
bool isOptimized() const
Definition: DebugInfo.h:412
DIDerivedType(const MDNode *N=0)
Definition: DebugInfo.h:343
StringRef getName() const
Definition: DebugInfo.h:725
LLVM Value Representation.
Definition: Value.h:66
StringRef getFilename() const
Definition: DebugInfo.h:583
unsigned getScopeLineNumber() const
Definition: DebugInfo.h:494
DIArray getImportedEntities() const
Definition: DebugInfo.cpp:813
Constant * getConstant() const
Definition: DebugInfo.h:356
DIScope getContext() const
Definition: DebugInfo.h:579
DITypeRef getTypeDerivedFrom() const
Definition: DebugInfo.h:345
unsigned getColumnNumber() const
Definition: DebugInfo.h:518
DIArray getVariables() const
Definition: DebugInfo.cpp:728
bool Verify() const
Verify - Verify that a namespace descriptor is well formed.
Definition: DebugInfo.cpp:568
unsigned getLineNumber() const
Definition: DebugInfo.h:615
bool isDerivedType() const
isDerivedType - Return true if the specified tag is legal for DIDerivedType.
Definition: DebugInfo.cpp:165
StringRef getDirectory() const
Definition: DebugInfo.h:545
DIRef< DIScope > DIScopeRef
Definition: DebugInfo.h:192
void replaceFunction(Function *F)
Definition: DebugInfo.h:483
NamedMDNode * getFnSpecificMDNode(const Module &M, DISubprogram SP)
Definition: DebugInfo.cpp:847
DIArray getSubprograms() const
Definition: DebugInfo.cpp:799
bool isCompileUnit() const
isCompileUnit - Return true if the specified tag is DW_TAG_compile_unit.
Definition: DebugInfo.cpp:275
bool isExplicit() const
isExplicit - Return true if this subprogram is marked as explicit.
Definition: DebugInfo.h:467
bool isLexicalBlock() const
isLexicalBlock - Return true if the specified tag is DW_TAG_lexical_block.
Definition: DebugInfo.cpp:297
DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes)
Construct DITypeIdentifierMap by going through retained types of each CU.
Definition: DebugInfo.cpp:918
bool Verify() const
Verify that the template value parameter descriptor is well formed.
Definition: DebugInfo.cpp:608
DIType getType() const
Definition: DebugInfo.h:589
bool isSubrange() const
isSubrange - Return true if the specified tag is DW_TAG_subrange_type.
Definition: DebugInfo.cpp:303
void printExtendedName(raw_ostream &OS) const
Definition: DebugInfo.cpp:1397
DICompileUnit - A wrapper for a compile unit.
Definition: DebugInfo.h:402
iterator find(const KeyT &Val)
Definition: DenseMap.h:108
StringRef getProducer() const
Definition: DebugInfo.h:410
StringRef getLinkageName() const
Definition: DebugInfo.h:582
DILexicalBlockFile(const MDNode *N=0)
Definition: DebugInfo.h:511
DITypeRef getType() const
Definition: DebugInfo.h:543
bool isFile() const
isFile - Return true if the specified tag is DW_TAG_file_type.
Definition: DebugInfo.cpp:280
unsigned getLanguage() const
Definition: DebugInfo.h:409
MDNode * getFileNode() const
Retrieve the MDNode for the directory/file pair.
Definition: DebugInfo.cpp:575
unsigned getVirtuality() const
Definition: DebugInfo.h:448
StringRef getDisplayName() const
Definition: DebugInfo.h:438
DIBasicType - A basic type, like 'int' or 'float'.
Definition: DebugInfo.h:325
StringRef getSplitDebugFilename() const
Definition: DebugInfo.h:422