projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a2b5f45
)
Make GlobalVariable constructor assert when an initializer is of
author
Alkis Evlogimenos
<alkis@evlogimenos.com>
Thu, 5 Aug 2004 11:28:34 +0000
(11:28 +0000)
committer
Alkis Evlogimenos
<alkis@evlogimenos.com>
Thu, 5 Aug 2004 11:28:34 +0000
(11:28 +0000)
incorrect type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15519
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/Globals.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/Globals.cpp
b/lib/VMCore/Globals.cpp
index 2369d1c8eaa11d4f4e903f1a589d32fe64bda36e..cfecbc91ce064f2bf882553534359848ad8a0783 100644
(file)
--- a/
lib/VMCore/Globals.cpp
+++ b/
lib/VMCore/Globals.cpp
@@
-76,7
+76,11
@@
GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link,
const std::string &Name, Module *ParentModule)
: GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, Link, Name),
isConstantGlobal(constant) {
- if (Initializer) Operands.push_back(Use((Value*)Initializer, this));
+ if (Initializer) {
+ assert(Initializer->getType() == Ty &&
+ "Initializer should be the same type as the GlobalVariable!");
+ Operands.push_back(Use((Value*)Initializer, this));
+ }
LeakDetector::addGarbageObject(this);