1 //===- 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_IR_DEBUGINFO_H
18 #define LLVM_IR_DEBUGINFO_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/SmallPtrSet.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/ADT/iterator_range.h"
25 #include "llvm/IR/DebugInfoMetadata.h"
26 #include "llvm/Support/Casting.h"
27 #include "llvm/Support/Dwarf.h"
28 #include "llvm/Support/ErrorHandling.h"
52 class DILexicalBlockFile;
58 /// \brief Maps from type identifier to the actual MDNode.
59 typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;
61 /// \brief A thin wraper around MDNode to access encoded debug info.
63 /// This should not be stored in a container, because the underlying MDNode may
64 /// change in certain situations.
66 // Befriends DIRef so DIRef can befriend the protected member
67 // function: getFieldAs<DIRef>.
68 template <typename T> friend class DIRef;
71 /// \brief Duplicated debug info flags.
73 /// \see DebugNode::DIFlags.
75 #define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = DebugNode::Flag##NAME,
76 #include "llvm/IR/DebugInfoFlags.def"
77 FlagAccessibility = DebugNode::FlagAccessibility
80 static unsigned getFlag(StringRef Flag);
81 static const char *getFlagString(unsigned Flag);
83 /// \brief Split up a flags bitfield.
85 /// Split \c Flags into \c SplitFlags, a vector of its components. Returns
86 /// any remaining (unrecognized) bits.
87 static unsigned splitFlags(unsigned Flags,
88 SmallVectorImpl<unsigned> &SplitFlags);
91 const MDNode *DbgNode;
93 DIDescriptor getDescriptorField(unsigned Elt) const;
94 template <typename DescTy> DescTy getFieldAs(unsigned Elt) const {
95 return DescTy(getDescriptorField(Elt));
99 explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
101 MDNode *get() const { return const_cast<MDNode *>(DbgNode); }
102 operator MDNode *() const { return get(); }
103 MDNode *operator->() const { return get(); }
104 MDNode &operator*() const {
105 assert(get() && "Expected valid pointer");
109 // An explicit operator bool so that we can do testing of DI values
111 // FIXME: This operator bool isn't actually protecting anything at the
112 // moment due to the conversion operator above making DIDescriptor nodes
113 // implicitly convertable to bool.
114 explicit operator bool() const { return DbgNode != nullptr; }
116 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
117 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
119 uint16_t getTag() const {
120 if (auto *N = dyn_cast_or_null<DebugNode>(get()))
125 bool isDerivedType() const { return get() && isa<MDDerivedTypeBase>(get()); }
126 bool isCompositeType() const {
127 return get() && isa<MDCompositeTypeBase>(get());
129 bool isSubroutineType() const {
130 return get() && isa<MDSubroutineType>(get());
132 bool isBasicType() const { return get() && isa<MDBasicType>(get()); }
133 bool isVariable() const { return get() && isa<MDLocalVariable>(get()); }
134 bool isSubprogram() const { return get() && isa<MDSubprogram>(get()); }
135 bool isGlobalVariable() const {
136 return get() && isa<MDGlobalVariable>(get());
138 bool isScope() const { return get() && isa<MDScope>(get()); }
139 bool isFile() const { return get() && isa<MDFile>(get()); }
140 bool isCompileUnit() const { return get() && isa<MDCompileUnit>(get()); }
141 bool isNameSpace() const{ return get() && isa<MDNamespace>(get()); }
142 bool isLexicalBlockFile() const {
143 return get() && isa<MDLexicalBlockFile>(get());
145 bool isLexicalBlock() const {
146 return get() && isa<MDLexicalBlockBase>(get());
148 bool isSubrange() const { return get() && isa<MDSubrange>(get()); }
149 bool isEnumerator() const { return get() && isa<MDEnumerator>(get()); }
150 bool isType() const { return get() && isa<MDType>(get()); }
151 bool isTemplateTypeParameter() const {
152 return get() && isa<MDTemplateTypeParameter>(get());
154 bool isTemplateValueParameter() const {
155 return get() && isa<MDTemplateValueParameter>(get());
157 bool isObjCProperty() const { return get() && isa<MDObjCProperty>(get()); }
158 bool isImportedEntity() const {
159 return get() && isa<MDImportedEntity>(get());
161 bool isExpression() const { return get() && isa<MDExpression>(get()); }
163 void print(raw_ostream &OS) const;
166 /// \brief Replace all uses of debug info referenced by this descriptor.
167 void replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D);
168 void replaceAllUsesWith(MDNode *D);
171 #define DECLARE_SIMPLIFY_DESCRIPTOR(DESC) \
173 template <> struct simplify_type<const DESC>; \
174 template <> struct simplify_type<DESC>;
175 DECLARE_SIMPLIFY_DESCRIPTOR(DIDescriptor)
176 DECLARE_SIMPLIFY_DESCRIPTOR(DISubrange)
177 DECLARE_SIMPLIFY_DESCRIPTOR(DIEnumerator)
178 DECLARE_SIMPLIFY_DESCRIPTOR(DIScope)
179 DECLARE_SIMPLIFY_DESCRIPTOR(DIType)
180 DECLARE_SIMPLIFY_DESCRIPTOR(DIBasicType)
181 DECLARE_SIMPLIFY_DESCRIPTOR(DIDerivedType)
182 DECLARE_SIMPLIFY_DESCRIPTOR(DICompositeType)
183 DECLARE_SIMPLIFY_DESCRIPTOR(DISubroutineType)
184 DECLARE_SIMPLIFY_DESCRIPTOR(DIFile)
185 DECLARE_SIMPLIFY_DESCRIPTOR(DICompileUnit)
186 DECLARE_SIMPLIFY_DESCRIPTOR(DISubprogram)
187 DECLARE_SIMPLIFY_DESCRIPTOR(DILexicalBlock)
188 DECLARE_SIMPLIFY_DESCRIPTOR(DILexicalBlockFile)
189 DECLARE_SIMPLIFY_DESCRIPTOR(DINameSpace)
190 DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
191 DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
192 DECLARE_SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
193 DECLARE_SIMPLIFY_DESCRIPTOR(DIVariable)
194 DECLARE_SIMPLIFY_DESCRIPTOR(DIExpression)
195 DECLARE_SIMPLIFY_DESCRIPTOR(DILocation)
196 DECLARE_SIMPLIFY_DESCRIPTOR(DIObjCProperty)
197 DECLARE_SIMPLIFY_DESCRIPTOR(DIImportedEntity)
198 #undef DECLARE_SIMPLIFY_DESCRIPTOR
200 /// \brief This is used to represent ranges, for array bounds.
201 class DISubrange : public DIDescriptor {
203 explicit DISubrange(const MDNode *N = nullptr) : DIDescriptor(N) {}
204 DISubrange(const MDSubrange *N) : DIDescriptor(N) {}
206 MDSubrange *get() const {
207 return cast_or_null<MDSubrange>(DIDescriptor::get());
209 operator MDSubrange *() const { return get(); }
210 MDSubrange *operator->() const { return get(); }
211 MDSubrange &operator*() const {
212 assert(get() && "Expected valid pointer");
216 int64_t getLo() const { return get()->getLo(); }
217 int64_t getCount() const { return get()->getCount(); }
220 /// \brief This descriptor holds an array of nodes with type T.
221 template <typename T> class DITypedArray : public DIDescriptor {
223 explicit DITypedArray(const MDNode *N = nullptr) : DIDescriptor(N) {}
224 operator MDTuple *() const {
225 return const_cast<MDTuple *>(cast_or_null<MDTuple>(DbgNode));
227 unsigned getNumElements() const {
228 return DbgNode ? DbgNode->getNumOperands() : 0;
230 T getElement(unsigned Idx) const { return getFieldAs<T>(Idx); }
233 typedef DITypedArray<DIDescriptor> DIArray;
235 /// \brief A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
237 /// FIXME: it seems strange that this doesn't have either a reference to the
238 /// type/precision or a file/line pair for location info.
239 class DIEnumerator : public DIDescriptor {
241 explicit DIEnumerator(const MDNode *N = nullptr) : DIDescriptor(N) {}
242 DIEnumerator(const MDEnumerator *N) : DIDescriptor(N) {}
244 MDEnumerator *get() const {
245 return cast_or_null<MDEnumerator>(DIDescriptor::get());
247 operator MDEnumerator *() const { return get(); }
248 MDEnumerator *operator->() const { return get(); }
249 MDEnumerator &operator*() const {
250 assert(get() && "Expected valid pointer");
254 StringRef getName() const { return get()->getName(); }
255 int64_t getEnumValue() const { return get()->getValue(); }
258 template <typename T> class DIRef;
259 typedef DIRef<DIDescriptor> DIDescriptorRef;
260 typedef DIRef<DIScope> DIScopeRef;
261 typedef DIRef<DIType> DITypeRef;
262 typedef DITypedArray<DITypeRef> DITypeArray;
264 /// \brief A base class for various scopes.
266 /// Although, implementation-wise, DIScope is the parent class of most
267 /// other DIxxx classes, including DIType and its descendants, most of
268 /// DIScope's descendants are not a substitutable subtype of
269 /// DIScope. The DIDescriptor::isScope() method only is true for
270 /// DIScopes that are scopes in the strict lexical scope sense
271 /// (DICompileUnit, DISubprogram, etc.), but not for, e.g., a DIType.
272 class DIScope : public DIDescriptor {
274 explicit DIScope(const MDNode *N = nullptr) : DIDescriptor(N) {}
275 DIScope(const MDScope *N) : DIDescriptor(N) {}
277 MDScope *get() const { return cast_or_null<MDScope>(DIDescriptor::get()); }
278 operator MDScope *() const { return get(); }
279 MDScope *operator->() const { return get(); }
280 MDScope &operator*() const {
281 assert(get() && "Expected valid pointer");
285 /// \brief Get the parent scope.
287 /// Gets the parent scope for this scope node or returns a default
288 /// constructed scope.
289 DIScopeRef getContext() const;
290 /// \brief Get the scope name.
292 /// If the scope node has a name, return that, else return an empty string.
293 StringRef getName() const;
294 StringRef getFilename() const;
295 StringRef getDirectory() const;
297 /// \brief Generate a reference to this DIScope.
299 /// Uses the type identifier instead of the actual MDNode if possible, to
300 /// help type uniquing.
301 DIScopeRef getRef() const;
304 /// \brief Represents reference to a DIDescriptor.
306 /// Abstracts over direct and identifier-based metadata references.
307 template <typename T> class DIRef {
308 template <typename DescTy>
309 friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
310 friend DIScopeRef DIScope::getContext() const;
311 friend DIScopeRef DIScope::getRef() const;
314 /// \brief Val can be either a MDNode or a MDString.
316 /// In the latter, MDString specifies the type identifier.
318 explicit DIRef(const Metadata *V);
322 DIRef(const TypedDebugNodeRef<U> &Ref,
323 typename std::enable_if<std::is_convertible<U *, T>::value>::type * =
327 T resolve(const DITypeIdentifierMap &Map) const;
328 operator Metadata *() const { return const_cast<Metadata *>(Val); }
330 static DIRef get(const Metadata *MD) { return DIRef(MD); }
334 DIDescriptor DIRef<DIDescriptor>::resolve(const DITypeIdentifierMap &Map) const;
336 DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const;
337 template <> DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const;
339 /// \brief Handle fields that are references to DIDescriptors.
341 DIDescriptorRef DIDescriptor::getFieldAs<DIDescriptorRef>(unsigned Elt) const;
342 /// \brief Specialize DIRef constructor for DIDescriptorRef.
343 template <> DIRef<DIDescriptor>::DIRef(const Metadata *V);
345 /// \brief Handle fields that are references to DIScopes.
346 template <> DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const;
347 /// \brief Specialize DIRef constructor for DIScopeRef.
348 template <> DIRef<DIScope>::DIRef(const Metadata *V);
350 /// \brief Handle fields that are references to DITypes.
351 template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const;
352 /// \brief Specialize DIRef constructor for DITypeRef.
353 template <> DIRef<DIType>::DIRef(const Metadata *V);
355 /// \brief This is a wrapper for a type.
357 /// FIXME: Types should be factored much better so that CV qualifiers and
358 /// others do not require a huge and empty descriptor full of zeros.
359 class DIType : public DIScope {
361 explicit DIType(const MDNode *N = nullptr) : DIScope(N) {}
362 DIType(const MDType *N) : DIScope(N) {}
364 MDType *get() const { return cast_or_null<MDType>(DIDescriptor::get()); }
365 operator MDType *() const { return get(); }
366 MDType *operator->() const { return get(); }
367 MDType &operator*() const {
368 assert(get() && "Expected valid pointer");
372 DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
373 StringRef getName() const { return get()->getName(); }
374 unsigned getLineNumber() const { return get()->getLine(); }
375 uint64_t getSizeInBits() const { return get()->getSizeInBits(); }
376 uint64_t getAlignInBits() const { return get()->getAlignInBits(); }
377 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
378 // carry this is just plain insane.
379 uint64_t getOffsetInBits() const { return get()->getOffsetInBits(); }
380 unsigned getFlags() const { return get()->getFlags(); }
381 bool isPrivate() const {
382 return (getFlags() & FlagAccessibility) == FlagPrivate;
384 bool isProtected() const {
385 return (getFlags() & FlagAccessibility) == FlagProtected;
387 bool isPublic() const {
388 return (getFlags() & FlagAccessibility) == FlagPublic;
390 bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
391 bool isAppleBlockExtension() const {
392 return (getFlags() & FlagAppleBlock) != 0;
394 bool isBlockByrefStruct() const {
395 return (getFlags() & FlagBlockByrefStruct) != 0;
397 bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; }
398 bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
399 bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; }
400 bool isObjcClassComplete() const {
401 return (getFlags() & FlagObjcClassComplete) != 0;
403 bool isVector() const { return (getFlags() & FlagVector) != 0; }
404 bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
405 bool isLValueReference() const {
406 return (getFlags() & FlagLValueReference) != 0;
408 bool isRValueReference() const {
409 return (getFlags() & FlagRValueReference) != 0;
411 bool isValid() const { return DbgNode && isType(); }
414 /// \brief A basic type, like 'int' or 'float'.
415 class DIBasicType : public DIType {
417 explicit DIBasicType(const MDNode *N = nullptr) : DIType(N) {}
418 DIBasicType(const MDBasicType *N) : DIType(N) {}
420 MDBasicType *get() const {
421 return cast_or_null<MDBasicType>(DIDescriptor::get());
423 operator MDBasicType *() const { return get(); }
424 MDBasicType *operator->() const { return get(); }
425 MDBasicType &operator*() const {
426 assert(get() && "Expected valid pointer");
430 unsigned getEncoding() const { return get()->getEncoding(); }
433 /// \brief A simple derived type
435 /// Like a const qualified type, a typedef, a pointer or reference, et cetera.
436 /// Or, a data member of a class/struct/union.
437 class DIDerivedType : public DIType {
439 explicit DIDerivedType(const MDNode *N = nullptr) : DIType(N) {}
440 DIDerivedType(const MDDerivedTypeBase *N) : DIType(N) {}
442 MDDerivedTypeBase *get() const {
443 return cast_or_null<MDDerivedTypeBase>(DIDescriptor::get());
445 operator MDDerivedTypeBase *() const { return get(); }
446 MDDerivedTypeBase *operator->() const { return get(); }
447 MDDerivedTypeBase &operator*() const {
448 assert(get() && "Expected valid pointer");
452 DITypeRef getTypeDerivedFrom() const {
453 return DITypeRef::get(get()->getBaseType());
456 /// \brief Return property node, if this ivar is associated with one.
457 MDNode *getObjCProperty() const {
458 if (auto *N = dyn_cast<MDDerivedType>(get()))
459 return dyn_cast_or_null<MDNode>(N->getExtraData());
463 DITypeRef getClassType() const {
464 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
465 if (auto *N = dyn_cast<MDDerivedType>(get()))
466 return DITypeRef::get(N->getExtraData());
467 return DITypeRef::get(nullptr);
470 Constant *getConstant() const {
471 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
472 if (auto *N = dyn_cast<MDDerivedType>(get()))
473 if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getExtraData()))
474 return C->getValue();
480 /// \brief Types that refer to multiple other types.
482 /// This descriptor holds a type that can refer to multiple other types, like a
483 /// function or struct.
485 /// DICompositeType is derived from DIDerivedType because some
486 /// composite types (such as enums) can be derived from basic types
487 // FIXME: Make this derive from DIType directly & just store the
488 // base type in a single DIType field.
489 class DICompositeType : public DIDerivedType {
490 friend class DIBuilder;
492 /// \brief Set the array of member DITypes.
493 void setArraysHelper(MDNode *Elements, MDNode *TParams);
496 explicit DICompositeType(const MDNode *N = nullptr) : DIDerivedType(N) {}
497 DICompositeType(const MDCompositeTypeBase *N) : DIDerivedType(N) {}
499 MDCompositeTypeBase *get() const {
500 return cast_or_null<MDCompositeTypeBase>(DIDescriptor::get());
502 operator MDCompositeTypeBase *() const { return get(); }
503 MDCompositeTypeBase *operator->() const { return get(); }
504 MDCompositeTypeBase &operator*() const {
505 assert(get() && "Expected valid pointer");
509 DIArray getElements() const {
510 assert(!isSubroutineType() && "no elements for DISubroutineType");
511 return DIArray(get()->getElements());
515 template <typename T>
516 void setArrays(DITypedArray<T> Elements, DIArray TParams = DIArray()) {
518 (!TParams || DbgNode->getNumOperands() == 8) &&
519 "If you're setting the template parameters this should include a slot "
521 setArraysHelper(Elements, TParams);
525 unsigned getRunTimeLang() const { return get()->getRuntimeLang(); }
526 DITypeRef getContainingType() const {
527 return DITypeRef::get(get()->getVTableHolder());
531 /// \brief Set the containing type.
532 void setContainingType(DICompositeType ContainingType);
535 DIArray getTemplateParams() const {
536 return DIArray(get()->getTemplateParams());
538 MDString *getIdentifier() const { return get()->getRawIdentifier(); }
541 class DISubroutineType : public DICompositeType {
543 explicit DISubroutineType(const MDNode *N = nullptr) : DICompositeType(N) {}
544 DISubroutineType(const MDSubroutineType *N) : DICompositeType(N) {}
546 MDSubroutineType *get() const {
547 return cast_or_null<MDSubroutineType>(DIDescriptor::get());
549 operator MDSubroutineType *() const { return get(); }
550 MDSubroutineType *operator->() const { return get(); }
551 MDSubroutineType &operator*() const {
552 assert(get() && "Expected valid pointer");
556 DITypedArray<DITypeRef> getTypeArray() const {
557 return DITypedArray<DITypeRef>(get()->getTypeArray());
561 /// \brief This is a wrapper for a file.
562 class DIFile : public DIScope {
564 explicit DIFile(const MDNode *N = nullptr) : DIScope(N) {}
565 DIFile(const MDFile *N) : DIScope(N) {}
567 MDFile *get() const { return cast_or_null<MDFile>(DIDescriptor::get()); }
568 operator MDFile *() const { return get(); }
569 MDFile *operator->() const { return get(); }
570 MDFile &operator*() const {
571 assert(get() && "Expected valid pointer");
575 /// \brief Retrieve the MDNode for the directory/file pair.
576 MDNode *getFileNode() const { return get(); }
579 /// \brief A wrapper for a compile unit.
580 class DICompileUnit : public DIScope {
582 explicit DICompileUnit(const MDNode *N = nullptr) : DIScope(N) {}
583 DICompileUnit(const MDCompileUnit *N) : DIScope(N) {}
585 MDCompileUnit *get() const {
586 return cast_or_null<MDCompileUnit>(DIDescriptor::get());
588 operator MDCompileUnit *() const { return get(); }
589 MDCompileUnit *operator->() const { return get(); }
590 MDCompileUnit &operator*() const {
591 assert(get() && "Expected valid pointer");
595 dwarf::SourceLanguage getLanguage() const {
596 return static_cast<dwarf::SourceLanguage>(get()->getSourceLanguage());
598 StringRef getProducer() const { return get()->getProducer(); }
599 bool isOptimized() const { return get()->isOptimized(); }
600 StringRef getFlags() const { return get()->getFlags(); }
601 unsigned getRunTimeVersion() const { return get()->getRuntimeVersion(); }
603 DIArray getEnumTypes() const { return DIArray(get()->getEnumTypes()); }
604 DIArray getRetainedTypes() const {
605 return DIArray(get()->getRetainedTypes());
607 DIArray getSubprograms() const { return DIArray(get()->getSubprograms()); }
608 DIArray getGlobalVariables() const {
609 return DIArray(get()->getGlobalVariables());
611 DIArray getImportedEntities() const {
612 return DIArray(get()->getImportedEntities());
615 void replaceSubprograms(DIArray Subprograms);
616 void replaceGlobalVariables(DIArray GlobalVariables);
618 StringRef getSplitDebugFilename() const {
619 return get()->getSplitDebugFilename();
621 unsigned getEmissionKind() const { return get()->getEmissionKind(); }
624 /// \brief This is a wrapper for a subprogram (e.g. a function).
625 class DISubprogram : public DIScope {
627 explicit DISubprogram(const MDNode *N = nullptr) : DIScope(N) {}
628 DISubprogram(const MDSubprogram *N) : DIScope(N) {}
630 MDSubprogram *get() const {
631 return cast_or_null<MDSubprogram>(DIDescriptor::get());
633 operator MDSubprogram *() const { return get(); }
634 MDSubprogram *operator->() const { return get(); }
635 MDSubprogram &operator*() const {
636 assert(get() && "Expected valid pointer");
640 StringRef getName() const { return get()->getName(); }
641 StringRef getDisplayName() const { return get()->getDisplayName(); }
642 StringRef getLinkageName() const { return get()->getLinkageName(); }
643 unsigned getLineNumber() const { return get()->getLine(); }
645 /// \brief Check if this is local (like 'static' in C).
646 unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
647 unsigned isDefinition() const { return get()->isDefinition(); }
649 unsigned getVirtuality() const { return get()->getVirtuality(); }
650 unsigned getVirtualIndex() const { return get()->getVirtualIndex(); }
652 unsigned getFlags() const { return get()->getFlags(); }
654 unsigned isOptimized() const { return get()->isOptimized(); }
656 /// \brief Get the beginning of the scope of the function (not the name).
657 unsigned getScopeLineNumber() const { return get()->getScopeLine(); }
659 DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
660 DISubroutineType getType() const {
661 return DISubroutineType(get()->getType());
664 DITypeRef getContainingType() const {
665 return DITypeRef::get(get()->getContainingType());
668 /// \brief Check if this provides debugging information for the function F.
669 bool describes(const Function *F);
671 Function *getFunction() const;
673 void replaceFunction(Function *F) {
675 N->replaceFunction(F);
677 DIArray getTemplateParams() const {
678 return DIArray(get()->getTemplateParams());
680 DISubprogram getFunctionDeclaration() const {
681 return DISubprogram(get()->getDeclaration());
683 MDNode *getVariablesNodes() const { return getVariables(); }
684 DIArray getVariables() const { return DIArray(get()->getVariables()); }
686 unsigned isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
687 /// \brief Check for the "private" access specifier.
688 bool isPrivate() const {
689 return (getFlags() & FlagAccessibility) == FlagPrivate;
691 /// \brief Check for the "protected" access specifier.
692 bool isProtected() const {
693 return (getFlags() & FlagAccessibility) == FlagProtected;
695 /// \brief Check for the "public" access specifier.
696 bool isPublic() const {
697 return (getFlags() & FlagAccessibility) == FlagPublic;
699 /// \brief Check for "explicit".
700 bool isExplicit() const { return (getFlags() & FlagExplicit) != 0; }
701 /// \brief Check if this is prototyped.
702 bool isPrototyped() const { return (getFlags() & FlagPrototyped) != 0; }
704 /// \brief Check if this is reference-qualified.
706 /// Return true if this subprogram is a C++11 reference-qualified non-static
707 /// member function (void foo() &).
708 unsigned isLValueReference() const {
709 return (getFlags() & FlagLValueReference) != 0;
712 /// \brief Check if this is rvalue-reference-qualified.
714 /// Return true if this subprogram is a C++11 rvalue-reference-qualified
715 /// non-static member function (void foo() &&).
716 unsigned isRValueReference() const {
717 return (getFlags() & FlagRValueReference) != 0;
721 /// \brief This is a wrapper for a lexical block.
722 class DILexicalBlock : public DIScope {
724 explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
725 DILexicalBlock(const MDLexicalBlockBase *N) : DIScope(N) {}
727 MDLexicalBlockBase *get() const {
728 return cast_or_null<MDLexicalBlockBase>(DIDescriptor::get());
730 operator MDLexicalBlockBase *() const { return get(); }
731 MDLexicalBlockBase *operator->() const { return get(); }
732 MDLexicalBlockBase &operator*() const {
733 assert(get() && "Expected valid pointer");
737 DIScope getContext() const { return DIScope(get()->getScope()); }
738 unsigned getLineNumber() const {
739 if (auto *N = dyn_cast<MDLexicalBlock>(get()))
743 unsigned getColumnNumber() const {
744 if (auto *N = dyn_cast<MDLexicalBlock>(get()))
745 return N->getColumn();
750 /// \brief This is a wrapper for a lexical block with a filename change.
751 class DILexicalBlockFile : public DIScope {
753 explicit DILexicalBlockFile(const MDNode *N = nullptr) : DIScope(N) {}
754 DILexicalBlockFile(const MDLexicalBlockFile *N) : DIScope(N) {}
756 MDLexicalBlockFile *get() const {
757 return cast_or_null<MDLexicalBlockFile>(DIDescriptor::get());
759 operator MDLexicalBlockFile *() const { return get(); }
760 MDLexicalBlockFile *operator->() const { return get(); }
761 MDLexicalBlockFile &operator*() const {
762 assert(get() && "Expected valid pointer");
766 DIScope getContext() const { return get()->getScope(); }
767 unsigned getDiscriminator() const { return get()->getDiscriminator(); }
770 /// \brief A wrapper for a C++ style name space.
771 class DINameSpace : public DIScope {
773 explicit DINameSpace(const MDNode *N = nullptr) : DIScope(N) {}
774 DINameSpace(const MDNamespace *N) : DIScope(N) {}
776 MDNamespace *get() const {
777 return cast_or_null<MDNamespace>(DIDescriptor::get());
779 operator MDNamespace *() const { return get(); }
780 MDNamespace *operator->() const { return get(); }
781 MDNamespace &operator*() const {
782 assert(get() && "Expected valid pointer");
786 StringRef getName() const { return get()->getName(); }
787 unsigned getLineNumber() const { return get()->getLine(); }
788 DIScope getContext() const { return DIScope(get()->getScope()); }
791 /// \brief This is a wrapper for template type parameter.
792 class DITemplateTypeParameter : public DIDescriptor {
794 explicit DITemplateTypeParameter(const MDNode *N = nullptr)
796 DITemplateTypeParameter(const MDTemplateTypeParameter *N) : DIDescriptor(N) {}
798 MDTemplateTypeParameter *get() const {
799 return cast_or_null<MDTemplateTypeParameter>(DIDescriptor::get());
801 operator MDTemplateTypeParameter *() const { return get(); }
802 MDTemplateTypeParameter *operator->() const { return get(); }
803 MDTemplateTypeParameter &operator*() const {
804 assert(get() && "Expected valid pointer");
808 StringRef getName() const { return get()->getName(); }
810 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
813 /// \brief This is a wrapper for template value parameter.
814 class DITemplateValueParameter : public DIDescriptor {
816 explicit DITemplateValueParameter(const MDNode *N = nullptr)
818 DITemplateValueParameter(const MDTemplateValueParameter *N)
821 MDTemplateValueParameter *get() const {
822 return cast_or_null<MDTemplateValueParameter>(DIDescriptor::get());
824 operator MDTemplateValueParameter *() const { return get(); }
825 MDTemplateValueParameter *operator->() const { return get(); }
826 MDTemplateValueParameter &operator*() const {
827 assert(get() && "Expected valid pointer");
831 StringRef getName() const { return get()->getName(); }
832 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
833 Metadata *getValue() const { return get()->getValue(); }
836 /// \brief This is a wrapper for a global variable.
837 class DIGlobalVariable : public DIDescriptor {
838 DIFile getFile() const { return DIFile(get()->getFile()); }
841 explicit DIGlobalVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
842 DIGlobalVariable(const MDGlobalVariable *N) : DIDescriptor(N) {}
844 MDGlobalVariable *get() const {
845 return cast_or_null<MDGlobalVariable>(DIDescriptor::get());
847 operator MDGlobalVariable *() const { return get(); }
848 MDGlobalVariable *operator->() const { return get(); }
849 MDGlobalVariable &operator*() const {
850 assert(get() && "Expected valid pointer");
854 StringRef getName() const { return get()->getName(); }
855 StringRef getDisplayName() const { return get()->getDisplayName(); }
856 StringRef getLinkageName() const { return get()->getLinkageName(); }
857 unsigned getLineNumber() const { return get()->getLine(); }
858 unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
859 unsigned isDefinition() const { return get()->isDefinition(); }
861 DIScope getContext() const { return DIScope(get()->getScope()); }
862 StringRef getFilename() const { return getFile().getFilename(); }
863 StringRef getDirectory() const { return getFile().getDirectory(); }
864 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
866 GlobalVariable *getGlobal() const;
867 Constant *getConstant() const {
869 if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getVariable()))
870 return C->getValue();
873 DIDerivedType getStaticDataMemberDeclaration() const {
874 return DIDerivedType(get()->getStaticDataMemberDeclaration());
878 /// \brief This is a wrapper for a variable (e.g. parameter, local, global etc).
879 class DIVariable : public DIDescriptor {
880 unsigned getFlags() const { return get()->getFlags(); }
883 explicit DIVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
884 DIVariable(const MDLocalVariable *N) : DIDescriptor(N) {}
886 MDLocalVariable *get() const {
887 return cast_or_null<MDLocalVariable>(DIDescriptor::get());
889 operator MDLocalVariable *() const { return get(); }
890 MDLocalVariable *operator->() const { return get(); }
891 MDLocalVariable &operator*() const {
892 assert(get() && "Expected valid pointer");
896 StringRef getName() const { return get()->getName(); }
897 unsigned getLineNumber() const { return get()->getLine(); }
898 unsigned getArgNumber() const { return get()->getArg(); }
900 DIScope getContext() const { return DIScope(get()->getScope()); }
901 DIFile getFile() const { return DIFile(get()->getFile()); }
902 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
904 /// \brief Return true if this variable is marked as "artificial".
905 bool isArtificial() const {
906 return (getFlags() & FlagArtificial) != 0;
909 bool isObjectPointer() const {
910 return (getFlags() & FlagObjectPointer) != 0;
913 /// \brief If this variable is inlined then return inline location.
914 MDNode *getInlinedAt() const { return DIDescriptor(get()->getInlinedAt()); }
916 /// \brief Check if this is a "__block" variable (Apple Blocks).
917 bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {
918 return (getType().resolve(Map)).isBlockByrefStruct();
921 /// \brief Check if this is an inlined function argument.
922 bool isInlinedFnArgument(const Function *CurFn);
924 /// \brief Return the size reported by the variable's type.
925 unsigned getSizeInBits(const DITypeIdentifierMap &Map);
927 void printExtendedName(raw_ostream &OS) const;
930 /// \brief A complex location expression in postfix notation.
932 /// This is (almost) a DWARF expression that modifies the location of a
933 /// variable or (or the location of a single piece of a variable).
935 /// FIXME: Instead of DW_OP_plus taking an argument, this should use DW_OP_const
936 /// and have DW_OP_plus consume the topmost elements on the stack.
937 class DIExpression : public DIDescriptor {
939 explicit DIExpression(const MDNode *N = nullptr) : DIDescriptor(N) {}
940 DIExpression(const MDExpression *N) : DIDescriptor(N) {}
942 MDExpression *get() const {
943 return cast_or_null<MDExpression>(DIDescriptor::get());
945 operator MDExpression *() const { return get(); }
946 MDExpression *operator->() const { return get(); }
947 MDExpression &operator*() const {
948 assert(get() && "Expected valid pointer");
952 /// \brief Return the number of elements in the complex expression.
953 unsigned getNumElements() const { return get()->getNumElements(); }
955 /// \brief return the Idx'th complex address element.
956 uint64_t getElement(unsigned I) const { return get()->getElement(I); }
958 /// \brief Return whether this is a piece of an aggregate variable.
959 bool isBitPiece() const;
960 /// \brief Return the offset of this piece in bits.
961 uint64_t getBitPieceOffset() const;
962 /// \brief Return the size of this piece in bits.
963 uint64_t getBitPieceSize() const;
966 /// \brief A lightweight wrapper around an element of a DIExpression.
968 friend class iterator;
969 MDExpression::element_iterator I;
971 Operand(MDExpression::element_iterator I) : I(I) {}
973 /// \brief Operands such as DW_OP_piece have explicit (non-stack) arguments.
974 /// Argument 0 is the operand itself.
975 uint64_t getArg(unsigned N) const {
976 MDExpression::element_iterator In = I;
980 operator uint64_t () const { return *I; }
981 /// \brief Returns underlying MDExpression::element_iterator.
982 const MDExpression::element_iterator &getBase() const { return I; }
983 /// \brief Returns the next operand.
984 iterator getNext() const;
987 /// \brief An iterator for DIExpression elements.
988 class iterator : public std::iterator<std::input_iterator_tag, StringRef,
989 unsigned, const Operand*, Operand> {
990 friend class Operand;
991 MDExpression::element_iterator I;
995 iterator(MDExpression::element_iterator I) : I(I) {}
996 const Operand &operator*() { return Tmp = Operand(I); }
997 const Operand *operator->() { return &(Tmp = Operand(I)); }
998 iterator &operator++() {
1002 iterator operator++(int) {
1007 bool operator==(const iterator &X) const { return I == X.I; }
1008 bool operator!=(const iterator &X) const { return !(*this == X); }
1013 case dwarf::DW_OP_bit_piece: std::advance(I, 3); break;
1014 case dwarf::DW_OP_plus: std::advance(I, 2); break;
1015 case dwarf::DW_OP_deref: std::advance(I, 1); break;
1017 llvm_unreachable("unsupported operand");
1022 iterator begin() const { return get()->elements_begin(); }
1023 iterator end() const { return get()->elements_end(); }
1026 /// \brief This object holds location information.
1028 /// This object is not associated with any DWARF tag.
1029 class DILocation : public DIDescriptor {
1031 explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
1032 DILocation(const MDLocation *N) : DIDescriptor(N) {}
1034 MDLocation *get() const {
1035 return cast_or_null<MDLocation>(DIDescriptor::get());
1037 operator MDLocation *() const { return get(); }
1038 MDLocation *operator->() const { return get(); }
1039 MDLocation &operator*() const {
1040 assert(get() && "Expected valid pointer");
1044 unsigned getLineNumber() const { return get()->getLine(); }
1045 unsigned getColumnNumber() const { return get()->getColumn(); }
1046 DIScope getScope() const { return DIScope(get()->getScope()); }
1047 DILocation getOrigLocation() const {
1048 return DILocation(get()->getInlinedAt());
1050 StringRef getFilename() const { return getScope().getFilename(); }
1051 StringRef getDirectory() const { return getScope().getDirectory(); }
1052 bool atSameLineAs(const DILocation &Other) const {
1053 return (getLineNumber() == Other.getLineNumber() &&
1054 getFilename() == Other.getFilename());
1056 /// \brief Get the DWAF discriminator.
1058 /// DWARF discriminators are used to distinguish identical file locations for
1059 /// instructions that are on different basic blocks. If two instructions are
1060 /// inside the same lexical block and are in different basic blocks, we
1061 /// create a new lexical block with identical location as the original but
1062 /// with a different discriminator value
1063 /// (lib/Transforms/Util/AddDiscriminators.cpp for details).
1064 unsigned getDiscriminator() const {
1065 // Since discriminators are associated with lexical blocks, make
1066 // sure this location is a lexical block before retrieving its
1068 if (auto *F = dyn_cast<MDLexicalBlockFile>(get()->getScope()))
1069 return F->getDiscriminator();
1073 /// \brief Generate a new discriminator value for this location.
1074 unsigned computeNewDiscriminator(LLVMContext &Ctx);
1076 /// \brief Return a copy of this location with a different scope.
1077 DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlockFile NewScope);
1080 class DIObjCProperty : public DIDescriptor {
1082 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
1083 DIObjCProperty(const MDObjCProperty *N) : DIDescriptor(N) {}
1085 MDObjCProperty *get() const {
1086 return cast_or_null<MDObjCProperty>(DIDescriptor::get());
1088 operator MDObjCProperty *() const { return get(); }
1089 MDObjCProperty *operator->() const { return get(); }
1090 MDObjCProperty &operator*() const {
1091 assert(get() && "Expected valid pointer");
1095 StringRef getObjCPropertyName() const { return get()->getName(); }
1096 DIFile getFile() const { return DIFile(get()->getFile()); }
1097 unsigned getLineNumber() const { return get()->getLine(); }
1099 StringRef getObjCPropertyGetterName() const { return get()->getGetterName(); }
1100 StringRef getObjCPropertySetterName() const { return get()->getSetterName(); }
1101 unsigned getAttributes() const { return get()->getAttributes(); }
1102 bool isReadOnlyObjCProperty() const {
1103 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
1105 bool isReadWriteObjCProperty() const {
1106 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
1108 bool isAssignObjCProperty() const {
1109 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_assign) != 0;
1111 bool isRetainObjCProperty() const {
1112 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_retain) != 0;
1114 bool isCopyObjCProperty() const {
1115 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_copy) != 0;
1117 bool isNonAtomicObjCProperty() const {
1118 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
1121 /// \brief Get the type.
1123 /// \note Objective-C doesn't have an ODR, so there is no benefit in storing
1124 /// the type as a DITypeRef here.
1125 DIType getType() const { return DIType(get()->getType()); }
1128 /// \brief An imported module (C++ using directive or similar).
1129 class DIImportedEntity : public DIDescriptor {
1131 DIImportedEntity() = default;
1132 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
1133 DIImportedEntity(const MDImportedEntity *N) : DIDescriptor(N) {}
1135 MDImportedEntity *get() const {
1136 return cast_or_null<MDImportedEntity>(DIDescriptor::get());
1138 operator MDImportedEntity *() const { return get(); }
1139 MDImportedEntity *operator->() const { return get(); }
1140 MDImportedEntity &operator*() const {
1141 assert(get() && "Expected valid pointer");
1145 DIScope getContext() const { return DIScope(get()->getScope()); }
1146 DIDescriptorRef getEntity() const {
1147 return DIDescriptorRef::get(get()->getEntity());
1149 unsigned getLineNumber() const { return get()->getLine(); }
1150 StringRef getName() const { return get()->getName(); }
1153 #define SIMPLIFY_DESCRIPTOR(DESC) \
1154 template <> struct simplify_type<const DESC> { \
1155 typedef Metadata *SimpleType; \
1156 static SimpleType getSimplifiedValue(const DESC &DI) { return DI; } \
1158 template <> struct simplify_type<DESC> : simplify_type<const DESC> {};
1159 SIMPLIFY_DESCRIPTOR(DIDescriptor)
1160 SIMPLIFY_DESCRIPTOR(DISubrange)
1161 SIMPLIFY_DESCRIPTOR(DIEnumerator)
1162 SIMPLIFY_DESCRIPTOR(DIScope)
1163 SIMPLIFY_DESCRIPTOR(DIType)
1164 SIMPLIFY_DESCRIPTOR(DIBasicType)
1165 SIMPLIFY_DESCRIPTOR(DIDerivedType)
1166 SIMPLIFY_DESCRIPTOR(DICompositeType)
1167 SIMPLIFY_DESCRIPTOR(DISubroutineType)
1168 SIMPLIFY_DESCRIPTOR(DIFile)
1169 SIMPLIFY_DESCRIPTOR(DICompileUnit)
1170 SIMPLIFY_DESCRIPTOR(DISubprogram)
1171 SIMPLIFY_DESCRIPTOR(DILexicalBlock)
1172 SIMPLIFY_DESCRIPTOR(DILexicalBlockFile)
1173 SIMPLIFY_DESCRIPTOR(DINameSpace)
1174 SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
1175 SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
1176 SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
1177 SIMPLIFY_DESCRIPTOR(DIVariable)
1178 SIMPLIFY_DESCRIPTOR(DIExpression)
1179 SIMPLIFY_DESCRIPTOR(DILocation)
1180 SIMPLIFY_DESCRIPTOR(DIObjCProperty)
1181 SIMPLIFY_DESCRIPTOR(DIImportedEntity)
1182 #undef SIMPLIFY_DESCRIPTOR
1184 /// \brief Find subprogram that is enclosing this scope.
1185 DISubprogram getDISubprogram(const MDNode *Scope);
1187 /// \brief Find debug info for a given function.
1188 /// \returns a valid DISubprogram, if found. Otherwise, it returns an empty
1190 DISubprogram getDISubprogram(const Function *F);
1192 /// \brief Find underlying composite type.
1193 DICompositeType getDICompositeType(DIType T);
1195 /// \brief Create a new inlined variable based on current variable.
1197 /// @param DV Current Variable.
1198 /// @param InlinedScope Location at current variable is inlined.
1199 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
1200 LLVMContext &VMContext);
1202 /// \brief Remove inlined scope from the variable.
1203 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
1205 /// \brief Generate map by visiting all retained types.
1206 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
1208 /// \brief Strip debug info in the module if it exists.
1210 /// To do this, we remove all calls to the debugger intrinsics and any named
1211 /// metadata for debugging. We also remove debug locations for instructions.
1212 /// Return true if module is modified.
1213 bool StripDebugInfo(Module &M);
1214 bool stripDebugInfo(Function &F);
1216 /// \brief Return Debug Info Metadata Version by checking module flags.
1217 unsigned getDebugMetadataVersionFromModule(const Module &M);
1219 /// \brief Utility to find all debug info in a module.
1221 /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
1222 /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
1223 /// processDeclare, processValue and processLocation to handle DbgDeclareInst,
1224 /// DbgValueInst and DbgLoc attached to instructions. processModule will go
1225 /// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
1226 /// used by the CUs.
1227 class DebugInfoFinder {
1229 DebugInfoFinder() : TypeMapInitialized(false) {}
1231 /// \brief Process entire module and collect debug info anchors.
1232 void processModule(const Module &M);
1234 /// \brief Process DbgDeclareInst.
1235 void processDeclare(const Module &M, const DbgDeclareInst *DDI);
1236 /// \brief Process DbgValueInst.
1237 void processValue(const Module &M, const DbgValueInst *DVI);
1238 /// \brief Process DILocation.
1239 void processLocation(const Module &M, DILocation Loc);
1241 /// \brief Clear all lists.
1245 void InitializeTypeMap(const Module &M);
1247 void processType(DIType DT);
1248 void processSubprogram(DISubprogram SP);
1249 void processScope(DIScope Scope);
1250 bool addCompileUnit(DICompileUnit CU);
1251 bool addGlobalVariable(DIGlobalVariable DIG);
1252 bool addSubprogram(DISubprogram SP);
1253 bool addType(DIType DT);
1254 bool addScope(DIScope Scope);
1257 typedef SmallVectorImpl<DICompileUnit>::const_iterator compile_unit_iterator;
1258 typedef SmallVectorImpl<DISubprogram>::const_iterator subprogram_iterator;
1259 typedef SmallVectorImpl<DIGlobalVariable>::const_iterator
1260 global_variable_iterator;
1261 typedef SmallVectorImpl<DIType>::const_iterator type_iterator;
1262 typedef SmallVectorImpl<DIScope>::const_iterator scope_iterator;
1264 iterator_range<compile_unit_iterator> compile_units() const {
1265 return iterator_range<compile_unit_iterator>(CUs.begin(), CUs.end());
1268 iterator_range<subprogram_iterator> subprograms() const {
1269 return iterator_range<subprogram_iterator>(SPs.begin(), SPs.end());
1272 iterator_range<global_variable_iterator> global_variables() const {
1273 return iterator_range<global_variable_iterator>(GVs.begin(), GVs.end());
1276 iterator_range<type_iterator> types() const {
1277 return iterator_range<type_iterator>(TYs.begin(), TYs.end());
1280 iterator_range<scope_iterator> scopes() const {
1281 return iterator_range<scope_iterator>(Scopes.begin(), Scopes.end());
1284 unsigned compile_unit_count() const { return CUs.size(); }
1285 unsigned global_variable_count() const { return GVs.size(); }
1286 unsigned subprogram_count() const { return SPs.size(); }
1287 unsigned type_count() const { return TYs.size(); }
1288 unsigned scope_count() const { return Scopes.size(); }
1291 SmallVector<DICompileUnit, 8> CUs;
1292 SmallVector<DISubprogram, 8> SPs;
1293 SmallVector<DIGlobalVariable, 8> GVs;
1294 SmallVector<DIType, 8> TYs;
1295 SmallVector<DIScope, 8> Scopes;
1296 SmallPtrSet<MDNode *, 64> NodesSeen;
1297 DITypeIdentifierMap TypeIdentifierMap;
1299 /// \brief Specify if TypeIdentifierMap is initialized.
1300 bool TypeMapInitialized;
1303 DenseMap<const Function *, DISubprogram> makeSubprogramMap(const Module &M);
1305 } // end namespace llvm