DebugInfo: Move DILocation::computeNewDiscriminators()
[oota-llvm.git] / include / llvm / IR / DebugInfo.h
index dc1514d16af2c143d32007071ff218b5259b2487..6fcf1ee65cd3943b7e6585e571ed61ef2109a680 100644 (file)
@@ -63,10 +63,6 @@ typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;
 /// This should not be stored in a container, because the underlying MDNode may
 /// change in certain situations.
 class DIDescriptor {
-  // Befriends DIRef so DIRef can befriend the protected member
-  // function: getFieldAs<DIRef>.
-  template <typename T> friend class DIRef;
-
 public:
   /// \brief Duplicated debug info flags.
   ///
@@ -80,11 +76,6 @@ public:
 protected:
   const MDNode *DbgNode;
 
-  DIDescriptor getDescriptorField(unsigned Elt) const;
-  template <typename DescTy> DescTy getFieldAs(unsigned Elt) const {
-    return DescTy(getDescriptorField(Elt));
-  }
-
 public:
   explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
   DIDescriptor(const DebugNode *N) : DbgNode(N) {}
@@ -92,10 +83,7 @@ public:
   MDNode *get() const { return const_cast<MDNode *>(DbgNode); }
   operator MDNode *() const { return get(); }
   MDNode *operator->() const { return get(); }
-  MDNode &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDNode &operator*() const { return *get(); }
 
   // An explicit operator bool so that we can do testing of DI values
   // easily.
@@ -115,10 +103,6 @@ public:
 
   void print(raw_ostream &OS) const;
   void dump() const;
-
-  /// \brief Replace all uses of debug info referenced by this descriptor.
-  void replaceAllUsesWith(LLVMContext &VMContext, DIDescriptor D);
-  void replaceAllUsesWith(MDNode *D);
 };
 
 #define DECLARE_SIMPLIFY_DESCRIPTOR(DESC)                                      \
@@ -164,10 +148,7 @@ public:
   }
   operator MDSubrange *() const { return get(); }
   MDSubrange *operator->() const { return get(); }
-  MDSubrange &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDSubrange &operator*() const { return *get(); }
 
   int64_t getLo() const { return get()->getLowerBound(); }
   int64_t getCount() const { return get()->getCount(); }
@@ -187,10 +168,7 @@ public:
   }
   operator MDEnumerator *() const { return get(); }
   MDEnumerator *operator->() const { return get(); }
-  MDEnumerator &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDEnumerator &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
   int64_t getEnumValue() const { return get()->getValue(); }
@@ -217,22 +195,12 @@ public:
   MDScope *get() const { return cast_or_null<MDScope>(DIDescriptor::get()); }
   operator MDScope *() const { return get(); }
   MDScope *operator->() const { return get(); }
-  MDScope &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDScope &operator*() const { return *get(); }
 
-  /// \brief Get the parent scope.
-  ///
-  /// Gets the parent scope for this scope node or returns a default
-  /// constructed scope.
-  DIScopeRef getContext() const;
-  /// \brief Get the scope name.
-  ///
-  /// If the scope node has a name, return that, else return an empty string.
-  StringRef getName() const;
-  StringRef getFilename() const;
-  StringRef getDirectory() const;
+  inline DIScopeRef getContext() const;
+  StringRef getName() const { return get()->getName(); }
+  StringRef getFilename() const { return get()->getFilename(); }
+  StringRef getDirectory() const { return get()->getDirectory(); }
 
   /// \brief Generate a reference to this DIScope.
   ///
@@ -245,17 +213,10 @@ public:
 ///
 /// Abstracts over direct and identifier-based metadata references.
 template <typename T> class DIRef {
-  template <typename DescTy>
-  friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
-  friend DIScopeRef DIScope::getContext() const;
-  friend DIScopeRef DIScope::getRef() const;
-  friend class DIType;
-
   /// \brief Val can be either a MDNode or a MDString.
   ///
   /// In the latter, MDString specifies the type identifier.
   const Metadata *Val;
-  explicit DIRef(const Metadata *V);
 
 public:
   template <class U>
@@ -266,8 +227,6 @@ public:
 
   T resolve(const DITypeIdentifierMap &Map) const;
   operator Metadata *() const { return const_cast<Metadata *>(Val); }
-
-  static DIRef get(const Metadata *MD) { return DIRef(MD); }
 };
 
 template <>
@@ -276,21 +235,7 @@ template <>
 DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const;
 template <> DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const;
 
