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_ANALYSIS_DEBUGINFO_H
18 #define LLVM_ANALYSIS_DEBUGINFO_H
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/Support/Dwarf.h"
35 struct DebugLocTracker;
40 /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
41 /// This should not be stored in a container, because underly MDNode may
42 /// change in certain situations.
47 StringRef getStringField(unsigned Elt) const;
48 unsigned getUnsignedField(unsigned Elt) const {
49 return (unsigned)getUInt64Field(Elt);
51 uint64_t getUInt64Field(unsigned Elt) const;
52 DIDescriptor getDescriptorField(unsigned Elt) const;
54 template <typename DescTy>
55 DescTy getFieldAs(unsigned Elt) const {
56 return DescTy(getDescriptorField(Elt).getNode());
59 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
62 explicit DIDescriptor() : DbgNode(0) {}
63 explicit DIDescriptor(MDNode *N) : DbgNode(N) {}
65 bool Verify() const { return DbgNode != 0; }
67 MDNode *getNode() const { return DbgNode; }
69 unsigned getVersion() const {
70 return getUnsignedField(0) & LLVMDebugVersionMask;
73 unsigned getTag() const {
74 return getUnsignedField(0) & ~LLVMDebugVersionMask;
77 /// ValidDebugInfo - Return true if N represents valid debug info value.
78 static bool ValidDebugInfo(MDNode *N, unsigned OptLevel);
80 /// dump - print descriptor.
83 bool isDerivedType() const;
84 bool isCompositeType() const;
85 bool isBasicType() const;
86 bool isVariable() const;
87 bool isSubprogram() const;
88 bool isGlobalVariable() const;
91 bool isCompileUnit() const;
92 bool isNameSpace() const;
93 bool isLexicalBlock() const;
94 bool isSubrange() const;
95 bool isEnumerator() const;
97 bool isGlobal() const;
100 /// DISubrange - This is used to represent ranges, for array bounds.
101 class DISubrange : public DIDescriptor {
103 explicit DISubrange(MDNode *N = 0) : DIDescriptor(N) {}
105 int64_t getLo() const { return (int64_t)getUInt64Field(1); }
106 int64_t getHi() const { return (int64_t)getUInt64Field(2); }
109 /// DIArray - This descriptor holds an array of descriptors.
110 class DIArray : public DIDescriptor {
112 explicit DIArray(MDNode *N = 0)
115 unsigned getNumElements() const;
116 DIDescriptor getElement(unsigned Idx) const {
117 return getDescriptorField(Idx);
121 /// DIScope - A base class for various scopes.
122 class DIScope : public DIDescriptor {
124 explicit DIScope(MDNode *N = 0) : DIDescriptor (N) {}
125 virtual ~DIScope() {}
127 StringRef getFilename() const;
128 StringRef getDirectory() const;
131 /// DICompileUnit - A wrapper for a compile unit.
132 class DICompileUnit : public DIScope {
134 explicit DICompileUnit(MDNode *N = 0) : DIScope(N) {}
136 unsigned getLanguage() const { return getUnsignedField(2); }
137 StringRef getFilename() const { return getStringField(3); }
138 StringRef getDirectory() const { return getStringField(4); }
139 StringRef getProducer() const { return getStringField(5); }
141 /// isMain - Each input file is encoded as a separate compile unit in LLVM
142 /// debugging information output. However, many target specific tool chains
143 /// prefer to encode only one compile unit in an object file. In this
144 /// situation, the LLVM code generator will include debugging information
145 /// entities in the compile unit that is marked as main compile unit. The
146 /// code generator accepts maximum one main compile unit per module. If a
147 /// module does not contain any main compile unit then the code generator
148 /// will emit multiple compile units in the output object file.
150 bool isMain() const { return getUnsignedField(6); }
151 bool isOptimized() const { return getUnsignedField(7); }
152 StringRef getFlags() const { return getStringField(8); }
153 unsigned getRunTimeVersion() const { return getUnsignedField(9); }
155 /// Verify - Verify that a compile unit is well formed.
158 /// dump - print compile unit.
162 /// DIFile - This is a wrapper for a file.
163 class DIFile : public DIScope {
165 explicit DIFile(MDNode *N = 0) : DIScope(N) {
166 if (DbgNode && !isFile())
169 StringRef getFilename() const { return getStringField(1); }
170 StringRef getDirectory() const { return getStringField(2); }
171 DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
174 /// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
175 /// FIXME: it seems strange that this doesn't have either a reference to the
176 /// type/precision or a file/line pair for location info.
177 class DIEnumerator : public DIDescriptor {
179 explicit DIEnumerator(MDNode *N = 0) : DIDescriptor(N) {}
181 StringRef getName() const { return getStringField(1); }
182 uint64_t getEnumValue() const { return getUInt64Field(2); }
185 /// DIType - This is a wrapper for a type.
186 /// FIXME: Types should be factored much better so that CV qualifiers and
187 /// others do not require a huge and empty descriptor full of zeros.
188 class DIType : public DIScope {
191 FlagPrivate = 1 << 0,
192 FlagProtected = 1 << 1,
193 FlagFwdDecl = 1 << 2,
194 FlagAppleBlock = 1 << 3,
195 FlagBlockByrefStruct = 1 << 4,
196 FlagVirtual = 1 << 5,
197 FlagArtificial = 1 << 6 // To identify artificial arguments in
198 // a subroutine type. e.g. "this" in c++.
202 // This ctor is used when the Tag has already been validated by a derived
204 DIType(MDNode *N, bool, bool) : DIScope(N) {}
208 /// Verify - Verify that a type descriptor is well formed.
211 explicit DIType(MDNode *N);
215 DIScope getContext() const { return getFieldAs<DIScope>(1); }
216 StringRef getName() const { return getStringField(2); }
217 DICompileUnit getCompileUnit() const{
218 if (getVersion() == llvm::LLVMDebugVersion7)
219 return getFieldAs<DICompileUnit>(3);
221 DIFile F = getFieldAs<DIFile>(3);
222 return F.getCompileUnit();
224 unsigned getLineNumber() const { return getUnsignedField(4); }
225 uint64_t getSizeInBits() const { return getUInt64Field(5); }
226 uint64_t getAlignInBits() const { return getUInt64Field(6); }
227 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
228 // carry this is just plain insane.
229 uint64_t getOffsetInBits() const { return getUInt64Field(7); }
230 unsigned getFlags() const { return getUnsignedField(8); }
231 bool isPrivate() const {
232 return (getFlags() & FlagPrivate) != 0;
234 bool isProtected() const {
235 return (getFlags() & FlagProtected) != 0;
237 bool isForwardDecl() const {
238 return (getFlags() & FlagFwdDecl) != 0;
240 // isAppleBlock - Return true if this is the Apple Blocks extension.
241 bool isAppleBlockExtension() const {
242 return (getFlags() & FlagAppleBlock) != 0;
244 bool isBlockByrefStruct() const {
245 return (getFlags() & FlagBlockByrefStruct) != 0;
247 bool isVirtual() const {
248 return (getFlags() & FlagVirtual) != 0;
250 bool isArtificial() const {
251 return (getFlags() & FlagArtificial) != 0;
253 bool isValid() const {
254 return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
256 StringRef getFilename() const { return getCompileUnit().getFilename();}
257 StringRef getDirectory() const { return getCompileUnit().getDirectory();}
258 /// dump - print type.
262 /// DIBasicType - A basic type, like 'int' or 'float'.
263 class DIBasicType : public DIType {
265 explicit DIBasicType(MDNode *N = 0) : DIType(N) {}
267 unsigned getEncoding() const { return getUnsignedField(9); }
269 /// dump - print basic type.
273 /// DIDerivedType - A simple derived type, like a const qualified type,
274 /// a typedef, a pointer or reference, etc.
275 class DIDerivedType : public DIType {
277 explicit DIDerivedType(MDNode *N, bool, bool)
278 : DIType(N, true, true) {}
280 explicit DIDerivedType(MDNode *N = 0)
281 : DIType(N, true, true) {}
283 DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
285 /// getOriginalTypeSize - If this type is derived from a base type then
286 /// return base type size.
287 uint64_t getOriginalTypeSize() const;
288 /// dump - print derived type.
291 /// replaceAllUsesWith - Replace all uses of debug info referenced by
292 /// this descriptor. After this completes, the current debug info value
294 void replaceAllUsesWith(DIDescriptor &D);
297 /// DICompositeType - This descriptor holds a type that can refer to multiple
298 /// other types, like a function or struct.
299 /// FIXME: Why is this a DIDerivedType??
300 class DICompositeType : public DIDerivedType {
302 explicit DICompositeType(MDNode *N = 0)
303 : DIDerivedType(N, true, true) {
304 if (N && !isCompositeType())
308 DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
309 unsigned getRunTimeLang() const { return getUnsignedField(11); }
310 DICompositeType getContainingType() const {
311 return getFieldAs<DICompositeType>(12);
314 /// Verify - Verify that a composite type descriptor is well formed.
317 /// dump - print composite type.
321 /// DIGlobal - This is a common class for global variables and subprograms.
322 class DIGlobal : public DIDescriptor {
324 explicit DIGlobal(MDNode *N) : DIDescriptor(N) {}
327 virtual ~DIGlobal() {}
329 DIScope getContext() const { return getFieldAs<DIScope>(2); }
330 StringRef getName() const { return getStringField(3); }
331 StringRef getDisplayName() const { return getStringField(4); }
332 StringRef getLinkageName() const { return getStringField(5); }
333 DICompileUnit getCompileUnit() const{
334 if (getVersion() == llvm::LLVMDebugVersion7)
335 return getFieldAs<DICompileUnit>(6);
337 DIFile F = getFieldAs<DIFile>(6);
338 return F.getCompileUnit();
341 unsigned getLineNumber() const { return getUnsignedField(7); }
342 DIType getType() const { return getFieldAs<DIType>(8); }
344 /// isLocalToUnit - Return true if this subprogram is local to the current
345 /// compile unit, like 'static' in C.
346 unsigned isLocalToUnit() const { return getUnsignedField(9); }
347 unsigned isDefinition() const { return getUnsignedField(10); }
349 /// dump - print global.
353 /// DISubprogram - This is a wrapper for a subprogram (e.g. a function).
354 class DISubprogram : public DIScope {
356 explicit DISubprogram(MDNode *N = 0) : DIScope(N) {}
358 DIScope getContext() const { return getFieldAs<DIScope>(2); }
359 StringRef getName() const { return getStringField(3); }
360 StringRef getDisplayName() const { return getStringField(4); }
361 StringRef getLinkageName() const { return getStringField(5); }
362 DICompileUnit getCompileUnit() const{
363 if (getVersion() == llvm::LLVMDebugVersion7)
364 return getFieldAs<DICompileUnit>(6);
366 DIFile F = getFieldAs<DIFile>(6);
367 return F.getCompileUnit();
369 unsigned getLineNumber() const { return getUnsignedField(7); }
370 DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
372 /// getReturnTypeName - Subprogram return types are encoded either as
373 /// DIType or as DICompositeType.
374 StringRef getReturnTypeName() const {
375 DICompositeType DCT(getFieldAs<DICompositeType>(8));
377 DIArray A = DCT.getTypeArray();
378 DIType T(A.getElement(0).getNode());
381 DIType T(getFieldAs<DIType>(8));
385 /// isLocalToUnit - Return true if this subprogram is local to the current
386 /// compile unit, like 'static' in C.
387 unsigned isLocalToUnit() const { return getUnsignedField(9); }
388 unsigned isDefinition() const { return getUnsignedField(10); }
390 unsigned getVirtuality() const { return getUnsignedField(11); }
391 unsigned getVirtualIndex() const { return getUnsignedField(12); }
393 DICompositeType getContainingType() const {
394 return getFieldAs<DICompositeType>(13);
396 unsigned isArtificial() const { return getUnsignedField(14); }
398 StringRef getFilename() const { return getCompileUnit().getFilename();}
399 StringRef getDirectory() const { return getCompileUnit().getDirectory();}
401 /// Verify - Verify that a subprogram descriptor is well formed.
404 /// dump - print subprogram.
407 /// describes - Return true if this subprogram provides debugging
408 /// information for the function F.
409 bool describes(const Function *F);
412 /// DIGlobalVariable - This is a wrapper for a global variable.
413 class DIGlobalVariable : public DIGlobal {
415 explicit DIGlobalVariable(MDNode *N = 0) : DIGlobal(N) {}
417 GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
419 /// Verify - Verify that a global variable descriptor is well formed.
422 /// dump - print global variable.
426 /// DIVariable - This is a wrapper for a variable (e.g. parameter, local,
428 class DIVariable : public DIDescriptor {
430 explicit DIVariable(MDNode *N = 0)
433 DIScope getContext() const { return getFieldAs<DIScope>(1); }
434 StringRef getName() const { return getStringField(2); }
435 DICompileUnit getCompileUnit() const{
436 if (getVersion() == llvm::LLVMDebugVersion7)
437 return getFieldAs<DICompileUnit>(3);
439 DIFile F = getFieldAs<DIFile>(3);
440 return F.getCompileUnit();
442 unsigned getLineNumber() const { return getUnsignedField(4); }
443 DIType getType() const { return getFieldAs<DIType>(5); }
446 /// Verify - Verify that a variable descriptor is well formed.
449 /// HasComplexAddr - Return true if the variable has a complex address.
450 bool hasComplexAddress() const {
451 return getNumAddrElements() > 0;
454 unsigned getNumAddrElements() const;
456 uint64_t getAddrElement(unsigned Idx) const {
457 return getUInt64Field(Idx+6);
460 /// isBlockByrefVariable - Return true if the variable was declared as
461 /// a "__block" variable (Apple Blocks).
462 bool isBlockByrefVariable() const {
463 return getType().isBlockByrefStruct();
466 /// dump - print variable.
470 /// DILexicalBlock - This is a wrapper for a lexical block.
471 class DILexicalBlock : public DIScope {
473 explicit DILexicalBlock(MDNode *N = 0) : DIScope(N) {}
474 DIScope getContext() const { return getFieldAs<DIScope>(1); }
475 StringRef getDirectory() const { return getContext().getDirectory(); }
476 StringRef getFilename() const { return getContext().getFilename(); }
477 unsigned getLineNumber() const { return getUnsignedField(2); }
478 unsigned getColumnNumber() const { return getUnsignedField(3); }
481 /// DINameSpace - A wrapper for a C++ style name space.
482 class DINameSpace : public DIScope {
484 explicit DINameSpace(MDNode *N = 0) : DIScope(N) {}
485 DIScope getContext() const { return getFieldAs<DIScope>(1); }
486 StringRef getName() const { return getStringField(2); }
487 StringRef getDirectory() const { return getContext().getDirectory(); }
488 StringRef getFilename() const { return getContext().getFilename(); }
489 DICompileUnit getCompileUnit() const{
490 if (getVersion() == llvm::LLVMDebugVersion7)
491 return getFieldAs<DICompileUnit>(3);
493 DIFile F = getFieldAs<DIFile>(3);
494 return F.getCompileUnit();
496 unsigned getLineNumber() const { return getUnsignedField(4); }
499 /// DILocation - This object holds location information. This object
500 /// is not associated with any DWARF tag.
501 class DILocation : public DIDescriptor {
503 explicit DILocation(MDNode *N) : DIDescriptor(N) { }
505 unsigned getLineNumber() const { return getUnsignedField(0); }
506 unsigned getColumnNumber() const { return getUnsignedField(1); }
507 DIScope getScope() const { return getFieldAs<DIScope>(2); }
508 DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }
509 StringRef getFilename() const { return getScope().getFilename(); }
510 StringRef getDirectory() const { return getScope().getDirectory(); }
514 /// DIFactory - This object assists with the construction of the various
518 LLVMContext& VMContext;
520 Function *DeclareFn; // llvm.dbg.declare
521 Function *ValueFn; // llvm.dbg.value
523 DIFactory(const DIFactory &); // DO NOT IMPLEMENT
524 void operator=(const DIFactory&); // DO NOT IMPLEMENT
526 enum ComplexAddrKind { OpPlus=1, OpDeref };
528 explicit DIFactory(Module &m);
530 /// GetOrCreateArray - Create an descriptor for an array of descriptors.
531 /// This implicitly uniques the arrays created.
532 DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys);
534 /// GetOrCreateSubrange - Create a descriptor for a value range. This
535 /// implicitly uniques the values returned.
536 DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi);
538 /// CreateCompileUnit - Create a new descriptor for the specified compile
540 DICompileUnit CreateCompileUnit(unsigned LangID,
545 bool isOptimized = false,
546 StringRef Flags = "",
547 unsigned RunTimeVer = 0);
549 /// CreateFile - Create a new descriptor for the specified file.
550 DIFile CreateFile(StringRef Filename, StringRef Directory, DICompileUnit CU);
552 /// CreateEnumerator - Create a single enumerator value.
553 DIEnumerator CreateEnumerator(StringRef Name, uint64_t Val);
555 /// CreateBasicType - Create a basic type like int, float, etc.
556 DIBasicType CreateBasicType(DIDescriptor Context, StringRef Name,
557 DIFile F, unsigned LineNumber,
558 uint64_t SizeInBits, uint64_t AlignInBits,
559 uint64_t OffsetInBits, unsigned Flags,
562 /// CreateBasicType - Create a basic type like int, float, etc.
563 DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name,
564 DIFile F, unsigned LineNumber,
565 Constant *SizeInBits, Constant *AlignInBits,
566 Constant *OffsetInBits, unsigned Flags,
569 /// CreateDerivedType - Create a derived type like const qualified type,
570 /// pointer, typedef, etc.
571 DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
575 uint64_t SizeInBits, uint64_t AlignInBits,
576 uint64_t OffsetInBits, unsigned Flags,
579 /// CreateDerivedType - Create a derived type like const qualified type,
580 /// pointer, typedef, etc.
581 DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context,
585 Constant *SizeInBits,
586 Constant *AlignInBits,
587 Constant *OffsetInBits, unsigned Flags,
590 /// CreateCompositeType - Create a composite type like array, struct, etc.
591 DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
596 uint64_t AlignInBits,
597 uint64_t OffsetInBits, unsigned Flags,
600 unsigned RunTimeLang = 0,
601 MDNode *ContainingType = 0);
603 /// CreateArtificialType - Create a new DIType with "artificial" flag set.
604 DIType CreateArtificialType(DIType Ty);
606 /// CreateCompositeType - Create a composite type like array, struct, etc.
607 DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
611 Constant *SizeInBits,
612 Constant *AlignInBits,
613 Constant *OffsetInBits,
617 unsigned RunTimeLang = 0);
619 /// CreateSubprogram - Create a new descriptor for the specified subprogram.
620 /// See comments in DISubprogram for descriptions of these fields.
621 DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
622 StringRef DisplayName,
623 StringRef LinkageName,
624 DIFile F, unsigned LineNo,
625 DIType Ty, bool isLocalToUnit,
630 bool isArtificial = 0);
632 /// CreateSubprogramDefinition - Create new subprogram descriptor for the
633 /// given declaration.
634 DISubprogram CreateSubprogramDefinition(DISubprogram &SPDeclaration);
636 /// CreateGlobalVariable - Create a new descriptor for the specified global.
638 CreateGlobalVariable(DIDescriptor Context, StringRef Name,
639 StringRef DisplayName,
640 StringRef LinkageName,
642 unsigned LineNo, DIType Ty, bool isLocalToUnit,
643 bool isDefinition, llvm::GlobalVariable *GV);
645 /// CreateVariable - Create a new descriptor for the specified variable.
646 DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
648 DIFile F, unsigned LineNo,
651 /// CreateComplexVariable - Create a new descriptor for the specified
652 /// variable which has a complex address expression for its address.
653 DIVariable CreateComplexVariable(unsigned Tag, DIDescriptor Context,
654 const std::string &Name,
655 DIFile F, unsigned LineNo,
657 SmallVector<Value *, 9> &addr);
659 /// CreateLexicalBlock - This creates a descriptor for a lexical block
660 /// with the specified parent context.
661 DILexicalBlock CreateLexicalBlock(DIDescriptor Context, unsigned Line = 0,
664 /// CreateNameSpace - This creates new descriptor for a namespace
665 /// with the specified parent context.
666 DINameSpace CreateNameSpace(DIDescriptor Context, StringRef Name,
667 DIFile F, unsigned LineNo);
669 /// CreateLocation - Creates a debug info location.
670 DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
671 DIScope S, DILocation OrigLoc);
673 /// CreateLocation - Creates a debug info location.
674 DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
675 DIScope S, MDNode *OrigLoc = 0);
677 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
678 Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
679 BasicBlock *InsertAtEnd);
681 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
682 Instruction *InsertDeclare(llvm::Value *Storage, DIVariable D,
683 Instruction *InsertBefore);
685 /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
686 Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
687 DIVariable D, BasicBlock *InsertAtEnd);
689 /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
690 Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
691 DIVariable D, Instruction *InsertBefore);
693 Constant *GetTagConstant(unsigned TAG);
696 bool getLocationInfo(const Value *V, std::string &DisplayName,
697 std::string &Type, unsigned &LineNo, std::string &File,
700 /// ExtractDebugLocation - Extract debug location information
702 DebugLoc ExtractDebugLocation(DILocation &Loc,
703 DebugLocTracker &DebugLocInfo);
705 /// getDISubprogram - Find subprogram that is enclosing this scope.
706 DISubprogram getDISubprogram(MDNode *Scope);
708 /// getDICompositeType - Find underlying composite type.
709 DICompositeType getDICompositeType(DIType T);
711 class DebugInfoFinder {
713 /// processModule - Process entire module and collect debug info
715 void processModule(Module &M);
718 /// processType - Process DIType.
719 void processType(DIType DT);
721 /// processLexicalBlock - Process DILexicalBlock.
722 void processLexicalBlock(DILexicalBlock LB);
724 /// processSubprogram - Process DISubprogram.
725 void processSubprogram(DISubprogram SP);
727 /// processDeclare - Process DbgDeclareInst.
728 void processDeclare(DbgDeclareInst *DDI);
730 /// processLocation - Process DILocation.
731 void processLocation(DILocation Loc);
733 /// addCompileUnit - Add compile unit into CUs.
734 bool addCompileUnit(DICompileUnit CU);
736 /// addGlobalVariable - Add global variable into GVs.
737 bool addGlobalVariable(DIGlobalVariable DIG);
739 // addSubprogram - Add subprgoram into SPs.
740 bool addSubprogram(DISubprogram SP);
742 /// addType - Add type into Tys.
743 bool addType(DIType DT);
746 typedef SmallVector<MDNode *, 8>::iterator iterator;
747 iterator compile_unit_begin() { return CUs.begin(); }
748 iterator compile_unit_end() { return CUs.end(); }
749 iterator subprogram_begin() { return SPs.begin(); }
750 iterator subprogram_end() { return SPs.end(); }
751 iterator global_variable_begin() { return GVs.begin(); }
752 iterator global_variable_end() { return GVs.end(); }
753 iterator type_begin() { return TYs.begin(); }
754 iterator type_end() { return TYs.end(); }
756 unsigned compile_unit_count() { return CUs.size(); }
757 unsigned global_variable_count() { return GVs.size(); }
758 unsigned subprogram_count() { return SPs.size(); }
759 unsigned type_count() { return TYs.size(); }
762 SmallVector<MDNode *, 8> CUs; // Compile Units
763 SmallVector<MDNode *, 8> SPs; // Subprograms
764 SmallVector<MDNode *, 8> GVs; // Global Variables;
765 SmallVector<MDNode *, 8> TYs; // Types
766 SmallPtrSet<MDNode *, 64> NodesSeen;
768 } // end namespace llvm