DebugInfo: Remove a few unnecessary wrappers
[oota-llvm.git] / include / llvm / IR / DebugInfo.h
index 9237377e2a3b66423cc795361af81a2882b544be..b2685da6573792d13cd318aab5a3c26860dbb444 100644 (file)
@@ -106,10 +106,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)                                      \
@@ -213,15 +209,8 @@ public:
     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;
+  inline DIScopeRef getContext() const;
+  StringRef getName() const { return get()->getName(); }
   StringRef getFilename() const { return get()->getFilename(); }
   StringRef getDirectory() const { return get()->getDirectory(); }
 
@@ -258,6 +247,8 @@ template <>
 DIScope DIRef<DIScope>::resolve(const DITypeIdentifierMap &Map) const;
 template <> DIType DIRef<DIType>::resolve(const DITypeIdentifierMap &Map) const;
 
+DIScopeRef DIScope::getContext() const { return get()->getScope(); }
+
 /// \brief This is a wrapper for a type.
 ///
 /// FIXME: Types should be factored much better so that CV qualifiers and
@@ -522,26 +513,19 @@ public:
   unsigned getScopeLineNumber() const { return get()->getScopeLine(); }
 
   DIScopeRef getContext() const { return get()->getScope(); }
-  DISubroutineType getType() const {
-    return DISubroutineType(get()->getType());
-  }
+  DISubroutineType getType() const { return get()->getType(); }
 
   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()); }
 
@@ -698,12 +682,7 @@ public:
   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());
   }
@@ -749,9 +728,6 @@ public:
   /// \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;
 };