-/// \brief Handle fields that are references to DIDescriptors.
-template <>
-DIDescriptorRef DIDescriptor::getFieldAs<DIDescriptorRef>(unsigned Elt) const;
-/// \brief Specialize DIRef constructor for DIDescriptorRef.
-template <> DIRef<DIDescriptor>::DIRef(const Metadata *V);
-
-/// \brief Handle fields that are references to DIScopes.
-template <> DIScopeRef DIDescriptor::getFieldAs<DIScopeRef>(unsigned Elt) const;
-/// \brief Specialize DIRef constructor for DIScopeRef.
-template <> DIRef<DIScope>::DIRef(const Metadata *V);
-
-/// \brief Handle fields that are references to DITypes.
-template <> DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const;
-/// \brief Specialize DIRef constructor for DITypeRef.
-template <> DIRef<DIType>::DIRef(const Metadata *V);
+DIScopeRef DIScope::getContext() const { return get()->getScope(); }
 
 /// \brief This is a wrapper for a type.
 ///
@@ -304,12 +249,9 @@ public:
   MDType *get() const { return cast_or_null<MDType>(DIDescriptor::get()); }
   operator MDType *() const { return get(); }
   MDType *operator->() const { return get(); }
-  MDType &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDType &operator*() const { return *get(); }
 
-  DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
+  DIScopeRef getContext() const { return get()->getScope(); }
   StringRef getName() const { return get()->getName(); }
   unsigned getLineNumber() const { return get()->getLine(); }
   uint64_t getSizeInBits() const { return get()->getSizeInBits(); }
@@ -348,10 +290,7 @@ public:
   }
   operator MDBasicType *() const { return get(); }
   MDBasicType *operator->() const { return get(); }
-  MDBasicType &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDBasicType &operator*() const { return *get(); }
 
   unsigned getEncoding() const { return get()->getEncoding(); }
 };
@@ -370,36 +309,21 @@ public:
   }
   operator MDDerivedTypeBase *() const { return get(); }
   MDDerivedTypeBase *operator->() const { return get(); }
-  MDDerivedTypeBase &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDDerivedTypeBase &operator*() const { return *get(); }
 
-  DITypeRef getTypeDerivedFrom() const {
-    return DITypeRef::get(get()->getBaseType());
-  }
+  DITypeRef getTypeDerivedFrom() const { return get()->getBaseType(); }
 
   /// \brief Return property node, if this ivar is associated with one.
-  MDNode *getObjCProperty() const {
-    if (auto *N = dyn_cast<MDDerivedType>(get()))
-      return dyn_cast_or_null<MDNode>(N->getExtraData());
-    return nullptr;
+  MDObjCProperty *getObjCProperty() const {
+    return cast<MDDerivedType>(get())->getObjCProperty();
   }
 
   DITypeRef getClassType() const {
-    assert(getTag() == dwarf::DW_TAG_ptr_to_member_type);
-    if (auto *N = dyn_cast<MDDerivedType>(get()))
-      return DITypeRef::get(N->getExtraData());
-    return DITypeRef::get(nullptr);
+    return cast<MDDerivedType>(get())->getClassType();
   }
 
   Constant *getConstant() const {
-    assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
-    if (auto *N = dyn_cast<MDDerivedType>(get()))
-      if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getExtraData()))
-        return C->getValue();
-
-    return nullptr;
+    return cast<MDDerivedType>(get())->getConstant();
   }
 };
 
@@ -424,10 +348,7 @@ public:
   }
   operator MDCompositeTypeBase *() const { return get(); }
   MDCompositeTypeBase *operator->() const { return get(); }
-  MDCompositeTypeBase &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDCompositeTypeBase &operator*() const { return *get(); }
 
   DIArray getElements() const {
     assert(!isa<MDSubroutineType>(*this) && "no elements for DISubroutineType");
@@ -435,9 +356,7 @@ public:
   }
 
   unsigned getRunTimeLang() const { return get()->getRuntimeLang(); }
-  DITypeRef getContainingType() const {
-    return DITypeRef::get(get()->getVTableHolder());
-  }
+  DITypeRef getContainingType() const { return get()->getVTableHolder(); }
 
   DIArray getTemplateParams() const { return get()->getTemplateParams(); }
   MDString *getIdentifier() const { return get()->getRawIdentifier(); }
@@ -453,10 +372,7 @@ public:
   }
   operator MDSubroutineType *() const { return get(); }
   MDSubroutineType *operator->() const { return get(); }
-  MDSubroutineType &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDSubroutineType &operator*() const { return *get(); }
 
   MDTypeRefArray getTypeArray() const { return get()->getTypeArray(); }
 };
