#define LLVM_IR_DEBUGINFO_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
public:
explicit DIGlobalVariable(const MDNode *N = 0) : DIDescriptor(N) {}
- // FIXME: use DIScopeRef for LTO type uniqueing.
DIScope getContext() const { return getFieldAs<DIScope>(2); }
StringRef getName() const { return getStringField(3); }
StringRef getDisplayName() const { return getStringField(4); }
public:
explicit DIVariable(const MDNode *N = 0) : DIDescriptor(N) {}
- // FIXME: use DIScopeRef for LTO type uniqueing.
DIScope getContext() const { return getFieldAs<DIScope>(1); }
StringRef getName() const { return getStringField(2); }
DIFile getFile() const { return getFieldAs<DIFile>(3); }
return (getUnsignedField(6) & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
}
+ /// Objective-C doesn't have an ODR, so there is no benefit in storing
+ /// the type as a DITypeRef here.
DIType getType() const { return getFieldAs<DIType>(7); }
/// Verify - Verify that a derived type descriptor is well formed.
public:
explicit DIImportedEntity(const MDNode *N) : DIDescriptor(N) {}
DIScope getContext() const { return getFieldAs<DIScope>(1); }
- DIDescriptor getEntity() const { return getFieldAs<DIDescriptor>(2); }
+ DIScopeRef getEntity() const { return getFieldAs<DIScopeRef>(2); }
unsigned getLineNumber() const { return getUnsignedField(3); }
StringRef getName() const { return getStringField(4); }
bool Verify() const;
/// processType - Process DIType.
void processType(DIType DT);
- /// processLexicalBlock - Process DILexicalBlock.
- void processLexicalBlock(DILexicalBlock LB);
-
/// processSubprogram - Process DISubprogram.
void processSubprogram(DISubprogram SP);
bool addScope(DIScope Scope);
public:
- typedef SmallVectorImpl<MDNode *>::const_iterator iterator;
- iterator compile_unit_begin() const { return CUs.begin(); }
- iterator compile_unit_end() const { return CUs.end(); }
- iterator subprogram_begin() const { return SPs.begin(); }
- iterator subprogram_end() const { return SPs.end(); }
- iterator global_variable_begin() const { return GVs.begin(); }
- iterator global_variable_end() const { return GVs.end(); }
- iterator type_begin() const { return TYs.begin(); }
- iterator type_end() const { return TYs.end(); }
- iterator scope_begin() const { return Scopes.begin(); }
- iterator scope_end() const { return Scopes.end(); }
+ typedef SmallVectorImpl<DICompileUnit>::const_iterator compile_unit_iterator;
+ typedef SmallVectorImpl<DISubprogram>::const_iterator subprogram_iterator;
+ typedef SmallVectorImpl<DIGlobalVariable>::const_iterator global_variable_iterator;
+ typedef SmallVectorImpl<DIType>::const_iterator type_iterator;
+ typedef SmallVectorImpl<DIScope>::const_iterator scope_iterator;
+
+ iterator_range<compile_unit_iterator> compile_units() const {
+ return iterator_range<compile_unit_iterator>(CUs.begin(), CUs.end());
+ }
+
+ iterator_range<subprogram_iterator> subprograms() const {
+ return iterator_range<subprogram_iterator>(SPs.begin(), SPs.end());
+ }
+
+ iterator_range<global_variable_iterator> global_variables() const {
+ return iterator_range<global_variable_iterator>(GVs.begin(), GVs.end());
+ }
+
+ iterator_range<type_iterator> types() const {
+ return iterator_range<type_iterator>(TYs.begin(), TYs.end());
+ }
+
+ iterator_range<scope_iterator> scopes() const {
+ return iterator_range<scope_iterator>(Scopes.begin(), Scopes.end());
+ }
unsigned compile_unit_count() const { return CUs.size(); }
unsigned global_variable_count() const { return GVs.size(); }
unsigned scope_count() const { return Scopes.size(); }
private:
- SmallVector<MDNode *, 8> CUs; // Compile Units
- SmallVector<MDNode *, 8> SPs; // Subprograms
- SmallVector<MDNode *, 8> GVs; // Global Variables;
- SmallVector<MDNode *, 8> TYs; // Types
- SmallVector<MDNode *, 8> Scopes; // Scopes
+ SmallVector<DICompileUnit, 8> CUs; // Compile Units
+ SmallVector<DISubprogram, 8> SPs; // Subprograms
+ SmallVector<DIGlobalVariable, 8> GVs; // Global Variables;
+ SmallVector<DIType, 8> TYs; // Types
+ SmallVector<DIScope, 8> Scopes; // Scopes
SmallPtrSet<MDNode *, 64> NodesSeen;
DITypeIdentifierMap TypeIdentifierMap;
/// Specify if TypeIdentifierMap is initialized.