DebugInfo: Move an assertion into MDCompositeTypeBase
[oota-llvm.git] / include / llvm / IR / DebugInfoMetadata.h
index 48fc8bbb951dd5a22116842e74fe30c5653a36f9..9e6117c9521440808eb42c30e903082e71c5b2d1 100644 (file)
@@ -786,7 +786,13 @@ protected:
   ~MDCompositeTypeBase() = default;
 
 public:
+  /// \brief Get the elements of the composite type.
+  ///
+  /// \note Calling this is only valid for \a MDCompositeType.  This assertion
+  /// can be removed once \a MDSubroutineType has been separated from
+  /// "composite types".
   DebugNodeArray getElements() const {
+    assert(!isa<MDSubroutineType>(this) && "no elements for DISubroutineType");
     return cast_or_null<MDTuple>(getRawElements());
   }
   MDTypeRef getVTableHolder() const { return MDTypeRef(getRawVTableHolder()); }