@@ -470,10 +386,7 @@ public:
   MDFile *get() const { return cast_or_null<MDFile>(DIDescriptor::get()); }
   operator MDFile *() const { return get(); }
   MDFile *operator->() const { return get(); }
-  MDFile &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDFile &operator*() const { return *get(); }
 
   /// \brief Retrieve the MDNode for the directory/file pair.
   MDNode *getFileNode() const { return get(); }
@@ -490,10 +403,7 @@ public:
   }
   operator MDCompileUnit *() const { return get(); }
   MDCompileUnit *operator->() const { return get(); }
-  MDCompileUnit &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDCompileUnit &operator*() const { return *get(); }
 
   dwarf::SourceLanguage getLanguage() const {
     return static_cast<dwarf::SourceLanguage>(get()->getSourceLanguage());
@@ -503,17 +413,11 @@ public:
   StringRef getFlags() const { return get()->getFlags(); }
   unsigned getRunTimeVersion() const { return get()->getRuntimeVersion(); }
 
-  DIArray getEnumTypes() const { return DIArray(get()->getEnumTypes()); }
-  DIArray getRetainedTypes() const {
-    return DIArray(get()->getRetainedTypes());
-  }
-  DIArray getSubprograms() const { return DIArray(get()->getSubprograms()); }
-  DIArray getGlobalVariables() const {
-    return DIArray(get()->getGlobalVariables());
-  }
-  DIArray getImportedEntities() const {
-    return DIArray(get()->getImportedEntities());
-  }
+  DIArray getEnumTypes() const { return get()->getEnumTypes(); }
+  DIArray getRetainedTypes() const { return get()->getRetainedTypes(); }
+  DIArray getSubprograms() const { return get()->getSubprograms(); }
+  DIArray getGlobalVariables() const { return get()->getGlobalVariables(); }
+  DIArray getImportedEntities() const { return get()->getImportedEntities(); }
 
   void replaceSubprograms(DIArray Subprograms);
   void replaceGlobalVariables(DIArray GlobalVariables);
@@ -535,10 +439,7 @@ public:
   }
   operator MDSubprogram *() const { return get(); }
   MDSubprogram *operator->() const { return get(); }
-  MDSubprogram &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDSubprogram &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
   StringRef getDisplayName() const { return get()->getDisplayName(); }
@@ -559,29 +460,20 @@ public:
   /// \brief Get the beginning of the scope of the function (not the name).
   unsigned getScopeLineNumber() const { return get()->getScopeLine(); }
 
-  DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
-  DISubroutineType getType() const {
-    return DISubroutineType(get()->getType());
-  }
+  DIScopeRef getContext() const { return get()->getScope(); }
+  DISubroutineType getType() const { return get()->getType(); }
 
-  DITypeRef getContainingType() const {
-    return DITypeRef::get(get()->getContainingType());
-  }
+  DITypeRef getContainingType() const { return get()->getContainingType(); }
 
   /// \brief Check if this provides debugging information for the function F.
-  bool describes(const Function *F);
+  bool describes(const Function *F) const { return get()->describes(F); }
 
-  Function *getFunction() const;
+  Function *getFunction() const { return get()->getFunction(); }
 
-  void replaceFunction(Function *F) {
-    if (auto *N = get())
-      N->replaceFunction(F);
-  }
-  DIArray getTemplateParams() const {
-    return DIArray(get()->getTemplateParams());
-  }
+  void replaceFunction(Function *F) { get()->replaceFunction(F); }
+  DIArray getTemplateParams() const { return get()->getTemplateParams(); }
   DISubprogram getFunctionDeclaration() const {
-    return DISubprogram(get()->getDeclaration());
+    return get()->getDeclaration();
   }
   DIArray getVariables() const { return DIArray(get()->getVariables()); }
 
@@ -606,10 +498,7 @@ public:
   }
   operator MDLexicalBlockBase *() const { return get(); }
   MDLexicalBlockBase *operator->() const { return get(); }
-  MDLexicalBlockBase &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDLexicalBlockBase &operator*() const { return *get(); }
 
   DIScope getContext() const { return DIScope(get()->getScope()); }
   unsigned getLineNumber() const {
@@ -635,10 +524,7 @@ public:
   }
   operator MDLexicalBlockFile *() const { return get(); }
   MDLexicalBlockFile *operator->() const { return get(); }
-  MDLexicalBlockFile &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDLexicalBlockFile &operator*() const { return *get(); }
 
   DIScope getContext() const { return get()->getScope(); }
   unsigned getDiscriminator() const { return get()->getDiscriminator(); }
