Assert that MCSymbolizer is constructed with a valid (or at least non-null)
authorLang Hames <lhames@gmail.com>
Thu, 27 Mar 2014 02:49:18 +0000 (02:49 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 27 Mar 2014 02:49:18 +0000 (02:49 +0000)
RelocationInfo argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204893 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCSymbolizer.h

index 95d29ec673a520c60edb62a26b8c063037b3ec57..64c2b38bf6f9bdb8e57362bf1e792d0b1eaadfcd 100644 (file)
@@ -47,7 +47,10 @@ protected:
 public:
   /// \brief Construct an MCSymbolizer, taking ownership of \p RelInfo.
   MCSymbolizer(MCContext &Ctx, std::unique_ptr<MCRelocationInfo> RelInfo)
-    : Ctx(Ctx), RelInfo(std::move(RelInfo)) {}
+    : Ctx(Ctx), RelInfo(std::move(RelInfo)) {
+    assert(this->RelInfo != nullptr &&
+           "Cannot construct MCSymbolizer without relocation info.");
+  }
 
   virtual ~MCSymbolizer();