1 //===--- llvm/Analysis/DebugInfo.h - Debug Information Helpers --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_DEBUGINFO_H
18 #define LLVM_DEBUGINFO_H
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/Support/Dwarf.h"
43 class DILexicalBlockFile;
48 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
49 /// This should not be stored in a container, because the underlying MDNode
50 /// may change in certain situations.
55 FlagProtected = 1 << 1,
57 FlagAppleBlock = 1 << 3,
58 FlagBlockByrefStruct = 1 << 4,
60 FlagArtificial = 1 << 6,
61 FlagExplicit = 1 << 7,
62 FlagPrototyped = 1 << 8,
63 FlagObjcClassComplete = 1 << 9,
64 FlagObjectPointer = 1 << 10,
66 FlagStaticMember = 1 << 12
69 const MDNode *DbgNode;
71 StringRef getStringField(unsigned Elt) const;
72 unsigned getUnsignedField(unsigned Elt) const {
73 return (unsigned)getUInt64Field(Elt);
75 uint64_t getUInt64Field(unsigned Elt) const;
76 int64_t getInt64Field(unsigned Elt) const;
77 DIDescriptor getDescriptorField(unsigned Elt) const;
79 template <typename DescTy>
80 DescTy getFieldAs(unsigned Elt) const {
81 return DescTy(getDescriptorField(Elt));
84 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
85 Constant *getConstantField(unsigned Elt) const;
86 Function *getFunctionField(unsigned Elt) const;
87 void replaceFunctionField(unsigned Elt, Function *F);
90 explicit DIDescriptor() : DbgNode(0) {}
91 explicit DIDescriptor(const MDNode *N) : DbgNode(N) {}
92 explicit DIDescriptor(const DIFile F);
93 explicit DIDescriptor(const DISubprogram F);
94 explicit DIDescriptor(const DILexicalBlockFile F);
95 explicit DIDescriptor(const DILexicalBlock F);
96 explicit DIDescriptor(const DIVariable F);
97 explicit DIDescriptor(const DIType F);
101 operator MDNode *() const { return const_cast<MDNode*>(DbgNode); }
102 MDNode *operator ->() const { return const_cast<MDNode*>(DbgNode); }
104 unsigned getTag() const {
105 return getUnsignedField(0) & ~LLVMDebugVersionMask;
108 bool isDerivedType() const;
109 bool isCompositeType() const;
110 bool isBasicType() const;
111 bool isVariable() const;
112 bool isSubprogram() const;
113 bool isGlobalVariable() const;
114 bool isScope() const;
116 bool isCompileUnit() const;
117 bool isNameSpace() const;
118 bool isLexicalBlockFile() const;
119 bool isLexicalBlock() const;
120 bool isSubrange() const;
121 bool isEnumerator() const;
123 bool isGlobal() const;
124 bool isUnspecifiedParameter() const;
125 bool isTemplateTypeParameter() const;
126 bool isTemplateValueParameter() const;
127 bool isObjCProperty() const;
129 /// print - print descriptor.
130 void print(raw_ostream &OS) const;
132 /// dump - print descriptor to dbgs() with a newline.
136 /// DISubrange - This is used to represent ranges, for array bounds.
137 class DISubrange : public DIDescriptor {
138 friend class DIDescriptor;
139 void printInternal(raw_ostream &OS) const;
141 explicit DISubrange(const MDNode *N = 0) : DIDescriptor(N) {}
143 int64_t getLo() const { return getInt64Field(1); }
144 int64_t getCount() const { return getInt64Field(2); }
148 /// DIArray - This descriptor holds an array of descriptors.
149 class DIArray : public DIDescriptor {
151 explicit DIArray(const MDNode *N = 0)
154 unsigned getNumElements() const;
155 DIDescriptor getElement(unsigned Idx) const {
156 return getDescriptorField(Idx);
160 /// DIScope - A base class for various scopes.
161 class DIScope : public DIDescriptor {
163 friend class DIDescriptor;
164 void printInternal(raw_ostream &OS) const;
166 explicit DIScope(const MDNode *N = 0) : DIDescriptor (N) {}
168 StringRef getFilename() const;
169 StringRef getDirectory() const;
172 /// DIFile - This is a wrapper for a file.
173 class DIFile : public DIScope {
174 friend class DIDescriptor;
176 explicit DIFile(const MDNode *N = 0) : DIScope(N) {
177 if (DbgNode && !isFile())
180 MDNode *getFileNode() const;
184 /// DICompileUnit - A wrapper for a compile unit.
185 class DICompileUnit : public DIScope {
186 friend class DIDescriptor;
187 void printInternal(raw_ostream &OS) const;
189 explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
191 unsigned getLanguage() const { return getUnsignedField(2); }
192 StringRef getProducer() const { return getStringField(3); }
194 bool isOptimized() const { return getUnsignedField(4) != 0; }
195 StringRef getFlags() const { return getStringField(5); }
196 unsigned getRunTimeVersion() const { return getUnsignedField(6); }
198 DIArray getEnumTypes() const;
199 DIArray getRetainedTypes() const;
200 DIArray getSubprograms() const;
201 DIArray getGlobalVariables() const;
203 StringRef getSplitDebugFilename() const { return getStringField(11); }
205 /// Verify - Verify that a compile unit is well formed.
209 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
210 /// FIXME: it seems strange that this doesn't have either a reference to the
211 /// type/precision or a file/line pair for location info.
212 class DIEnumerator : public DIDescriptor {
213 friend class DIDescriptor;
214 void printInternal(raw_ostream &OS) const;
216 explicit DIEnumerator(const MDNode *N = 0) : DIDescriptor(N) {}
218 StringRef getName() const { return getStringField(1); }
219 uint64_t getEnumValue() const { return getUInt64Field(2); }
223 /// DIType - This is a wrapper for a type.
224 /// FIXME: Types should be factored much better so that CV qualifiers and
225 /// others do not require a huge and empty descriptor full of zeros.
226 class DIType : public DIScope {
228 friend class DIDescriptor;
229 void printInternal(raw_ostream &OS) const;
230 // This ctor is used when the Tag has already been validated by a derived
232 DIType(const MDNode *N, bool, bool) : DIScope(N) {}
234 /// Verify - Verify that a type descriptor is well formed.
236 explicit DIType(const MDNode *N);
239 DIScope getContext() const { return getFieldAs<DIScope>(2); }
240 StringRef getName() const { return getStringField(3); }
241 unsigned getLineNumber() const { return getUnsignedField(4); }
242 uint64_t getSizeInBits() const { return getUInt64Field(5); }
243 uint64_t getAlignInBits() const { return getUInt64Field(6); }
244 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
245 // carry this is just plain insane.
246 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
247 unsigned getFlags() const { return getUnsignedField(8); }
248 bool isPrivate() const {
249 return (getFlags() & FlagPrivate) != 0;
251 bool isProtected() const {
252 return (getFlags() & FlagProtected) != 0;
254 bool isForwardDecl() const {
255 return (getFlags() & FlagFwdDecl) != 0;
257 // isAppleBlock - Return true if this is the Apple Blocks extension.
258 bool isAppleBlockExtension() const {
259 return (getFlags() & FlagAppleBlock) != 0;
261 bool isBlockByrefStruct() const {
262 return (getFlags() & FlagBlockByrefStruct) != 0;
264 bool isVirtual() const {
265 return (getFlags() & FlagVirtual) != 0;
267 bool isArtificial() const {
268 return (getFlags() & FlagArtificial) != 0;
270 bool isObjectPointer() const {
271 return (getFlags() & FlagObjectPointer) != 0;
273 bool isObjcClassComplete() const {
274 return (getFlags() & FlagObjcClassComplete) != 0;
276 bool isVector() const {
277 return (getFlags() & FlagVector) != 0;
279 bool isStaticMember() const {
280 return (getFlags() & FlagStaticMember) != 0;
282 bool isValid() const {
283 return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
286 /// isUnsignedDIType - Return true if type encoding is unsigned.
287 bool isUnsignedDIType();
289 /// replaceAllUsesWith - Replace all uses of debug info referenced by
291 void replaceAllUsesWith(DIDescriptor &D);
292 void replaceAllUsesWith(MDNode *D);
295 /// DIBasicType - A basic type, like 'int' or 'float'.
296 class DIBasicType : public DIType {
298 explicit DIBasicType(const MDNode *N = 0) : DIType(N) {}
300 unsigned getEncoding() const { return getUnsignedField(9); }
302 /// Verify - Verify that a basic type descriptor is well formed.
306 /// DIDerivedType - A simple derived type, like a const qualified type,
307 /// a typedef, a pointer or reference, et cetera. Or, a data member of
308 /// a class/struct/union.
309 class DIDerivedType : public DIType {
310 friend class DIDescriptor;
311 void printInternal(raw_ostream &OS) const;
313 explicit DIDerivedType(const MDNode *N, bool, bool)
314 : DIType(N, true, true) {}
316 explicit DIDerivedType(const MDNode *N = 0)
317 : DIType(N, true, true) {}
319 DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
321 /// getOriginalTypeSize - If this type is derived from a base type then
322 /// return base type size.
323 uint64_t getOriginalTypeSize() const;
325 /// getObjCProperty - Return property node, if this ivar is
326 /// associated with one.
327 MDNode *getObjCProperty() const;
329 DIType getClassType() const {
330 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
331 return getFieldAs<DIType>(10);
334 Constant *getConstant() const {
335 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
336 return getConstantField(10);
339 /// Verify - Verify that a derived type descriptor is well formed.
343 /// DICompositeType - This descriptor holds a type that can refer to multiple
344 /// other types, like a function or struct.
345 /// FIXME: Why is this a DIDerivedType??
346 class DICompositeType : public DIDerivedType {
347 friend class DIDescriptor;
348 void printInternal(raw_ostream &OS) const;
350 explicit DICompositeType(const MDNode *N = 0)
351 : DIDerivedType(N, true, true) {
352 if (N && !isCompositeType())
356 DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
357 void setTypeArray(DIArray Elements, DIArray TParams = DIArray());
358 unsigned getRunTimeLang() const { return getUnsignedField(11); }
359 DICompositeType getContainingType() const {
360 return getFieldAs<DICompositeType>(12);
362 void setContainingType(DICompositeType ContainingType);
363 DIArray getTemplateParams() const { return getFieldAs<DIArray>(13); }
365 /// Verify - Verify that a composite type descriptor is well formed.
369 /// DITemplateTypeParameter - This is a wrapper for template type parameter.
370 class DITemplateTypeParameter : public DIDescriptor {
372 explicit DITemplateTypeParameter(const MDNode *N = 0) : DIDescriptor(N) {}
374 DIScope getContext() const { return getFieldAs<DIScope>(1); }
375 StringRef getName() const { return getStringField(2); }
376 DIType getType() const { return getFieldAs<DIType>(3); }
377 StringRef getFilename() const {
378 return getFieldAs<DIFile>(4).getFilename();
380 StringRef getDirectory() const {
381 return getFieldAs<DIFile>(4).getDirectory();
383 unsigned getLineNumber() const { return getUnsignedField(5); }
384 unsigned getColumnNumber() const { return getUnsignedField(6); }
388 /// DITemplateValueParameter - This is a wrapper for template value parameter.
389 class DITemplateValueParameter : public DIDescriptor {
391 explicit DITemplateValueParameter(const MDNode *N = 0) : DIDescriptor(N) {}
393 DIScope getContext() const { return getFieldAs<DIScope>(1); }
394 StringRef getName() const { return getStringField(2); }
395 DIType getType() const { return getFieldAs<DIType>(3); }
396 uint64_t getValue() const { return getUInt64Field(4); }
397 StringRef getFilename() const {
398 return getFieldAs<DIFile>(5).getFilename();
400 StringRef getDirectory() const {
401 return getFieldAs<DIFile>(5).getDirectory();
403 unsigned getLineNumber() const { return getUnsignedField(6); }
404 unsigned getColumnNumber() const { return getUnsignedField(7); }
408 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
409 class DISubprogram : public DIScope {
410 friend class DIDescriptor;
411 void printInternal(raw_ostream &OS) const;
413 explicit DISubprogram(const MDNode *N = 0) : DIScope(N) {}
415 DIScope getContext() const { return getFieldAs<DIScope>(2); }
416 StringRef getName() const { return getStringField(3); }
417 StringRef getDisplayName() const { return getStringField(4); }
418 StringRef getLinkageName() const { return getStringField(5); }
419 unsigned getLineNumber() const { return getUnsignedField(6); }
420 DICompositeType getType() const { return getFieldAs<DICompositeType>(7); }
422 /// getReturnTypeName - Subprogram return types are encoded either as
423 /// DIType or as DICompositeType.
424 StringRef getReturnTypeName() const {
425 DICompositeType DCT(getFieldAs<DICompositeType>(7));
427 DIArray A = DCT.getTypeArray();
428 DIType T(A.getElement(0));
431 DIType T(getFieldAs<DIType>(7));
435 /// isLocalToUnit - Return true if this subprogram is local to the current
436 /// compile unit, like 'static' in C.
437 unsigned isLocalToUnit() const { return getUnsignedField(8); }
438 unsigned isDefinition() const { return getUnsignedField(9); }
440 unsigned getVirtuality() const { return getUnsignedField(10); }
441 unsigned getVirtualIndex() const { return getUnsignedField(11); }
443 DICompositeType getContainingType() const {
444 return getFieldAs<DICompositeType>(12);
447 unsigned getFlags() const {
448 return getUnsignedField(13);
451 unsigned isArtificial() const {
452 return (getUnsignedField(13) & FlagArtificial) != 0;
454 /// isPrivate - Return true if this subprogram has "private"
455 /// access specifier.
456 bool isPrivate() const {
457 return (getUnsignedField(13) & FlagPrivate) != 0;
459 /// isProtected - Return true if this subprogram has "protected"
460 /// access specifier.
461 bool isProtected() const {
462 return (getUnsignedField(13) & FlagProtected) != 0;
464 /// isExplicit - Return true if this subprogram is marked as explicit.
465 bool isExplicit() const {
466 return (getUnsignedField(13) & FlagExplicit) != 0;
468 /// isPrototyped - Return true if this subprogram is prototyped.
469 bool isPrototyped() const {
470 return (getUnsignedField(13) & FlagPrototyped) != 0;
473 unsigned isOptimized() const;
475 /// getScopeLineNumber - Get the beginning of the scope of the
476 /// function, not necessarily where the name of the program
478 unsigned getScopeLineNumber() const { return getUnsignedField(19); }
480 /// Verify - Verify that a subprogram descriptor is well formed.
483 /// describes - Return true if this subprogram provides debugging
484 /// information for the function F.
485 bool describes(const Function *F);
487 Function *getFunction() const { return getFunctionField(15); }
488 void replaceFunction(Function *F) { replaceFunctionField(15, F); }
489 DIArray getTemplateParams() const { return getFieldAs<DIArray>(16); }
490 DISubprogram getFunctionDeclaration() const {
491 return getFieldAs<DISubprogram>(17);
493 MDNode *getVariablesNodes() const;
494 DIArray getVariables() const;
497 /// DIGlobalVariable - This is a wrapper for a global variable.
498 class DIGlobalVariable : public DIDescriptor {
499 friend class DIDescriptor;
500 void printInternal(raw_ostream &OS) const;
502 explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
504 DIScope getContext() const { return getFieldAs<DIScope>(2); }
505 StringRef getName() const { return getStringField(3); }
506 StringRef getDisplayName() const { return getStringField(4); }
507 StringRef getLinkageName() const { return getStringField(5); }
508 StringRef getFilename() const {
509 return getFieldAs<DIFile>(6).getFilename();
511 StringRef getDirectory() const {
512 return getFieldAs<DIFile>(6).getDirectory();
516 unsigned getLineNumber() const { return getUnsignedField(7); }
517 DIType getType() const { return getFieldAs<DIType>(8); }
518 unsigned isLocalToUnit() const { return getUnsignedField(9); }
519 unsigned isDefinition() const { return getUnsignedField(10); }
521 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
522 Constant *getConstant() const { return getConstantField(11); }
523 DIDerivedType getStaticDataMemberDeclaration() const {
524 return getFieldAs<DIDerivedType>(12);
527 /// Verify - Verify that a global variable descriptor is well formed.
531 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
533 class DIVariable : public DIDescriptor {
534 friend class DIDescriptor;
535 void printInternal(raw_ostream &OS) const;
537 explicit DIVariable(const MDNode *N = 0)
540 DIScope getContext() const { return getFieldAs<DIScope>(1); }
541 StringRef getName() const { return getStringField(2); }
542 DIFile getFile() const { return getFieldAs<DIFile>(3); }
543 unsigned getLineNumber() const {
544 return (getUnsignedField(4) << 8) >> 8;
546 unsigned getArgNumber() const {
547 unsigned L = getUnsignedField(4);
550 DIType getType() const { return getFieldAs<DIType>(5); }
552 /// isArtificial - Return true if this variable is marked as "artificial".
553 bool isArtificial() const {
554 return (getUnsignedField(6) & FlagArtificial) != 0;
557 bool isObjectPointer() const {
558 return (getUnsignedField(6) & FlagObjectPointer) != 0;
561 /// getInlinedAt - If this variable is inlined then return inline location.
562 MDNode *getInlinedAt() const;
564 /// Verify - Verify that a variable descriptor is well formed.
567 /// HasComplexAddr - Return true if the variable has a complex address.
568 bool hasComplexAddress() const {
569 return getNumAddrElements() > 0;
572 unsigned getNumAddrElements() const;
574 uint64_t getAddrElement(unsigned Idx) const {
575 return getUInt64Field(Idx+8);
578 /// isBlockByrefVariable - Return true if the variable was declared as
579 /// a "__block" variable (Apple Blocks).
580 bool isBlockByrefVariable() const {
581 return getType().isBlockByrefStruct();
584 /// isInlinedFnArgument - Return true if this variable provides debugging
585 /// information for an inlined function arguments.
586 bool isInlinedFnArgument(const Function *CurFn);
588 void printExtendedName(raw_ostream &OS) const;
591 /// DILexicalBlock - This is a wrapper for a lexical block.
592 class DILexicalBlock : public DIScope {
594 explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
595 DIScope getContext() const { return getFieldAs<DIScope>(2); }
596 unsigned getLineNumber() const { return getUnsignedField(3); }
597 unsigned getColumnNumber() const { return getUnsignedField(4); }
601 /// DILexicalBlockFile - This is a wrapper for a lexical block with
602 /// a filename change.
603 class DILexicalBlockFile : public DIScope {
605 explicit DILexicalBlockFile(const MDNode *N = 0) : DIScope(N) {}
606 DIScope getContext() const { if (getScope().isSubprogram()) return getScope(); return getScope().getContext(); }
607 unsigned getLineNumber() const { return getScope().getLineNumber(); }
608 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
609 DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(2); }
613 /// DINameSpace - A wrapper for a C++ style name space.
614 class DINameSpace : public DIScope {
615 friend class DIDescriptor;
616 void printInternal(raw_ostream &OS) const;
618 explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
619 DIScope getContext() const { return getFieldAs<DIScope>(2); }
620 StringRef getName() const { return getStringField(3); }
621 unsigned getLineNumber() const { return getUnsignedField(4); }
625 /// DILocation - This object holds location information. This object
626 /// is not associated with any DWARF tag.
627 class DILocation : public DIDescriptor {
629 explicit DILocation(const MDNode *N) : DIDescriptor(N) { }
631 unsigned getLineNumber() const { return getUnsignedField(0); }
632 unsigned getColumnNumber() const { return getUnsignedField(1); }
633 DIScope getScope() const { return getFieldAs<DIScope>(2); }
634 DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
635 StringRef getFilename() const { return getScope().getFilename(); }
636 StringRef getDirectory() const { return getScope().getDirectory(); }
640 class DIObjCProperty : public DIDescriptor {
641 friend class DIDescriptor;
642 void printInternal(raw_ostream &OS) const;
644 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) { }
646 StringRef getObjCPropertyName() const { return getStringField(1); }
647 DIFile getFile() const { return getFieldAs<DIFile>(2); }
648 unsigned getLineNumber() const { return getUnsignedField(3); }
650 StringRef getObjCPropertyGetterName() const {
651 return getStringField(4);
653 StringRef getObjCPropertySetterName() const {
654 return getStringField(5);
656 bool isReadOnlyObjCProperty() {
657 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
659 bool isReadWriteObjCProperty() {
660 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
662 bool isAssignObjCProperty() {
663 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_assign) != 0;
665 bool isRetainObjCProperty() {
666 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_retain) != 0;
668 bool isCopyObjCProperty() {
669 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_copy) != 0;
671 bool isNonAtomicObjCProperty() {
672 return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
675 DIType getType() const { return getFieldAs<DIType>(7); }
677 /// Verify - Verify that a derived type descriptor is well formed.
681 /// getDISubprogram - Find subprogram that is enclosing this scope.
682 DISubprogram getDISubprogram(const MDNode *Scope);
684 /// getDICompositeType - Find underlying composite type.
685 DICompositeType getDICompositeType(DIType T);
687 /// isSubprogramContext - Return true if Context is either a subprogram
688 /// or another context nested inside a subprogram.
689 bool isSubprogramContext(const MDNode *Context);
691 /// getOrInsertFnSpecificMDNode - Return a NameMDNode that is suitable
692 /// to hold function specific information.
693 NamedMDNode *getOrInsertFnSpecificMDNode(Module &M, DISubprogram SP);
695 /// getFnSpecificMDNode - Return a NameMDNode, if available, that is
696 /// suitable to hold function specific information.
697 NamedMDNode *getFnSpecificMDNode(const Module &M, DISubprogram SP);
699 /// createInlinedVariable - Create a new inlined variable based on current
701 /// @param DV Current Variable.
702 /// @param InlinedScope Location at current variable is inlined.
703 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
704 LLVMContext &VMContext);
706 /// cleanseInlinedVariable - Remove inlined scope from the variable.
707 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
709 class DebugInfoFinder {
711 /// processModule - Process entire module and collect debug info
713 void processModule(const Module &M);
716 /// processType - Process DIType.
717 void processType(DIType DT);
719 /// processLexicalBlock - Process DILexicalBlock.
720 void processLexicalBlock(DILexicalBlock LB);
722 /// processSubprogram - Process DISubprogram.
723 void processSubprogram(DISubprogram SP);
725 /// processDeclare - Process DbgDeclareInst.
726 void processDeclare(const DbgDeclareInst *DDI);
728 /// processLocation - Process DILocation.
729 void processLocation(DILocation Loc);
731 /// addCompileUnit - Add compile unit into CUs.
732 bool addCompileUnit(DICompileUnit CU);
734 /// addGlobalVariable - Add global variable into GVs.
735 bool addGlobalVariable(DIGlobalVariable DIG);
737 // addSubprogram - Add subprogram into SPs.
738 bool addSubprogram(DISubprogram SP);
740 /// addType - Add type into Tys.
741 bool addType(DIType DT);
744 typedef SmallVector<MDNode *, 8>::const_iterator iterator;
745 iterator compile_unit_begin() const { return CUs.begin(); }
746 iterator compile_unit_end() const { return CUs.end(); }
747 iterator subprogram_begin() const { return SPs.begin(); }
748 iterator subprogram_end() const { return SPs.end(); }
749 iterator global_variable_begin() const { return GVs.begin(); }
750 iterator global_variable_end() const { return GVs.end(); }
751 iterator type_begin() const { return TYs.begin(); }
752 iterator type_end() const { return TYs.end(); }
754 unsigned compile_unit_count() const { return CUs.size(); }
755 unsigned global_variable_count() const { return GVs.size(); }
756 unsigned subprogram_count() const { return SPs.size(); }
757 unsigned type_count() const { return TYs.size(); }
760 SmallVector<MDNode *, 8> CUs; // Compile Units
761 SmallVector<MDNode *, 8> SPs; // Subprograms
762 SmallVector<MDNode *, 8> GVs; // Global Variables;
763 SmallVector<MDNode *, 8> TYs; // Types
764 SmallPtrSet<MDNode *, 64> NodesSeen;
766 } // end namespace llvm