@@ -655,10 +541,7 @@ public:
   }
   operator MDNamespace *() const { return get(); }
   MDNamespace *operator->() const { return get(); }
-  MDNamespace &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDNamespace &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
   unsigned getLineNumber() const { return get()->getLine(); }
@@ -676,14 +559,10 @@ public:
   }
   operator MDTemplateTypeParameter *() const { return get(); }
   MDTemplateTypeParameter *operator->() const { return get(); }
-  MDTemplateTypeParameter &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDTemplateTypeParameter &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
-
-  DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
+  DITypeRef getType() const { return get()->getType(); }
 };
 
 /// \brief This is a wrapper for template value parameter.
@@ -698,13 +577,10 @@ public:
   }
   operator MDTemplateValueParameter *() const { return get(); }
   MDTemplateValueParameter *operator->() const { return get(); }
-  MDTemplateValueParameter &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDTemplateValueParameter &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
-  DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
+  DITypeRef getType() const { return get()->getType(); }
   Metadata *getValue() const { return get()->getValue(); }
 };
 
@@ -721,10 +597,7 @@ public:
   }
   operator MDGlobalVariable *() const { return get(); }
   MDGlobalVariable *operator->() const { return get(); }
-  MDGlobalVariable &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDGlobalVariable &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
   StringRef getDisplayName() const { return get()->getDisplayName(); }
@@ -733,20 +606,14 @@ public:
   unsigned isLocalToUnit() const { return get()->isLocalToUnit(); }
   unsigned isDefinition() const { return get()->isDefinition(); }
 
-  DIScope getContext() const { return DIScope(get()->getScope()); }
-  StringRef getFilename() const { return getFile().getFilename(); }
-  StringRef getDirectory() const { return getFile().getDirectory(); }
-  DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
+  DIScope getContext() const { return get()->getScope(); }
+  StringRef getFilename() const { return get()->getFilename(); }
+  StringRef getDirectory() const { return get()->getDirectory(); }
+  DITypeRef getType() const { return get()->getType(); }
 
-  GlobalVariable *getGlobal() const;
-  Constant *getConstant() const {
-    if (auto *N = get())
-      if (auto *C = dyn_cast_or_null<ConstantAsMetadata>(N->getVariable()))
-        return C->getValue();
-    return nullptr;
-  }
+  Constant *getConstant() const { return get()->getVariable(); }
   DIDerivedType getStaticDataMemberDeclaration() const {
-    return DIDerivedType(get()->getStaticDataMemberDeclaration());
+    return get()->getStaticDataMemberDeclaration();
   }
 };
 
@@ -763,36 +630,27 @@ public:
   }
   operator MDLocalVariable *() const { return get(); }
   MDLocalVariable *operator->() const { return get(); }
-  MDLocalVariable &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDLocalVariable &operator*() const { return *get(); }
 
   StringRef getName() const { return get()->getName(); }
   unsigned getLineNumber() const { return get()->getLine(); }
   unsigned getArgNumber() const { return get()->getArg(); }
 
-  DIScope getContext() const { return DIScope(get()->getScope()); }
-  DIFile getFile() const { return DIFile(get()->getFile()); }
-  DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
+  DIScope getContext() const { return get()->getScope(); }
+  DIFile getFile() const { return get()->getFile(); }
+  DITypeRef getType() const { return get()->getType(); }
 
   bool isArtificial() const { return get()->isArtificial(); }
   bool isObjectPointer() const { return get()->isObjectPointer(); }
 
   /// \brief If this variable is inlined then return inline location.
-  MDNode *getInlinedAt() const { return DIDescriptor(get()->getInlinedAt()); }
+  MDNode *getInlinedAt() const { return get()->getInlinedAt(); }
 
   /// \brief Check if this is a "__block" variable (Apple Blocks).
   bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {
     return (getType().resolve(Map)).isBlockByrefStruct();
   }
 
-  /// \brief Check if this is an inlined function argument.
-  bool isInlinedFnArgument(const Function *CurFn);
-
-  /// \brief Return the size reported by the variable's type.
-  unsigned getSizeInBits(const DITypeIdentifierMap &Map);
-
   void printExtendedName(raw_ostream &OS) const;
 };
 
@@ -813,10 +671,7 @@ public:
   }
   operator MDExpression *() const { return get(); }
   MDExpression *operator->() const { return get(); }
-  MDExpression &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDExpression &operator*() const { return *get(); }
 
   unsigned getNumElements() const { return get()->getNumElements(); }
   uint64_t getElement(unsigned I) const { return get()->getElement(I); }
