From 8cf2a5b5c2f90c84303dbbd7742f763efad86c3f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 13 Oct 2001 06:12:38 +0000 Subject: [PATCH] Add assertions llvm-svn: 734 --- include/llvm/GlobalVariable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/llvm/GlobalVariable.h b/include/llvm/GlobalVariable.h index 2e298058f52..66ab21c42af 100644 --- a/include/llvm/GlobalVariable.h +++ b/include/llvm/GlobalVariable.h @@ -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) {