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 class DIHeaderFieldIterator
62 : public std::iterator<std::input_iterator_tag, StringRef, std::ptrdiff_t,
63 const StringRef *, StringRef> {
68 DIHeaderFieldIterator() {}
69 explicit DIHeaderFieldIterator(StringRef Header)
70 : Header(Header), Current(Header.slice(0, Header.find('\0'))) {}
71 StringRef operator*() const { return Current; }
72 const StringRef *operator->() const { return &Current; }
73 DIHeaderFieldIterator &operator++() {
77 DIHeaderFieldIterator operator++(int) {
78 DIHeaderFieldIterator X(*this);
82 bool operator==(const DIHeaderFieldIterator &X) const {
83 return Current.data() == X.Current.data();
85 bool operator!=(const DIHeaderFieldIterator &X) const {
89 StringRef getHeader() const { return Header; }
90 StringRef getCurrent() const { return Current; }
91 StringRef getPrefix() const {
92 if (Current.begin() == Header.begin())
94 return Header.slice(0, Current.begin() - Header.begin() - 1);
96 StringRef getSuffix() const {
97 if (Current.end() == Header.end())
99 return Header.slice(Current.end() - Header.begin() + 1, StringRef::npos);
102 /// \brief Get the current field as a number.
104 /// Convert the current field into a number. Return \c 0 on error.
105 template <class T> T getNumber() const {
107 if (getCurrent().getAsInteger(0, Int))
114 assert(Current.data() != nullptr && "Cannot increment past the end");
115 StringRef Suffix = getSuffix();
116 Current = Suffix.slice(0, Suffix.find('\0'));
120 /// \brief A thin wraper around MDNode to access encoded debug info.
122 /// This should not be stored in a container, because the underlying MDNode may
123 /// change in certain situations.
125 // Befriends DIRef so DIRef can befriend the protected member
126 // function: getFieldAs<DIRef>.
127 template <typename T> friend class DIRef;
130 /// \brief Duplicated debug info flags.
132 /// \see DebugNode::DIFlags.
134 #define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = DebugNode::Flag##NAME,
135 #include "llvm/IR/DebugInfoFlags.def"
136 FlagAccessibility = DebugNode::FlagAccessibility
139 static unsigned getFlag(StringRef Flag);
140 static const char *getFlagString(unsigned Flag);
142 /// \brief Split up a flags bitfield.
144 /// Split \c Flags into \c SplitFlags, a vector of its components. Returns
145 /// any remaining (unrecognized) bits.
146 static unsigned splitFlags(unsigned Flags,
147 SmallVectorImpl<unsigned> &SplitFlags);
150 const MDNode *DbgNode;
152 StringRef getStringField(unsigned Elt) const;
153 unsigned getUnsignedField(unsigned Elt) const {
154 return (unsigned)getUInt64Field(Elt);
156 uint64_t getUInt64Field(unsigned Elt) const;
157 int64_t getInt64Field(unsigned Elt) const;
158 DIDescriptor getDescriptorField(unsigned Elt) const;
160 template <typename DescTy> DescTy getFieldAs(unsigned Elt) const {
161 return DescTy(getDescriptorField(Elt));
164 GlobalVariable *getGlobalVariableField(unsigned Elt) const;
165 Constant *getConstantField(unsigned Elt) const;
166 Function *getFunctionField(unsigned Elt) const;
169 explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
173 MDNode *get() const { return const_cast<MDNode *>(DbgNode); }
174 operator MDNode *() const { return get(); }
175 MDNode *operator->() const { return get(); }
176 MDNode &operator*() const {
177 assert(get() && "Expected valid pointer");
181 // An explicit operator bool so that we can do testing of DI values
183 // FIXME: This operator bool isn't actually protecting anything at the
184 // moment due to the conversion operator above making DIDescriptor nodes
185 // implicitly convertable to bool.
186 explicit operator bool() const { return DbgNode != nullptr; }
188 bool operator==(DIDescriptor Other) const { return DbgNode == Other.DbgNode; }
189 bool operator!=(DIDescriptor Other) const { return !operator==(Other); }
191 StringRef getHeader() const { return getStringField(0); }
193 size_t getNumHeaderFields() const {
194 return std::distance(DIHeaderFieldIterator(getHeader()),
195 DIHeaderFieldIterator());
198 DIHeaderFieldIterator header_begin() const {
199 return DIHeaderFieldIterator(getHeader());
201 DIHeaderFieldIterator header_end() const { return DIHeaderFieldIterator(); }
203 DIHeaderFieldIterator getHeaderIterator(unsigned Index) const {
204 // Since callers expect an empty string for out-of-range accesses, we can't
205 // use std::advance() here.
206 for (auto I = header_begin(), E = header_end(); I != E; ++I, --Index)
212 StringRef getHeaderField(unsigned Index) const {
213 return *getHeaderIterator(Index);
216 template <class T> T getHeaderFieldAs(unsigned Index) const {
217 return getHeaderIterator(Index).getNumber<T>();
220 uint16_t getTag() const {
221 if (auto *N = dyn_cast_or_null<DebugNode>(get()))
226 bool isDerivedType() const { return get() && isa<MDDerivedTypeBase>(get()); }
227 bool isCompositeType() const {
228 return get() && isa<MDCompositeTypeBase>(get());
230 bool isSubroutineType() const {
231 return get() && isa<MDSubroutineType>(get());
233 bool isBasicType() const { return get() && isa<MDBasicType>(get()); }
234 bool isVariable() const { return get() && isa<MDLocalVariable>(get()); }
235 bool isSubprogram() const { return get() && isa<MDSubprogram>(get()); }
236 bool isGlobalVariable() const {
237 return get() && isa<MDGlobalVariable>(get());
239 bool isScope() const { return get() && isa<MDScope>(get()); }
240 bool isFile() const { return get() && isa<MDFile>(get()); }
241 bool isCompileUnit() const { return get() && isa<MDCompileUnit>(get()); }
242 bool isNameSpace() const{ return get() && isa<MDNamespace>(get()); }
243 bool isLexicalBlockFile() const {
244 return get() && isa<MDLexicalBlockFile>(get());
246 bool isLexicalBlock() const {
247 return get() && isa<MDLexicalBlockBase>(get());
249 bool isSubrange() const { return get() && isa<MDSubrange>(get()); }
250 bool isEnumerator() const { return get() && isa<MDEnumerator>(get()); }
251 bool isType() const { return get() && isa<MDType>(get()); }
252 bool isTemplateTypeParameter() const {
253 return get() && isa<MDTemplateTypeParameter>(get());
255 bool isTemplateValueParameter() const {
256 return get() && isa<MDTemplateValueParameter>(get());
258 bool isObjCProperty() const { return get() && isa<MDObjCProperty>(get()); }
259 bool isImportedEntity() const {
260 return get() && isa<MDImportedEntity>(get());
262 bool isExpression() const { return get() && isa<MDExpression>(get()); }
264 void print(raw_ostream &OS) const;
267 /// \brief Replace all uses of debug info referenced by this descriptor.
268 void replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D);
269 void replaceAllUsesWith(MDNode *D);
272 /// \brief This is used to represent ranges, for array bounds.
273 class DISubrange : public DIDescriptor {
275 explicit DISubrange(const MDNode *N = nullptr) : DIDescriptor(N) {}
276 DISubrange(const MDSubrange *N) : DIDescriptor(N) {}
278 MDSubrange *get() const {
279 return cast_or_null<MDSubrange>(DIDescriptor::get());
281 operator MDSubrange *() const { return get(); }
282 MDSubrange *operator->() const { return get(); }
283 MDSubrange &operator*() const {
284 assert(get() && "Expected valid pointer");
288 int64_t getLo() const { return get()->getLo(); }
289 int64_t getCount() const { return get()->getCount(); }
293 /// \brief This descriptor holds an array of nodes with type T.
294 template <typename T> class DITypedArray : public DIDescriptor {
296 explicit DITypedArray(const MDNode *N = nullptr) : DIDescriptor(N) {}
297 unsigned getNumElements() const {
298 return DbgNode ? DbgNode->getNumOperands() : 0;
300 T getElement(unsigned Idx) const { return getFieldAs<T>(Idx); }
303 typedef DITypedArray<DIDescriptor> DIArray;
305 /// \brief A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
307 /// FIXME: it seems strange that this doesn't have either a reference to the
308 /// type/precision or a file/line pair for location info.
309 class DIEnumerator : public DIDescriptor {
311 explicit DIEnumerator(const MDNode *N = nullptr) : DIDescriptor(N) {}
312 DIEnumerator(const MDEnumerator *N) : DIDescriptor(N) {}
314 MDEnumerator *get() const {
315 return cast_or_null<MDEnumerator>(DIDescriptor::get());
317 operator MDEnumerator *() const { return get(); }
318 MDEnumerator *operator->() const { return get(); }
319 MDEnumerator &operator*() const {
320 assert(get() && "Expected valid pointer");
324 StringRef getName() const { return get()->getName(); }
325 int64_t getEnumValue() const { return get()->getValue(); }
329 template <typename T> class DIRef;
330 typedef DIRef<DIDescriptor> DIDescriptorRef;
331 typedef DIRef<DIScope> DIScopeRef;
332 typedef DIRef<DIType> DITypeRef;
333 typedef DITypedArray<DITypeRef> DITypeArray;
335 /// \brief A base class for various scopes.
337 /// Although, implementation-wise, DIScope is the parent class of most
338 /// other DIxxx classes, including DIType and its descendants, most of
339 /// DIScope's descendants are not a substitutable subtype of
340 /// DIScope. The DIDescriptor::isScope() method only is true for
341 /// DIScopes that are scopes in the strict lexical scope sense
342 /// (DICompileUnit, DISubprogram, etc.), but not for, e.g., a DIType.
343 class DIScope : public DIDescriptor {
345 explicit DIScope(const MDNode *N = nullptr) : DIDescriptor(N) {}
346 DIScope(const MDScope *N) : DIDescriptor(N) {}
348 MDScope *get() const { return cast_or_null<MDScope>(DIDescriptor::get()); }
349 operator MDScope *() const { return get(); }
350 MDScope *operator->() const { return get(); }
351 MDScope &operator*() const {
352 assert(get() && "Expected valid pointer");
356 /// \brief Get the parent scope.
358 /// Gets the parent scope for this scope node or returns a default
359 /// constructed scope.
360 DIScopeRef getContext() const;
361 /// \brief Get the scope name.
363 /// If the scope node has a name, return that, else return an empty string.
364 StringRef getName() const;
365 StringRef getFilename() const;
366 StringRef getDirectory() const;
368 /// \brief Generate a reference to this DIScope.
370 /// Uses the type identifier instead of the actual MDNode if possible, to
371 /// help type uniquing.
372 DIScopeRef getRef() const;
375 /// \brief Represents reference to a DIDescriptor.
377 /// Abstracts over direct and identifier-based metadata references.
378 template <typename T> class DIRef {
379 template <typename DescTy>
380 friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
381 friend DIScopeRef DIScope::getContext() const;
382 friend DIScopeRef DIScope::getRef() const;
385 /// \brief Val can be either a MDNode or a MDString.
387 /// In the latter, MDString specifies the type identifier.
389 explicit DIRef(const Metadata *V);
392 T resolve(const DITypeIdentifierMap &Map) const;
393 StringRef getName() const;
394 operator Metadata *() const { return const_cast<Metadata *>(Val); }
396 static DIRef get(const Metadata *MD) { return DIRef(MD); }
399 template <typename T>
400 T DIRef<T>::resolve(const DITypeIdentifierMap &Map) const {
404 if (const MDNode *MD = dyn_cast<MDNode>(Val))
407 const MDString *MS = cast<MDString>(Val);
408 // Find the corresponding MDNode.
409 DITypeIdentifierMap::const_iterator Iter = Map.find(MS);
410 assert(Iter != Map.end() && "Identifier not in the type map?");
411 assert(DIDescriptor(Iter->second).isType() &&
412 "MDNode in DITypeIdentifierMap should be a DIType.");
413 return T(Iter->second);
416 template <typename T> StringRef DIRef<T>::getName() const {
420 if (const MDNode *MD = dyn_cast<MDNode>(Val))
421 return T(MD).getName();
423 const MDString *MS = cast<MDString>(Val);
424 return MS->getString();
427 /// \brief Handle fields that are references to DIDescriptors.
429 DIDescriptorRef DIDescriptor::getFieldAs<DIDescriptorRef>(unsigned Elt) const;
430 /// \brief Specialize DIRef constructor for DIDescriptorRef.
431 template <> DIRef<DIDescriptor>::DIRef(const Metadata *V);
433 /// \brief Handle fields that are references to DIScopes.
434 template <> DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const;
435 /// \brief Specialize DIRef constructor for DIScopeRef.
436 template <> DIRef<DIScope>::DIRef(const Metadata *V);
438 /// \brief Handle fields that are references to DITypes.
439 template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const;
440 /// \brief Specialize DIRef constructor for DITypeRef.
441 template <> DIRef<DIType>::DIRef(const Metadata *V);
443 /// \brief This is a wrapper for a type.
445 /// FIXME: Types should be factored much better so that CV qualifiers and
446 /// others do not require a huge and empty descriptor full of zeros.
447 class DIType : public DIScope {
449 explicit DIType(const MDNode *N = nullptr) : DIScope(N) {}
450 DIType(const MDType *N) : DIScope(N) {}
452 MDType *get() const { return cast_or_null<MDType>(DIDescriptor::get()); }
453 operator MDType *() const { return get(); }
454 MDType *operator->() const { return get(); }
455 MDType &operator*() const {
456 assert(get() && "Expected valid pointer");
460 operator DITypeRef() const {
462 "constructing DITypeRef from an MDNode that is not a type");
463 return DITypeRef(&*getRef());
468 DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
469 StringRef getName() const { return get()->getName(); }
470 unsigned getLineNumber() const { return get()->getLine(); }
471 uint64_t getSizeInBits() const { return get()->getSizeInBits(); }
472 uint64_t getAlignInBits() const { return get()->getAlignInBits(); }
473 // FIXME: Offset is only used for DW_TAG_member nodes. Making every type
474 // carry this is just plain insane.
475 uint64_t getOffsetInBits() const { return get()->getOffsetInBits(); }
476 unsigned getFlags() const { return get()->getFlags(); }
477 bool isPrivate() const {
478 return (getFlags() & FlagAccessibility) == FlagPrivate;
480 bool isProtected() const {
481 return (getFlags() & FlagAccessibility) == FlagProtected;
483 bool isPublic() const {
484 return (getFlags() & FlagAccessibility) == FlagPublic;
486 bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
487 bool isAppleBlockExtension() const {
488 return (getFlags() & FlagAppleBlock) != 0;
490 bool isBlockByrefStruct() const {
491 return (getFlags() & FlagBlockByrefStruct) != 0;
493 bool isVirtual() const { return (getFlags() & FlagVirtual) != 0; }
494 bool isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
495 bool isObjectPointer() const { return (getFlags() & FlagObjectPointer) != 0; }
496 bool isObjcClassComplete() const {
497 return (getFlags() & FlagObjcClassComplete) != 0;
499 bool isVector() const { return (getFlags() & FlagVector) != 0; }
500 bool isStaticMember() const { return (getFlags() & FlagStaticMember) != 0; }
501 bool isLValueReference() const {
502 return (getFlags() & FlagLValueReference) != 0;
504 bool isRValueReference() const {
505 return (getFlags() & FlagRValueReference) != 0;
507 bool isValid() const { return DbgNode && isType(); }
510 /// \brief A basic type, like 'int' or 'float'.
511 class DIBasicType : public DIType {
513 explicit DIBasicType(const MDNode *N = nullptr) : DIType(N) {}
514 DIBasicType(const MDBasicType *N) : DIType(N) {}
516 MDBasicType *get() const {
517 return cast_or_null<MDBasicType>(DIDescriptor::get());
519 operator MDBasicType *() const { return get(); }
520 MDBasicType *operator->() const { return get(); }
521 MDBasicType &operator*() const {
522 assert(get() && "Expected valid pointer");
526 unsigned getEncoding() const { return get()->getEncoding(); }
531 /// \brief A simple derived type
533 /// Like a const qualified type, a typedef, a pointer or reference, et cetera.
534 /// Or, a data member of a class/struct/union.
535 class DIDerivedType : public DIType {
537 explicit DIDerivedType(const MDNode *N = nullptr) : DIType(N) {}
538 DIDerivedType(const MDDerivedTypeBase *N) : DIType(N) {}
540 MDDerivedTypeBase *get() const {
541 return cast_or_null<MDDerivedTypeBase>(DIDescriptor::get());
543 operator MDDerivedTypeBase *() const { return get(); }
544 MDDerivedTypeBase *operator->() const { return get(); }
545 MDDerivedTypeBase &operator*() const {
546 assert(get() && "Expected valid pointer");
550 DITypeRef getTypeDerivedFrom() const {
551 return DITypeRef::get(get()->getBaseType());
554 /// \brief Return property node, if this ivar is associated with one.
555 MDNode *getObjCProperty() const {
556 if (auto *N = dyn_cast<MDDerivedType>(get()))
557 return dyn_cast_or_null<MDNode>(N->getExtraData());
561 DITypeRef getClassType() const {
562 assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
563 if (auto *N = dyn_cast<MDDerivedType>(get()))
564 return DITypeRef::get(N->getExtraData());
565 return DITypeRef::get(nullptr);
568 Constant *getConstant() const {
569 assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
570 if (auto *N = dyn_cast<MDDerivedType>(get()))
571 if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getExtraData()))
572 return C->getValue();
580 /// \brief Types that refer to multiple other types.
582 /// This descriptor holds a type that can refer to multiple other types, like a
583 /// function or struct.
585 /// DICompositeType is derived from DIDerivedType because some
586 /// composite types (such as enums) can be derived from basic types
587 // FIXME: Make this derive from DIType directly & just store the
588 // base type in a single DIType field.
589 class DICompositeType : public DIDerivedType {
590 friend class DIBuilder;
592 /// \brief Set the array of member DITypes.
593 void setArraysHelper(MDNode *Elements, MDNode *TParams);
596 explicit DICompositeType(const MDNode *N = nullptr) : DIDerivedType(N) {}
597 DICompositeType(const MDCompositeTypeBase *N) : DIDerivedType(N) {}
599 MDCompositeTypeBase *get() const {
600 return cast_or_null<MDCompositeTypeBase>(DIDescriptor::get());
602 operator MDCompositeTypeBase *() const { return get(); }
603 MDCompositeTypeBase *operator->() const { return get(); }
604 MDCompositeTypeBase &operator*() const {
605 assert(get() && "Expected valid pointer");
609 DIArray getElements() const {
610 assert(!isSubroutineType() && "no elements for DISubroutineType");
611 return DIArray(get()->getElements());
615 template <typename T>
616 void setArrays(DITypedArray<T> Elements, DIArray TParams = DIArray()) {
618 (!TParams || DbgNode->getNumOperands() == 8) &&
619 "If you're setting the template parameters this should include a slot "
621 setArraysHelper(Elements, TParams);
625 unsigned getRunTimeLang() const { return get()->getRuntimeLang(); }
626 DITypeRef getContainingType() const {
627 return DITypeRef::get(get()->getVTableHolder());
631 /// \brief Set the containing type.
632 void setContainingType(DICompositeType ContainingType);
635 DIArray getTemplateParams() const {
636 return DIArray(get()->getTemplateParams());
638 MDString *getIdentifier() const { return get()->getRawIdentifier(); }
643 class DISubroutineType : public DICompositeType {
645 explicit DISubroutineType(const MDNode *N = nullptr) : DICompositeType(N) {}
646 DISubroutineType(const MDSubroutineType *N) : DICompositeType(N) {}
648 MDSubroutineType *get() const {
649 return cast_or_null<MDSubroutineType>(DIDescriptor::get());
651 operator MDSubroutineType *() const { return get(); }
652 MDSubroutineType *operator->() const { return get(); }
653 MDSubroutineType &operator*() const {
654 assert(get() && "Expected valid pointer");
658 DITypedArray<DITypeRef> getTypeArray() const {
659 return DITypedArray<DITypeRef>(get()->getTypeArray());
663 /// \brief This is a wrapper for a file.
664 class DIFile : public DIScope {
666 explicit DIFile(const MDNode *N = nullptr) : DIScope(N) {}
667 DIFile(const MDFile *N) : DIScope(N) {}
669 MDFile *get() const { return cast_or_null<MDFile>(DIDescriptor::get()); }
670 operator MDFile *() const { return get(); }
671 MDFile *operator->() const { return get(); }
672 MDFile &operator*() const {
673 assert(get() && "Expected valid pointer");
677 /// \brief Retrieve the MDNode for the directory/file pair.
678 MDNode *getFileNode() const { return get(); }
682 /// \brief A wrapper for a compile unit.
683 class DICompileUnit : public DIScope {
685 explicit DICompileUnit(const MDNode *N = nullptr) : DIScope(N) {}
686 DICompileUnit(const MDCompileUnit *N) : DIScope(N) {}
688 MDCompileUnit *get() const {
689 return cast_or_null<MDCompileUnit>(DIDescriptor::get());
691 operator MDCompileUnit *() const { return get(); }
692 MDCompileUnit *operator->() const { return get(); }
693 MDCompileUnit &operator*() const {
694 assert(get() && "Expected valid pointer");
698 dwarf::SourceLanguage getLanguage() const {
699 return static_cast<dwarf::SourceLanguage>(get()->getSourceLanguage());
701 StringRef getProducer() const { return get()->getProducer(); }
702 bool isOptimized() const { return get()->isOptimized(); }
703 StringRef getFlags() const { return get()->getFlags(); }
704 unsigned getRunTimeVersion() const { return get()->getRuntimeVersion(); }
706 DIArray getEnumTypes() const { return DIArray(get()->getEnumTypes()); }
707 DIArray getRetainedTypes() const {
708 return DIArray(get()->getRetainedTypes());
710 DIArray getSubprograms() const { return DIArray(get()->getSubprograms()); }
711 DIArray getGlobalVariables() const {
712 return DIArray(get()->getGlobalVariables());
714 DIArray getImportedEntities() const {
715 return DIArray(get()->getImportedEntities());
718 void replaceSubprograms(DIArray Subprograms);
719 void replaceGlobalVariables(DIArray GlobalVariables);
721 StringRef getSplitDebugFilename() const {
722 return get()->getSplitDebugFilename();
724 unsigned getEmissionKind() const { return get()->getEmissionKind(); }
729 /// \brief This is a wrapper for a subprogram (e.g. a function).
730 class DISubprogram : public DIScope {
732 explicit DISubprogram(const MDNode *N = nullptr) : DIScope(N) {}
733 DISubprogram(const MDSubprogram *N) : DIScope(N) {}
735 MDSubprogram *get() const {
736 return cast_or_null<MDSubprogram>(DIDescriptor::get());
738 operator MDSubprogram *() const { return get(); }
739 MDSubprogram *operator->() const { return get(); }
740 MDSubprogram &operator*() const {
741 assert(get() && "Expected valid pointer");
745 StringRef getName() const { return get()->getName(); }
746 StringRef getDisplayName() const { return get()->getDisplayName(); }
747 StringRef getLinkageName() const { return get()->getLinkageName(); }
748 unsigned getLineNumber() const { return get()->getLine(); }
750 /// \brief Check if this is local (like 'static' in C).
751 unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
752 unsigned isDefinition() const { return get()->isDefinition(); }
754 unsigned getVirtuality() const { return get()->getVirtuality(); }
755 unsigned getVirtualIndex() const { return get()->getVirtualIndex(); }
757 unsigned getFlags() const { return get()->getFlags(); }
759 unsigned isOptimized() const { return get()->isOptimized(); }
761 /// \brief Get the beginning of the scope of the function (not the name).
762 unsigned getScopeLineNumber() const { return get()->getScopeLine(); }
764 DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
765 DISubroutineType getType() const {
766 return DISubroutineType(get()->getType());
769 DITypeRef getContainingType() const {
770 return DITypeRef::get(get()->getContainingType());
775 /// \brief Check if this provides debugging information for the function F.
776 bool describes(const Function *F);
778 Function *getFunction() const;
780 void replaceFunction(Function *F) {
782 N->replaceFunction(F);
784 DIArray getTemplateParams() const {
785 return DIArray(get()->getTemplateParams());
787 DISubprogram getFunctionDeclaration() const {
788 return DISubprogram(get()->getDeclaration());
790 MDNode *getVariablesNodes() const { return getVariables(); }
791 DIArray getVariables() const { return DIArray(get()->getVariables()); }
793 unsigned isArtificial() const { return (getFlags() & FlagArtificial) != 0; }
794 /// \brief Check for the "private" access specifier.
795 bool isPrivate() const {
796 return (getFlags() & FlagAccessibility) == FlagPrivate;
798 /// \brief Check for the "protected" access specifier.
799 bool isProtected() const {
800 return (getFlags() & FlagAccessibility) == FlagProtected;
802 /// \brief Check for the "public" access specifier.
803 bool isPublic() const {
804 return (getFlags() & FlagAccessibility) == FlagPublic;
806 /// \brief Check for "explicit".
807 bool isExplicit() const { return (getFlags() & FlagExplicit) != 0; }
808 /// \brief Check if this is prototyped.
809 bool isPrototyped() const { return (getFlags() & FlagPrototyped) != 0; }
811 /// \brief Check if this is reference-qualified.
813 /// Return true if this subprogram is a C++11 reference-qualified non-static
814 /// member function (void foo() &).
815 unsigned isLValueReference() const {
816 return (getFlags() & FlagLValueReference) != 0;
819 /// \brief Check if this is rvalue-reference-qualified.
821 /// Return true if this subprogram is a C++11 rvalue-reference-qualified
822 /// non-static member function (void foo() &&).
823 unsigned isRValueReference() const {
824 return (getFlags() & FlagRValueReference) != 0;
828 /// \brief This is a wrapper for a lexical block.
829 class DILexicalBlock : public DIScope {
831 explicit DILexicalBlock(const MDNode *N = nullptr) : DIScope(N) {}
832 DILexicalBlock(const MDLexicalBlock *N) : DIScope(N) {}
834 MDLexicalBlockBase *get() const {
835 return cast_or_null<MDLexicalBlockBase>(DIDescriptor::get());
837 operator MDLexicalBlockBase *() const { return get(); }
838 MDLexicalBlockBase *operator->() const { return get(); }
839 MDLexicalBlockBase &operator*() const {
840 assert(get() && "Expected valid pointer");
844 DIScope getContext() const { return DIScope(get()->getScope()); }
845 unsigned getLineNumber() const {
846 if (auto *N = dyn_cast<MDLexicalBlock>(get()))
850 unsigned getColumnNumber() const {
851 if (auto *N = dyn_cast<MDLexicalBlock>(get()))
852 return N->getColumn();
858 /// \brief This is a wrapper for a lexical block with a filename change.
859 class DILexicalBlockFile : public DIScope {
861 explicit DILexicalBlockFile(const MDNode *N = nullptr) : DIScope(N) {}
862 DILexicalBlockFile(const MDLexicalBlockFile *N) : DIScope(N) {}
864 MDLexicalBlockFile *get() const {
865 return cast_or_null<MDLexicalBlockFile>(DIDescriptor::get());
867 operator MDLexicalBlockFile *() const { return get(); }
868 MDLexicalBlockFile *operator->() const { return get(); }
869 MDLexicalBlockFile &operator*() const {
870 assert(get() && "Expected valid pointer");
874 DIScope getContext() const { return getScope(); }
875 unsigned getLineNumber() const { return getScope().getLineNumber(); }
876 unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
877 DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
878 unsigned getDiscriminator() const { return get()->getDiscriminator(); }
882 /// \brief A wrapper for a C++ style name space.
883 class DINameSpace : public DIScope {
885 explicit DINameSpace(const MDNode *N = nullptr) : DIScope(N) {}
886 DINameSpace(const MDNamespace *N) : DIScope(N) {}
888 MDNamespace *get() const {
889 return cast_or_null<MDNamespace>(DIDescriptor::get());
891 operator MDNamespace *() const { return get(); }
892 MDNamespace *operator->() const { return get(); }
893 MDNamespace &operator*() const {
894 assert(get() && "Expected valid pointer");
898 StringRef getName() const { return get()->getName(); }
899 unsigned getLineNumber() const { return get()->getLine(); }
900 DIScope getContext() const { return DIScope(get()->getScope()); }
904 /// \brief This is a wrapper for template type parameter.
905 class DITemplateTypeParameter : public DIDescriptor {
907 explicit DITemplateTypeParameter(const MDNode *N = nullptr)
909 DITemplateTypeParameter(const MDTemplateTypeParameter *N) : DIDescriptor(N) {}
911 MDTemplateTypeParameter *get() const {
912 return cast_or_null<MDTemplateTypeParameter>(DIDescriptor::get());
914 operator MDTemplateTypeParameter *() const { return get(); }
915 MDTemplateTypeParameter *operator->() const { return get(); }
916 MDTemplateTypeParameter &operator*() const {
917 assert(get() && "Expected valid pointer");
921 StringRef getName() const { return get()->getName(); }
923 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
927 /// \brief This is a wrapper for template value parameter.
928 class DITemplateValueParameter : public DIDescriptor {
930 explicit DITemplateValueParameter(const MDNode *N = nullptr)
932 DITemplateValueParameter(const MDTemplateValueParameter *N)
935 MDTemplateValueParameter *get() const {
936 return cast_or_null<MDTemplateValueParameter>(DIDescriptor::get());
938 operator MDTemplateValueParameter *() const { return get(); }
939 MDTemplateValueParameter *operator->() const { return get(); }
940 MDTemplateValueParameter &operator*() const {
941 assert(get() && "Expected valid pointer");
945 StringRef getName() const { return get()->getName(); }
946 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
947 Metadata *getValue() const { return get()->getValue(); }
951 /// \brief This is a wrapper for a global variable.
952 class DIGlobalVariable : public DIDescriptor {
953 DIFile getFile() const { return DIFile(get()->getFile()); }
956 explicit DIGlobalVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
957 DIGlobalVariable(const MDGlobalVariable *N) : DIDescriptor(N) {}
959 MDGlobalVariable *get() const {
960 return cast_or_null<MDGlobalVariable>(DIDescriptor::get());
962 operator MDGlobalVariable *() const { return get(); }
963 MDGlobalVariable *operator->() const { return get(); }
964 MDGlobalVariable &operator*() const {
965 assert(get() && "Expected valid pointer");
969 StringRef getName() const { return get()->getName(); }
970 StringRef getDisplayName() const { return get()->getDisplayName(); }
971 StringRef getLinkageName() const { return get()->getLinkageName(); }
972 unsigned getLineNumber() const { return get()->getLine(); }
973 unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
974 unsigned isDefinition() const { return get()->isDefinition(); }
976 DIScope getContext() const { return DIScope(get()->getScope()); }
977 StringRef getFilename() const { return getFile().getFilename(); }
978 StringRef getDirectory() const { return getFile().getDirectory(); }
979 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
981 GlobalVariable *getGlobal() const;
982 Constant *getConstant() const {
984 if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getVariable()))
985 return C->getValue();
988 DIDerivedType getStaticDataMemberDeclaration() const {
989 return DIDerivedType(get()->getStaticDataMemberDeclaration());
995 /// \brief This is a wrapper for a variable (e.g. parameter, local, global etc).
996 class DIVariable : public DIDescriptor {
997 unsigned getFlags() const { return get()->getFlags(); }
1000 explicit DIVariable(const MDNode *N = nullptr) : DIDescriptor(N) {}
1001 DIVariable(const MDLocalVariable *N) : DIDescriptor(N) {}
1003 MDLocalVariable *get() const {
1004 return cast_or_null<MDLocalVariable>(DIDescriptor::get());
1006 operator MDLocalVariable *() const { return get(); }
1007 MDLocalVariable *operator->() const { return get(); }
1008 MDLocalVariable &operator*() const {
1009 assert(get() && "Expected valid pointer");
1013 StringRef getName() const { return get()->getName(); }
1014 unsigned getLineNumber() const { return get()->getLine(); }
1015 unsigned getArgNumber() const { return get()->getArg(); }
1017 DIScope getContext() const { return DIScope(get()->getScope()); }
1018 DIFile getFile() const { return DIFile(get()->getFile()); }
1019 DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
1021 /// \brief Return true if this variable is marked as "artificial".
1022 bool isArtificial() const {
1023 return (getFlags() & FlagArtificial) != 0;
1026 bool isObjectPointer() const {
1027 return (getFlags() & FlagObjectPointer) != 0;
1030 /// \brief If this variable is inlined then return inline location.
1031 MDNode *getInlinedAt() const { return DIDescriptor(get()->getInlinedAt()); }
1033 bool Verify() const;
1035 /// \brief Check if this is a "__block" variable (Apple Blocks).
1036 bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {
1037 return (getType().resolve(Map)).isBlockByrefStruct();
1040 /// \brief Check if this is an inlined function argument.
1041 bool isInlinedFnArgument(const Function *CurFn);
1043 /// \brief Return the size reported by the variable's type.
1044 unsigned getSizeInBits(const DITypeIdentifierMap &Map);
1046 void printExtendedName(raw_ostream &OS) const;
1049 /// \brief A complex location expression in postfix notation.
1051 /// This is (almost) a DWARF expression that modifies the location of a
1052 /// variable or (or the location of a single piece of a variable).
1054 /// FIXME: Instead of DW_OP_plus taking an argument, this should use DW_OP_const
1055 /// and have DW_OP_plus consume the topmost elements on the stack.
1056 class DIExpression : public DIDescriptor {
1058 explicit DIExpression(const MDNode *N = nullptr) : DIDescriptor(N) {}
1059 DIExpression(const MDExpression *N) : DIDescriptor(N) {}
1061 MDExpression *get() const {
1062 return cast_or_null<MDExpression>(DIDescriptor::get());
1064 operator MDExpression *() const { return get(); }
1065 MDExpression *operator->() const { return get(); }
1066 MDExpression &operator*() const {
1067 assert(get() && "Expected valid pointer");
1071 // Don't call this. Call isValid() directly.
1072 bool Verify() const = delete;
1074 /// \brief Return the number of elements in the complex expression.
1075 unsigned getNumElements() const { return get()->getNumElements(); }
1077 /// \brief return the Idx'th complex address element.
1078 uint64_t getElement(unsigned I) const { return get()->getElement(I); }
1080 /// \brief Return whether this is a piece of an aggregate variable.
1081 bool isBitPiece() const;
1082 /// \brief Return the offset of this piece in bits.
1083 uint64_t getBitPieceOffset() const;
1084 /// \brief Return the size of this piece in bits.
1085 uint64_t getBitPieceSize() const;
1088 /// \brief A lightweight wrapper around an element of a DIExpression.
1090 friend class iterator;
1091 MDExpression::element_iterator I;
1093 Operand(MDExpression::element_iterator I) : I(I) {}
1095 /// \brief Operands such as DW_OP_piece have explicit (non-stack) arguments.
1096 /// Argument 0 is the operand itself.
1097 uint64_t getArg(unsigned N) const {
1098 MDExpression::element_iterator In = I;
1099 std::advance(In, N);
1102 operator uint64_t () const { return *I; }
1103 /// \brief Returns underlying MDExpression::element_iterator.
1104 const MDExpression::element_iterator &getBase() const { return I; }
1105 /// \brief Returns the next operand.
1106 iterator getNext() const;
1109 /// \brief An iterator for DIExpression elements.
1110 class iterator : public std::iterator<std::input_iterator_tag, StringRef,
1111 unsigned, const Operand*, Operand> {
1112 friend class Operand;
1113 MDExpression::element_iterator I;
1117 iterator(MDExpression::element_iterator I) : I(I) {}
1118 const Operand &operator*() { return Tmp = Operand(I); }
1119 const Operand *operator->() { return &(Tmp = Operand(I)); }
1120 iterator &operator++() {
1124 iterator operator++(int) {
1129 bool operator==(const iterator &X) const { return I == X.I; }
1130 bool operator!=(const iterator &X) const { return !(*this == X); }
1135 case dwarf::DW_OP_bit_piece: std::advance(I, 3); break;
1136 case dwarf::DW_OP_plus: std::advance(I, 2); break;
1137 case dwarf::DW_OP_deref: std::advance(I, 1); break;
1139 llvm_unreachable("unsupported operand");
1144 iterator begin() const { return get()->elements_begin(); }
1145 iterator end() const { return get()->elements_end(); }
1148 /// \brief This object holds location information.
1150 /// This object is not associated with any DWARF tag.
1151 class DILocation : public DIDescriptor {
1153 explicit DILocation(const MDNode *N) : DIDescriptor(N) {}
1154 DILocation(const MDLocation *N) : DIDescriptor(N) {}
1156 MDLocation *get() const {
1157 return cast_or_null<MDLocation>(DIDescriptor::get());
1159 operator MDLocation *() const { return get(); }
1160 MDLocation *operator->() const { return get(); }
1161 MDLocation &operator*() const {
1162 assert(get() && "Expected valid pointer");
1166 unsigned getLineNumber() const { return get()->getLine(); }
1167 unsigned getColumnNumber() const { return get()->getColumn(); }
1168 DIScope getScope() const { return DIScope(get()->getScope()); }
1169 DILocation getOrigLocation() const {
1170 return DILocation(get()->getInlinedAt());
1172 StringRef getFilename() const { return getScope().getFilename(); }
1173 StringRef getDirectory() const { return getScope().getDirectory(); }
1174 bool Verify() const;
1175 bool atSameLineAs(const DILocation &Other) const {
1176 return (getLineNumber() == Other.getLineNumber() &&
1177 getFilename() == Other.getFilename());
1179 /// \brief Get the DWAF discriminator.
1181 /// DWARF discriminators are used to distinguish identical file locations for
1182 /// instructions that are on different basic blocks. If two instructions are
1183 /// inside the same lexical block and are in different basic blocks, we
1184 /// create a new lexical block with identical location as the original but
1185 /// with a different discriminator value
1186 /// (lib/Transforms/Util/AddDiscriminators.cpp for details).
1187 unsigned getDiscriminator() const {
1188 // Since discriminators are associated with lexical blocks, make
1189 // sure this location is a lexical block before retrieving its
1191 return getScope().isLexicalBlockFile()
1192 ? DILexicalBlockFile(
1193 cast<MDNode>(cast<MDLocation>(DbgNode)->getScope()))
1198 /// \brief Generate a new discriminator value for this location.
1199 unsigned computeNewDiscriminator(LLVMContext &Ctx);
1201 /// \brief Return a copy of this location with a different scope.
1202 DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlockFile NewScope);
1205 class DIObjCProperty : public DIDescriptor {
1207 explicit DIObjCProperty(const MDNode *N) : DIDescriptor(N) {}
1208 DIObjCProperty(const MDObjCProperty *N) : DIDescriptor(N) {}
1210 MDObjCProperty *get() const {
1211 return cast_or_null<MDObjCProperty>(DIDescriptor::get());
1213 operator MDObjCProperty *() const { return get(); }
1214 MDObjCProperty *operator->() const { return get(); }
1215 MDObjCProperty &operator*() const {
1216 assert(get() && "Expected valid pointer");
1220 StringRef getObjCPropertyName() const { return get()->getName(); }
1221 DIFile getFile() const { return DIFile(get()->getFile()); }
1222 unsigned getLineNumber() const { return get()->getLine(); }
1224 StringRef getObjCPropertyGetterName() const { return get()->getGetterName(); }
1225 StringRef getObjCPropertySetterName() const { return get()->getSetterName(); }
1226 unsigned getAttributes() const { return get()->getAttributes(); }
1227 bool isReadOnlyObjCProperty() const {
1228 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
1230 bool isReadWriteObjCProperty() const {
1231 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
1233 bool isAssignObjCProperty() const {
1234 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_assign) != 0;
1236 bool isRetainObjCProperty() const {
1237 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_retain) != 0;
1239 bool isCopyObjCProperty() const {
1240 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_copy) != 0;
1242 bool isNonAtomicObjCProperty() const {
1243 return (getAttributes() & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
1246 /// \brief Get the type.
1248 /// \note Objective-C doesn't have an ODR, so there is no benefit in storing
1249 /// the type as a DITypeRef here.
1250 DIType getType() const { return DIType(get()->getType()); }
1252 bool Verify() const;
1255 /// \brief An imported module (C++ using directive or similar).
1256 class DIImportedEntity : public DIDescriptor {
1258 DIImportedEntity() = default;
1259 explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
1260 DIImportedEntity(const MDImportedEntity *N) : DIDescriptor(N) {}
1262 MDImportedEntity *get() const {
1263 return cast_or_null<MDImportedEntity>(DIDescriptor::get());
1265 operator MDImportedEntity *() const { return get(); }
1266 MDImportedEntity *operator->() const { return get(); }
1267 MDImportedEntity &operator*() const {
1268 assert(get() && "Expected valid pointer");
1272 DIScope getContext() const { return DIScope(get()->getScope()); }
1273 DIDescriptorRef getEntity() const {
1274 return DIDescriptorRef::get(get()->getEntity());
1276 unsigned getLineNumber() const { return get()->getLine(); }
1277 StringRef getName() const { return get()->getName(); }
1278 bool Verify() const;
1281 /// \brief Find subprogram that is enclosing this scope.
1282 DISubprogram getDISubprogram(const MDNode *Scope);
1284 /// \brief Find debug info for a given function.
1285 /// \returns a valid DISubprogram, if found. Otherwise, it returns an empty
1287 DISubprogram getDISubprogram(const Function *F);
1289 /// \brief Find underlying composite type.
1290 DICompositeType getDICompositeType(DIType T);
1292 /// \brief Create a new inlined variable based on current variable.
1294 /// @param DV Current Variable.
1295 /// @param InlinedScope Location at current variable is inlined.
1296 DIVariable createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
1297 LLVMContext &VMContext);
1299 /// \brief Remove inlined scope from the variable.
1300 DIVariable cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext);
1302 /// \brief Generate map by visiting all retained types.
1303 DITypeIdentifierMap generateDITypeIdentifierMap(const NamedMDNode *CU_Nodes);
1305 /// \brief Strip debug info in the module if it exists.
1307 /// To do this, we remove all calls to the debugger intrinsics and any named
1308 /// metadata for debugging. We also remove debug locations for instructions.
1309 /// Return true if module is modified.
1310 bool StripDebugInfo(Module &M);
1311 bool stripDebugInfo(Function &F);
1313 /// \brief Return Debug Info Metadata Version by checking module flags.
1314 unsigned getDebugMetadataVersionFromModule(const Module &M);
1316 /// \brief Utility to find all debug info in a module.
1318 /// DebugInfoFinder tries to list all debug info MDNodes used in a module. To
1319 /// list debug info MDNodes used by an instruction, DebugInfoFinder uses
1320 /// processDeclare, processValue and processLocation to handle DbgDeclareInst,
1321 /// DbgValueInst and DbgLoc attached to instructions. processModule will go
1322 /// through all DICompileUnits in llvm.dbg.cu and list debug info MDNodes
1323 /// used by the CUs.
1324 class DebugInfoFinder {
1326 DebugInfoFinder() : TypeMapInitialized(false) {}
1328 /// \brief Process entire module and collect debug info anchors.
1329 void processModule(const Module &M);
1331 /// \brief Process DbgDeclareInst.
1332 void processDeclare(const Module &M, const DbgDeclareInst *DDI);
1333 /// \brief Process DbgValueInst.
1334 void processValue(const Module &M, const DbgValueInst *DVI);
1335 /// \brief Process DILocation.
1336 void processLocation(const Module &M, DILocation Loc);
1338 /// \brief Clear all lists.
1342 void InitializeTypeMap(const Module &M);
1344 void processType(DIType DT);
1345 void processSubprogram(DISubprogram SP);
1346 void processScope(DIScope Scope);
1347 bool addCompileUnit(DICompileUnit CU);
1348 bool addGlobalVariable(DIGlobalVariable DIG);
1349 bool addSubprogram(DISubprogram SP);
1350 bool addType(DIType DT);
1351 bool addScope(DIScope Scope);
1354 typedef SmallVectorImpl<DICompileUnit>::const_iterator compile_unit_iterator;
1355 typedef SmallVectorImpl<DISubprogram>::const_iterator subprogram_iterator;
1356 typedef SmallVectorImpl<DIGlobalVariable>::const_iterator
1357 global_variable_iterator;
1358 typedef SmallVectorImpl<DIType>::const_iterator type_iterator;
1359 typedef SmallVectorImpl<DIScope>::const_iterator scope_iterator;
1361 iterator_range<compile_unit_iterator> compile_units() const {
1362 return iterator_range<compile_unit_iterator>(CUs.begin(), CUs.end());
1365 iterator_range<subprogram_iterator> subprograms() const {
1366 return iterator_range<subprogram_iterator>(SPs.begin(), SPs.end());
1369 iterator_range<global_variable_iterator> global_variables() const {
1370 return iterator_range<global_variable_iterator>(GVs.begin(), GVs.end());
1373 iterator_range<type_iterator> types() const {
1374 return iterator_range<type_iterator>(TYs.begin(), TYs.end());
1377 iterator_range<scope_iterator> scopes() const {
1378 return iterator_range<scope_iterator>(Scopes.begin(), Scopes.end());
1381 unsigned compile_unit_count() const { return CUs.size(); }
1382 unsigned global_variable_count() const { return GVs.size(); }
1383 unsigned subprogram_count() const { return SPs.size(); }
1384 unsigned type_count() const { return TYs.size(); }
1385 unsigned scope_count() const { return Scopes.size(); }
1388 SmallVector<DICompileUnit, 8> CUs;
1389 SmallVector<DISubprogram, 8> SPs;
1390 SmallVector<DIGlobalVariable, 8> GVs;
1391 SmallVector<DIType, 8> TYs;
1392 SmallVector<DIScope, 8> Scopes;
1393 SmallPtrSet<MDNode *, 64> NodesSeen;
1394 DITypeIdentifierMap TypeIdentifierMap;
1396 /// \brief Specify if TypeIdentifierMap is initialized.
1397 bool TypeMapInitialized;
1400 DenseMap<const Function *, DISubprogram> makeSubprogramMap(const Module &M);
1402 } // end namespace llvm