@@ -838,45 +693,15 @@ public:
   }
   operator MDLocation *() const { return get(); }
   MDLocation *operator->() const { return get(); }
-  MDLocation &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDLocation &operator*() const { return *get(); }
 
   unsigned getLineNumber() const { return get()->getLine(); }
   unsigned getColumnNumber() const { return get()->getColumn(); }
   DIScope getScope() const { return DIScope(get()->getScope()); }
-  DILocation getOrigLocation() const {
-    return DILocation(get()->getInlinedAt());
-  }
-  StringRef getFilename() const { return getScope().getFilename(); }
-  StringRef getDirectory() const { return getScope().getDirectory(); }
-  bool atSameLineAs(const DILocation &Other) const {
-    return (getLineNumber() == Other.getLineNumber() &&
-            getFilename() == Other.getFilename());
-  }
-  /// \brief Get the DWAF discriminator.
-  ///
-  /// DWARF discriminators are used to distinguish identical file locations for
-  /// instructions that are on different basic blocks. If two instructions are
-  /// inside the same lexical block and are in different basic blocks, we
-  /// create a new lexical block with identical location as the original but
-  /// with a different discriminator value
-  /// (lib/Transforms/Util/AddDiscriminators.cpp for details).
-  unsigned getDiscriminator() const {
-    // Since discriminators are associated with lexical blocks, make
-    // sure this location is a lexical block before retrieving its
-    // value.
-    if (auto *F = dyn_cast<MDLexicalBlockFile>(get()->getScope()))
-      return F->getDiscriminator();
-    return 0;
-  }
-
-  /// \brief Generate a new discriminator value for this location.
-  unsigned computeNewDiscriminator(LLVMContext &Ctx);
-
-  /// \brief Return a copy of this location with a different scope.
-  DILocation copyWithNewScope(LLVMContext &Ctx, DILexicalBlockFile NewScope);
+  DILocation getOrigLocation() const { return get()->getInlinedAt(); }
+  StringRef getFilename() const { return get()->getFilename(); }
+  StringRef getDirectory() const { return get()->getDirectory(); }
+  unsigned getDiscriminator() const { return get()->getDiscriminator(); }
 };
 
 class DIObjCProperty : public DIDescriptor {
@@ -889,42 +714,21 @@ public:
   }
   operator MDObjCProperty *() const { return get(); }
   MDObjCProperty *operator->() const { return get(); }
-  MDObjCProperty &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDObjCProperty &operator*() const { return *get(); }
 
   StringRef getObjCPropertyName() const { return get()->getName(); }
-  DIFile getFile() const { return DIFile(get()->getFile()); }
+  DIFile getFile() const { return get()->getFile(); }
   unsigned getLineNumber() const { return get()->getLine(); }
 
   StringRef getObjCPropertyGetterName() const { return get()->getGetterName(); }
   StringRef getObjCPropertySetterName() const { return get()->getSetterName(); }
   unsigned getAttributes() const { return get()->getAttributes(); }
-  bool isReadOnlyObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readonly) != 0;
-  }
-  bool isReadWriteObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_readwrite) != 0;
-  }
-  bool isAssignObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_assign) != 0;
-  }
-  bool isRetainObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_retain) != 0;
-  }
-  bool isCopyObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_copy) != 0;
-  }
-  bool isNonAtomicObjCProperty() const {
-    return (getAttributes() & dwarf::DW_APPLE_PROPERTY_nonatomic) != 0;
-  }
 
   /// \brief Get the type.
   ///
   /// \note Objective-C doesn't have an ODR, so there is no benefit in storing
   /// the type as a DITypeRef here.
-  DIType getType() const { return DIType(get()->getType()); }
+  DIType getType() const { return get()->getType(); }
 };
 
 /// \brief An imported module (C++ using directive or similar).
@@ -938,15 +742,10 @@ public:
   }
   operator MDImportedEntity *() const { return get(); }
   MDImportedEntity *operator->() const { return get(); }
-  MDImportedEntity &operator*() const {
-    assert(get() && "Expected valid pointer");
-    return *get();
-  }
+  MDImportedEntity &operator*() const { return *get(); }
 
-  DIScope getContext() const { return DIScope(get()->getScope()); }
-  DIDescriptorRef getEntity() const {
-    return DIDescriptorRef::get(get()->getEntity());
-  }
+  DIScope getContext() const { return get()->getScope(); }
+  DIDescriptorRef getEntity() const { return get()->getEntity(); }
   unsigned getLineNumber() const { return get()->getLine(); }
   StringRef getName() const { return get()->getName(); }
 };