Add assertions
authorChris Lattner <sabre@nondot.org>
Sat, 13 Oct 2001 06:12:38 +0000 (06:12 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 13 Oct 2001 06:12:38 +0000 (06:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@734 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/GlobalVariable.h

index 2e298058f5245a086036588eb72159a98e8c1556..66ab21c42af04b112a3d48d1c1f2dcae7da20b75 100644 (file)
@@ -36,9 +36,11 @@ public:
   //
   inline bool hasInitializer() const { return !Operands.empty(); }
   inline const ConstPoolVal *getInitializer() const {
+    assert(hasInitializer() && "GV doesn't have initializer!");
     return (const ConstPoolVal*)Operands[0].get();
   }
   inline ConstPoolVal *getInitializer() {
+    assert(hasInitializer() && "GV doesn't have initializer!");
     return (ConstPoolVal*)Operands[0].get();
   }
   inline void setInitializer(ConstPoolVal *CPV) {